Python library for building AI agents with OpenAI Responses API.
- Multiple Interfaces: Console, REST API with SSE, and MCP
- Conversation Continuation: Via
previous_response_id - Session Management: Automatic cleanup with configurable TTL
- Agent Registry: Dynamic route and tool generation
git clone https://github.com/pradeepiyer/agent-kit
cd agent-kit
uv sync
export OPENAI_API_KEY="sk-..."
uv run python -m agents.helloSee agents/hello/ for complete examples.
from agent_kit.api.console.server import SlashCommands
class MyCommands(SlashCommands):
def __init__(self, console):
super().__init__(console)
self.register_command("/analyze", self._handle_analyze, "Run analysis")
async def _handle_analyze(self, args: list[str]) -> None:
passfrom agent_kit.api.http import AgentRegistry, create_server
registry = AgentRegistry()
registry.register(
name="my_agent",
agent_class=MyAgent,
description="Agent description",
request_model=MyRequest,
response_model=MyResponse,
)
config = get_config()
app = create_server(registry, config.interfaces.http, config.interfaces.session_ttl)POST /api/v1/{agent_name}- Execute agent (SSE streaming)POST /api/v1/sessions- Create sessionGET /api/v1/sessions/{id}- Get session
HTTP Mode: Enable via interfaces.http.mcp_http: true
Stdio Mode (Claude Desktop):
{
"mcpServers": {
"hello-agent": {
"command": "uv",
"args": ["run", "python", "-m", "agents.hello"]
}
}
}~/.{app-name}/config.yaml:
openai:
api_key: "${OPENAI_API_KEY}"
model: "gpt-4o"
interfaces:
session_ttl: 3600
http:
enabled: false
port: 8000
rest_api: true
mcp_http: true
console:
enabled: true
mcp_stdio:
enabled: falseuv run ruff check . && uv run ruff format .
uv run pyright
uv run pytest- Python 3.13+
- OpenAI API key
- uv package manager
MIT