What problem does it solve?
This skill integrates the OpenAI Agents SDK with a FastAPI backend to provide a stateless chat endpoint.
It covers loading conversation history from a database, running an agent with MCP tools, parsing tool calls, executing them, and persisting the full conversation across requests.
It requires the OpenAI Agents SDK, MCP tools, a Python web framework (FastAPI), and a database to implement a chat endpoint that loads history, executes tools, and saves conversations.
Core Features & Use Cases
- Stateless chat endpoint: load history, build message arrays, and generate responses.
- Tool integration: parse and execute MCP tool calls, then incorporate results into agent responses.
- Conversation persistence: save the entire dialogue after each interaction to the database.
- Use Case: Build a scalable chat backend for customer support or internal assistants that maintain context across requests without server-side session state.
Quick Start
To begin, deploy a FastAPI app and wire an endpoint at /api/{user_id}/chat, then send a POST with a message and optional conversation_id to see an agent respond and have the conversation persisted.