Acontext
Framework

OpenAI Agents SDK

Integrate OpenAI Agents SDK with Acontext for session persistence and task extraction

The OpenAI Agents SDK handles tool execution automatically. Use Converter.items_to_messages() to convert to Acontext-compatible format.

Quick Start

acontext create my-agent-project --template-path "python/openai-agent-basic"

Install CLI first: curl -fsSL https://install.acontext.io | sh

Manual Setup

Install dependencies

pip install openai-agents acontext python-dotenv

Configure environment

OPENAI_API_KEY=your_openai_key_here
ACONTEXT_API_KEY=sk-ac-your-api-key

Run agent with Acontext

Resume Sessions

from helper import message_to_input_items

messages = client.sessions.get_messages(session_id, format="openai")

# Convert back to Responses API format
conversation = []
for msg in messages.items:
    items = message_to_input_items(msg)
    conversation.extend(items)

conversation.append({"role": "user", "content": "Continue"})
result = await Runner.run(agent, conversation)

Next Steps

Last updated on

On this page