Skip to main content

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.
name
str
required
Agent name. Used as the endpoint identifier.
model
str
OpenAI model to use. Defaults to gpt-4o-mini.
instructions
str
System prompt for the model.
description
str
Agent description for discovery and documentation.
output_schema
dict
Output schema for task agents. Defines the structured output format.
tags
list[str]
Tags for filtering and organizing agents.
metadata
dict
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.