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 21, 03:37 UTC
| 1 | --- |
| 2 | title: TypeScript and Python SDK examples |
| 3 | description: Find runnable Composio examples by task, with links to source code and the relevant guide. |
| 4 | keywords: [SDK examples, TypeScript examples, Python examples, Cloudflare, TypeSafe, CrewAI, LangChain, MCP] |
| 5 | --- |
| 6 | |
| 7 | Use these examples to try a specific Composio feature in your own project. Start with a walkthrough for complete setup instructions, or open a source file alongside its guide. |
| 8 | |
| 9 | ## Start with a walkthrough |
| 10 | |
| 11 | <Cards> |
| 12 | <Card title="Run an agent on Cloudflare Workers" href="/examples/cloudflare-workers" description="Build, test, and deploy an authenticated HTTP endpoint that runs an OpenAI agent with Composio tools." /> |
| 13 | <Card title="Select tools with TypeSafe" href="/examples/typesafe-tool-selection" description="Choose a tool, fill its arguments, and handle incomplete decisions before execution." /> |
| 14 | <Card title="Use CrewAI and LangChain with MCP" href="/examples/python-mcp-agents" description="Give either Python framework access to a Composio session through its MCP client." /> |
| 15 | <Card title="Analyze a CSV and download a report" href="/examples/csv-report-agent" description="Turn the session files API into an agent that produces a downloadable report." /> |
| 16 | <Card title="Use multiple accounts in one agent" href="/examples/multiple-accounts" description="Connect work and personal Gmail and require explicit account selection." /> |
| 17 | <Card title="Combine your own tools with Composio" href="/examples/custom-tools" description="Run local application tools alongside remote Composio tools." /> |
| 18 | <Card title="Run an agent when an email arrives" href="/examples/email-triggered-agent" description="Connect trigger setup, webhook verification, and agent execution." /> |
| 19 | </Cards> |
| 20 | |
| 21 | ## Find source code by task |
| 22 | |
| 23 | These are selected examples from [`ts/examples`](https://github.com/ComposioHQ/composio/tree/next/ts/examples), [`python/examples`](https://github.com/ComposioHQ/composio/tree/next/python/examples), and the Python TypeSafe provider. The directories also contain experiments and older API examples. Use the linked guide for the current setup and API choices. |
| 24 | |
| 25 | | Task | TypeScript source | Python source | Guide | |
| 26 | | --- | --- | --- | --- | |
| 27 | | Run an agent on Cloudflare Workers | [OpenAI Worker](https://github.com/ComposioHQ/composio/blob/next/ts/examples/openai/src/cloudflare.ts), [Mastra Worker](https://github.com/ComposioHQ/composio/blob/next/ts/examples/mastra/src/cloudflare.ts) | Not available | [Worker setup and deployment](/examples/cloudflare-workers) | |
| 28 | | Select and shortlist tools with TypeSafe | [TypeSafe examples](https://github.com/ComposioHQ/composio/tree/next/ts/examples/typesafe) | [TypeSafe demo](https://github.com/ComposioHQ/composio/blob/next/python/providers/typesafe/typesafe_demo.py) | [TypeSafe walkthrough](/examples/typesafe-tool-selection) | |
| 29 | | Connect an agent over MCP | [Vercel AI SDK](https://github.com/ComposioHQ/composio/blob/next/ts/examples/tool-router/src/mcp.ts) | [CrewAI](https://github.com/ComposioHQ/composio/blob/next/python/examples/tool_router/crewai_agent.py), [LangChain](https://github.com/ComposioHQ/composio/blob/next/python/examples/tool_router/langchain_agent.py) | [Python MCP walkthrough](/examples/python-mcp-agents), [sessions via MCP](/docs/sessions-via-mcp) | |
| 30 | | Preload tools in a session | [Preload tools](https://github.com/ComposioHQ/composio/blob/next/ts/examples/tool-router/src/preload.ts) | [Preload tools](https://github.com/ComposioHQ/composio/blob/next/python/examples/tool_router/preload.py) | [Custom tools walkthrough](/examples/custom-tools#preload-selected-tools-while-keeping-discovery) | |
| 31 | | Control which tools a session exposes | [Direct tools](https://github.com/ComposioHQ/composio/blob/next/ts/examples/tool-router/src/direct-tools-preset.ts) | [Direct tools](https://github.com/ComposioHQ/composio/blob/next/python/examples/tool_router/direct_tools_preset.py) | [Custom tools walkthrough](/examples/custom-tools), [configure sessions](/docs/configuring-sessions) | |
| 32 | | Change a session's configuration | [Update a session](https://github.com/ComposioHQ/composio/blob/next/ts/examples/tool-router/src/session-update.ts) | [Update a session](https://github.com/ComposioHQ/composio/blob/next/python/examples/tool_router/session_update.py) | [Sessions](/docs/how-composio-works) | |
| 33 | | Upload and download sandbox files | See guide | [Session files](https://github.com/ComposioHQ/composio/blob/next/python/examples/tool_router/files.py) | [CSV report walkthrough](/examples/csv-report-agent), [remote sandbox](/docs/sandbox/remote) | |
| 34 | | Connect an app for a user | [Connected accounts](https://github.com/ComposioHQ/composio/tree/next/ts/examples/connected-accounts) | [Authorize a session](https://github.com/ComposioHQ/composio/blob/next/python/examples/tool_router/authorize.py) | [Authentication](/docs/authentication) | |
| 35 | | Use multiple accounts in one agent | [Multi-account agent](https://github.com/ComposioHQ/composio/blob/next/ts/examples/tool-router/src/multi-account.ts) | See walkthrough | [Multiple accounts walkthrough](/examples/multiple-accounts) | |
| 36 | | Create triggers and receive events | [Trigger examples](https://github.com/ComposioHQ/composio/tree/next/ts/examples/triggers) | [Triggers](https://github.com/ComposioHQ/composio/blob/next/python/examples/triggers.py) | [Email-triggered agent](/examples/email-triggered-agent), [receive events](/docs/setting-up-triggers/subscribing-to-events) | |
| 37 | |
| 38 | ## Run a repository example |
| 39 | |
| 40 | Follow the [TypeScript setup](https://github.com/ComposioHQ/composio/blob/next/ts/examples/README.md) or [Python setup](https://github.com/ComposioHQ/composio/blob/next/python/examples/README.md) to install the workspace and configure credentials. Check the selected example for its model provider key and connected-account requirements. Scripts that create connections or triggers make changes in your Composio project. |
| 41 | |
| 42 | The LangChain MCP script declares its own dependencies. From the repository root, use `uv run --script python/examples/tool_router/langchain_agent.py` as shown in the [walkthrough](/examples/python-mcp-agents). |
| 43 | |
| 44 | For a standalone project, use a walkthrough above. To choose a framework first, see [SDKs and frameworks](/docs/providers). |