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.22.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.22-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: reminix_openai-0.0.22.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.22.tar.gz
Algorithm Hash digest
SHA256 ebc45ac13b8a6ac126db33f81f6bf1428b11ed3c5ba549b49717f75236b75f04
MD5 39a977d7fc7235249c91ba1304514f6e
BLAKE2b-256 488a5d670d92615343c10104731524ed365831aa9e4d67e6bbf320f19f47217d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: reminix_openai-0.0.22-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.22-py3-none-any.whl
Algorithm Hash digest
SHA256 fb6e3892d4740e76e961952c916bafb915d5e6133758f2618430d7cf1128767c
MD5 945e54e3be83c2bf1ae57aac2450a6ea
BLAKE2b-256 e40a9a3e46542a3823c68d9019e8f0ef2c61d704d302ff1fd8597cc87f4fa524

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