docs/content/cookbooks/support-agent.mdx
This cookbook builds an agentic RAG system: an interactive CLI agent that triages support issues by pulling context from Notion docs, Datadog monitors, and GitHub issues. It uses scoped sessions, multi-turn chat with streaming, and a structured system prompt.
Create a new project and install dependencies:
mkdir composio-support-agent && cd composio-support-agent
uv init && uv add composio composio-openai-agents openai-agents
Add your API keys to a .env file:
COMPOSIO_API_KEY=your_composio_api_key
OPENAI_API_KEY=your_openai_api_key
Composio takes an OpenAIAgentsProvider so that tools come back in the format the OpenAI Agents SDK expects. We also import the streaming event types we'll need for real-time output.
<include>../../examples/support-agent/main.py#setup</include>
The system prompt tells the agent what tools it has and how to behave. It knows about Datadog, Notion, and GitHub, and decides on its own which to use based on the question.
<include>../../examples/support-agent/main.py#agent</include>
The chat loop creates a session scoped to three toolkits: datadog, notion, and github. The agent only sees tools from these services. Runner.run_streamed streams tokens as they arrive so you see the response in real time. Message history is tracked in a list for multi-turn context.
<include>../../examples/support-agent/main.py#chat</include>
<Callout> If a toolkit isn't connected yet, the agent will automatically return an authentication link in its response. The user can complete OAuth and then retry. </Callout>Here's everything together:
<include>../../examples/support-agent/main.py</include>
uv run --env-file .env python main.py
The agent starts an interactive chat. Type a message and watch the response stream in. Type quit to exit.
Support Knowledge Agent (type 'quit' to exit)
--------------------------------------------------
You: The payments service is returning 500 errors. Can you check what's going on?
Agent: I checked Datadog and found an active alert on the payments-api monitor...
The agent's scope is defined by its toolkits and system prompt. Swap them to build different support workflows: