Installation
pip install reminix-openai
This installs openai as a dependency.
Chat Agent
Use OpenAIChatAgent for conversational agents with streaming support.
from openai import AsyncOpenAI
from reminix_openai import OpenAIChatAgent
from reminix_runtime import serve
client = AsyncOpenAI()
chatbot = OpenAIChatAgent(client, name="chatbot", instructions="You are a helpful assistant.")
serve(agents=[chatbot])
The default model is gpt-4o-mini. Override it with the model parameter:
chatbot = OpenAIChatAgent(
client,
name="chatbot",
model="gpt-4o",
instructions="You are a helpful assistant.",
)
Streaming
Chat agents support streaming out of the box:
from reminix import Reminix
client = Reminix()
stream = client.agents.chat(
"chatbot",
messages=[{"role": "user", "content": "Hello!"}],
stream=True,
)
for event in stream:
if event.type == "text_delta":
print(event.delta, end="", flush=True)
Task Agent
Use OpenAITaskAgent for structured output with a defined schema.
from openai import AsyncOpenAI
from reminix_openai import OpenAITaskAgent
from reminix_runtime import serve
client = AsyncOpenAI()
analyzer = OpenAITaskAgent(
client,
name="analyzer",
instructions="Analyze the sentiment of the given text.",
output_schema={
"type": "object",
"properties": {
"sentiment": {"type": "string", "enum": ["positive", "negative", "neutral"]},
"confidence": {"type": "number"},
},
"required": ["sentiment", "confidence"],
},
)
serve(agents=[analyzer])
Options
The first argument to all OpenAI agent constructors is an AsyncOpenAI client instance.
Agent name. Used as the endpoint identifier.
OpenAI model to use. Defaults to gpt-4o-mini.
System prompt for the model.
Agent description for discovery and documentation.
Output schema for task agents. Defines the structured output format.
Tags for filtering and organizing agents.
Additional metadata attached to the agent.
Next steps
Deploying
Ship your OpenAI agent to production.
Configuration & Secrets
Where to put your OPENAI_API_KEY.
Anthropic
Same flow with the Anthropic SDK.
TypeScript: OpenAI
The same integration in TypeScript.