Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
docs: add support knowledge agent cookbook
Sushmitha Mallesh5870ddfe41df
diff --git a/docs/content/cookbooks/index.mdx b/docs/content/cookbooks/index.mdxindex b7939757e..adb0e6f4b 100644--- a/docs/content/cookbooks/index.mdx+++ b/docs/content/cookbooks/index.mdx@@ -21,6 +21,7 @@ Browse open-source templates or follow step-by-step guides below.## Productivity & Automation<Cards>+ <Card title="Support Knowledge Agent" href="/cookbooks/support-agent" description="Agentic RAG system that searches Notion, checks Datadog, and manages GitHub issues" /><Card title="Gmail Labeler" href="/cookbooks/gmail-labeler" description="Automatically label incoming emails using triggers" /><Card title="Slack Summarizer" href="/cookbooks/slack-summariser" description="Summarize Slack channel messages" /><Card title="Supabase SQL Agent" href="/cookbooks/supabase-sql-agent" description="Execute SQL queries using natural language" />diff --git a/docs/content/cookbooks/meta.json b/docs/content/cookbooks/meta.jsonindex 6425c53b7..2bf335eb5 100644--- a/docs/content/cookbooks/meta.json+++ b/docs/content/cookbooks/meta.json@@ -9,6 +9,7 @@"fast-api","hono","---Productivity & Automation---",+ "support-agent","gmail-labeler","slack-summariser","supabase-sql-agent",diff --git a/docs/content/cookbooks/support-agent.mdx b/docs/content/cookbooks/support-agent.mdxnew file mode 100644index 000000000..757d029c5--- /dev/null+++ b/docs/content/cookbooks/support-agent.mdx@@ -0,0 +1,76 @@+---+title: Support Knowledge Agent+description: Build an agentic RAG system that searches Notion, checks Datadog, and manages GitHub issues for support triage+---++[View source on GitHub](https://github.com/ComposioHQ/composio/tree/next/docs/examples/support-agent)++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.++## Prerequisites++* Python 3.10++* [UV](https://docs.astral.sh/uv/getting-started/installation/)+* [Composio API key](https://platform.composio.dev/settings)+* [OpenAI API key](https://platform.openai.com/api-keys)++## Project setup++Create a new project and install dependencies:++```bash+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:++```bash title=".env"+COMPOSIO_API_KEY=your_composio_api_key+OPENAI_API_KEY=your_openai_api_key+```++## Setting up the client++`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>++## Defining the agent++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>++## Chat loop with streaming++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>++## Complete script++Here's everything together:++<include>../../examples/support-agent/main.py</include>++## Running the agent++```bash+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...+```diff --git a/docs/examples/support-agent/main.py b/docs/examples/support-agent/main.pynew file mode 100644index 000000000..320e7d5b3--- /dev/null+++ b/docs/examples/support-agent/main.py@@ -0,0 +1,60 @@+# region setup+import asyncio++from agents import Agent, Runner+from agents.stream_events import RawResponsesStreamEvent+from composio import Composio+from composio_openai_agents import OpenAIAgentsProvider+from openai.types.responses import ResponseTextDeltaEvent++composio = Composio(provider=OpenAIAgentsProvider())+# endregion setup+++# region agent+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."""+++def create_agent(tools) -> Agent:+ return Agent(+ name="Support Knowledge Agent",+ model="gpt-5.2",+ instructions=SYSTEM_PROMPT,+ tools=tools,+ )+# endregion agent+++# region chat+async def main():+ user_id = "default"+ session = composio.create(+ user_id=user_id,+ toolkits=["datadog", "notion", "github"],+ )+ tools = session.tools()+ agent = create_agent(tools)++ messages = []+ print("Support Knowledge Agent (type 'quit' to exit)")+ print("-" * 50)++ while True:+ user_input = input("\nYou: ").strip()+ if not user_input or user_input.lower() == "quit":+ break++ messages.append({"role": "user", "content": user_input})++ print("\nAgent: ", end="", flush=True)+ result = Runner.run_streamed(starting_agent=agent, input=messages, max_turns=30)+ async for event in result.stream_events():+ if isinstance(event, RawResponsesStreamEvent) and isinstance(event.data, ResponseTextDeltaEvent):+ print(event.data.delta, end="", flush=True)+ print()++ messages.append({"role": "assistant", "content": result.final_output})+++asyncio.run(main())+# endregion chat