@devries-cameron20 / composio Mirror · read-only / commits / 5870ddfe4
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 05:45 UTC

docs: add support knowledge agent cookbook

Agentic RAG cookbook showing a CLI agent that triages support issues using Datadog, Notion, and GitHub tools with scoped sessions, streaming responses, and multi-turn chat. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmitha Mallesh committed Feb 25, 2026 at 20:45 UTC 5870ddfe41df4ddb35509807824ea78a35922f24
4 files changed +138
docs/content/cookbooks/index.mdx
+1
@@ -21,6 +21,7 @@ Browse open-source templates or follow step-by-step guides below.
21 ## Productivity & Automation
22
23 <Cards>
24 + <Card title="Support Knowledge Agent" href="/cookbooks/support-agent" description="Agentic RAG system that searches Notion, checks Datadog, and manages GitHub issues" />
25 <Card title="Gmail Labeler" href="/cookbooks/gmail-labeler" description="Automatically label incoming emails using triggers" />
26 <Card title="Slack Summarizer" href="/cookbooks/slack-summariser" description="Summarize Slack channel messages" />
27 <Card title="Supabase SQL Agent" href="/cookbooks/supabase-sql-agent" description="Execute SQL queries using natural language" />
docs/content/cookbooks/meta.json
+1
@@ -9,6 +9,7 @@
9 "fast-api",
10 "hono",
11 "---Productivity & Automation---",
12 + "support-agent",
13 "gmail-labeler",
14 "slack-summariser",
15 "supabase-sql-agent",
docs/content/cookbooks/support-agent.mdx new
+76
@@ -0,0 +1,76 @@
1 +---
2 +title: Support Knowledge Agent
3 +description: Build an agentic RAG system that searches Notion, checks Datadog, and manages GitHub issues for support triage
4 +---
5 +
6 +[View source on GitHub](https://github.com/ComposioHQ/composio/tree/next/docs/examples/support-agent)
7 +
8 +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.
9 +
10 +## Prerequisites
11 +
12 +* Python 3.10+
13 +* [UV](https://docs.astral.sh/uv/getting-started/installation/)
14 +* [Composio API key](https://platform.composio.dev/settings)
15 +* [OpenAI API key](https://platform.openai.com/api-keys)
16 +
17 +## Project setup
18 +
19 +Create a new project and install dependencies:
20 +
21 +```bash
22 +mkdir composio-support-agent && cd composio-support-agent
23 +uv init && uv add composio composio-openai-agents openai-agents
24 +```
25 +
26 +Add your API keys to a `.env` file:
27 +
28 +```bash title=".env"
29 +COMPOSIO_API_KEY=your_composio_api_key
30 +OPENAI_API_KEY=your_openai_api_key
31 +```
32 +
33 +## Setting up the client
34 +
35 +`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.
36 +
37 +<include>../../examples/support-agent/main.py#setup</include>
38 +
39 +## Defining the agent
40 +
41 +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.
42 +
43 +<include>../../examples/support-agent/main.py#agent</include>
44 +
45 +## Chat loop with streaming
46 +
47 +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.
48 +
49 +<include>../../examples/support-agent/main.py#chat</include>
50 +
51 +<Callout>
52 +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.
53 +</Callout>
54 +
55 +## Complete script
56 +
57 +Here's everything together:
58 +
59 +<include>../../examples/support-agent/main.py</include>
60 +
61 +## Running the agent
62 +
63 +```bash
64 +uv run --env-file .env python main.py
65 +```
66 +
67 +The agent starts an interactive chat. Type a message and watch the response stream in. Type `quit` to exit.
68 +
69 +```
70 +Support Knowledge Agent (type 'quit' to exit)
71 +--------------------------------------------------
72 +
73 +You: The payments service is returning 500 errors. Can you check what's going on?
74 +
75 +Agent: I checked Datadog and found an active alert on the payments-api monitor...
76 +```
docs/examples/support-agent/main.py new
+60
@@ -0,0 +1,60 @@
1 +# region setup
2 +import asyncio
3 +
4 +from agents import Agent, Runner
5 +from agents.stream_events import RawResponsesStreamEvent
6 +from composio import Composio
7 +from composio_openai_agents import OpenAIAgentsProvider
8 +from openai.types.responses import ResponseTextDeltaEvent
9 +
10 +composio = Composio(provider=OpenAIAgentsProvider())
11 +# endregion setup
12 +
13 +
14 +# region agent
15 +SYSTEM_PROMPT = """You are a Support Knowledge Agent. Use your tools to help the user triage issues, find documentation, and manage incidents. Call tools first, then respond with what you found. Be concise."""
16 +
17 +
18 +def create_agent(tools) -> Agent:
19 + return Agent(
20 + name="Support Knowledge Agent",
21 + model="gpt-5.2",
22 + instructions=SYSTEM_PROMPT,
23 + tools=tools,
24 + )
25 +# endregion agent
26 +
27 +
28 +# region chat
29 +async def main():
30 + user_id = "default"
31 + session = composio.create(
32 + user_id=user_id,
33 + toolkits=["datadog", "notion", "github"],
34 + )
35 + tools = session.tools()
36 + agent = create_agent(tools)
37 +
38 + messages = []
39 + print("Support Knowledge Agent (type 'quit' to exit)")
40 + print("-" * 50)
41 +
42 + while True:
43 + user_input = input("\nYou: ").strip()
44 + if not user_input or user_input.lower() == "quit":
45 + break
46 +
47 + messages.append({"role": "user", "content": user_input})
48 +
49 + print("\nAgent: ", end="", flush=True)
50 + result = Runner.run_streamed(starting_agent=agent, input=messages, max_turns=30)
51 + async for event in result.stream_events():
52 + if isinstance(event, RawResponsesStreamEvent) and isinstance(event.data, ResponseTextDeltaEvent):
53 + print(event.data.delta, end="", flush=True)
54 + print()
55 +
56 + messages.append({"role": "assistant", "content": result.final_output})
57 +
58 +
59 +asyncio.run(main())
60 +# endregion chat