Skip to main content

Reminix agents for OpenAI - serve AI agents as REST APIs

Project description

reminix-openai

Reminix agents for the OpenAI API. Serve OpenAI models as a REST API with chat, task, and thread agents.

Ready to go live? Deploy to Reminix Cloud for zero-config hosting, or self-host on your own infrastructure.

Installation

pip install reminix-openai

This will also install reminix-runtime as a dependency.

Quick Start

Chat Agent

The chat agent follows the chat type and supports streaming responses.

from openai import AsyncOpenAI
from reminix_openai import OpenAIChatAgent
from reminix_runtime import serve

client = AsyncOpenAI()
agent = OpenAIChatAgent(client, name="my-chatbot", model="gpt-4o")
serve(agents=[agent])

Task Agent

The task agent follows the task type and returns structured output. Streaming is not supported.

from openai import AsyncOpenAI
from reminix_openai import OpenAITaskAgent
from reminix_runtime import serve

summary_schema = {
    "type": "object",
    "properties": {
        "title": {"type": "string"},
        "bullet_points": {"type": "array", "items": {"type": "string"}},
    },
    "required": ["title", "bullet_points"],
}

client = AsyncOpenAI()
agent = OpenAITaskAgent(client, output_schema=summary_schema, name="summarizer", model="gpt-4o")
serve(agents=[agent])

Thread Agent

The thread agent follows the thread type and supports tool use over multiple turns. Streaming is not supported.

from openai import AsyncOpenAI
from reminix_openai import OpenAIThreadAgent
from reminix_runtime import serve

def get_weather(location: str) -> str:
    return f"The weather in {location} is sunny."

client = AsyncOpenAI()
agent = OpenAIThreadAgent(
    client,
    tools=[get_weather],
    name="assistant",
    model="gpt-4o",
    max_turns=10,
)
serve(agents=[agent])

Your agents are now available at:

  • POST /agents/{name}/invoke - Execute the agent

API Reference

OpenAIChatAgent(client, *, name, model, description, instructions)

Create an OpenAI chat agent. Follows the chat type and supports streaming.

Parameter Type Default Description
client AsyncOpenAI required An OpenAI async client
name str "openai-agent" Name for the agent (used in URL path)
model str "gpt-4o-mini" Model to use for completions
description str "openai chat agent" Description shown in agent metadata
instructions str None System instructions prepended to messages
tags list[str] None Tags for categorizing/filtering agents
metadata dict None Custom metadata merged into agent info

Returns: OpenAIChatAgent - A Reminix chat agent instance

OpenAITaskAgent(client, *, output_schema, name, model, description, instructions, tags, metadata)

Create an OpenAI task agent. Follows the task type and returns structured output. Streaming is not supported.

Parameter Type Default Description
client AsyncOpenAI required An OpenAI async client
output_schema dict required A JSON Schema dict defining the structured output
name str "openai-task-agent" Name for the agent (used in URL path)
model str "gpt-4o-mini" Model to use for completions
description str "openai task agent" Description shown in agent metadata
instructions str None System instructions prepended to messages
tags list[str] None Tags for categorizing/filtering agents
metadata dict None Custom metadata merged into agent info

Returns: OpenAITaskAgent - A Reminix task agent instance

OpenAIThreadAgent(client, *, tools, name, model, max_turns, description, instructions, tags, metadata)

Create an OpenAI thread agent. Follows the thread type and supports tool use over multiple turns. Streaming is not supported.

Parameter Type Default Description
client AsyncOpenAI required An OpenAI async client
tools list required A list of tool functions the agent can call
name str "openai-thread-agent" Name for the agent (used in URL path)
model str "gpt-4o-mini" Model to use for completions
max_turns int 10 Maximum number of tool-use turns before stopping
description str "openai thread agent" Description shown in agent metadata
instructions str None System instructions prepended to messages
tags list[str] None Tags for categorizing/filtering agents
metadata dict None Custom metadata merged into agent info

Returns: OpenAIThreadAgent - A Reminix thread agent instance

Example with Custom Configuration

from openai import AsyncOpenAI
from reminix_openai import OpenAIChatAgent
from reminix_runtime import serve

client = AsyncOpenAI(
    api_key="your-api-key",
    base_url="https://your-proxy.com/v1"  # Optional: custom endpoint
)

agent = OpenAIChatAgent(
    client,
    name="gpt4-agent",
    model="gpt-4o"
)

serve(agents=[agent])

Endpoint Input/Output Formats

POST /agents/{name}/invoke

Execute the agent with a prompt or messages.

Request with prompt:

{
  "input": {
    "prompt": "Summarize this text: ..."
  }
}

Request with messages:

{
  "input": {
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello!"}
    ]
  }
}

Response:

{
  "output": "Hello! How can I help you today?"
}

Streaming

For streaming responses, set stream: true in the request (chat agent only):

{
  "input": {
    "prompt": "Tell me a story"
  },
  "stream": true
}

The response will be sent as Server-Sent Events (SSE).

Runtime Documentation

For information about the server, endpoints, request/response formats, and more, see the reminix-runtime package.

Deployment

Ready to go live?

Links

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reminix_openai-0.0.20.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reminix_openai-0.0.20-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file reminix_openai-0.0.20.tar.gz.

File metadata

  • Download URL: reminix_openai-0.0.20.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for reminix_openai-0.0.20.tar.gz
Algorithm Hash digest
SHA256 ff2d26b43b92b026de1d7697588aa61b8eb70344ef0d3e9224f9e13bf9bc8399
MD5 3a752b1ed47b469c217618aed6ca634e
BLAKE2b-256 fea00d3bb5cd7782cb795c51895d3fd3a37a716721dc8b6611b775a3967210b0

See more details on using hashes here.

File details

Details for the file reminix_openai-0.0.20-py3-none-any.whl.

File metadata

  • Download URL: reminix_openai-0.0.20-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for reminix_openai-0.0.20-py3-none-any.whl
Algorithm Hash digest
SHA256 e0f178aefdd5669af8cd806f9b6ade327234a0c4f3d7ee63df6dcaf6130d59a4
MD5 0d695ef19b452d5e38cdb97a75b604d8
BLAKE2b-256 96f78b34fdd7b2322f953c902221eb8c7272ac5165aa8296e4a1b819b8ab0bcb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page