> ## Documentation Index
> Fetch the complete documentation index at: https://composio-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript and Python SDK examples

> Find runnable Composio examples by task, with links to source code and the relevant guide.

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.

## Start with a walkthrough

> [card] [Run an agent on Cloudflare Workers](https://composio-preview.mintlify.site/examples/cloudflare-workers.md)
>
> Build, test, and deploy an authenticated HTTP endpoint that runs an OpenAI agent with Composio tools.

> [card] [Select tools with TypeSafe](https://composio-preview.mintlify.site/examples/typesafe-tool-selection.md)
>
> Choose a tool, fill its arguments, and handle incomplete decisions before execution.

> [card] [Use CrewAI and LangChain with MCP](https://composio-preview.mintlify.site/examples/python-mcp-agents.md)
>
> Give either Python framework access to a Composio session through its MCP client.

> [card] [Analyze a CSV and download a report](https://composio-preview.mintlify.site/examples/csv-report-agent.md)
>
> Turn the session files API into an agent that produces a downloadable report.

> [card] [Use multiple accounts in one agent](https://composio-preview.mintlify.site/examples/multiple-accounts.md)
>
> Connect work and personal Gmail and require explicit account selection.

> [card] [Combine your own tools with Composio](https://composio-preview.mintlify.site/examples/custom-tools.md)
>
> Run local application tools alongside remote Composio tools.

> [card] [Run an agent when an email arrives](https://composio-preview.mintlify.site/examples/email-triggered-agent.md)
>
> Connect trigger setup, webhook verification, and agent execution.

## Find source code by task

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.

| Task | TypeScript source | Python source | Guide |
| - | - | - | - |
| 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](https://composio-preview.mintlify.site/examples/cloudflare-workers.md) |
| 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](https://composio-preview.mintlify.site/examples/typesafe-tool-selection.md) |
| 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](https://composio-preview.mintlify.site/examples/python-mcp-agents.md), [sessions via MCP](https://composio-preview.mintlify.site/docs/sessions-via-mcp.md) |
| 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](https://composio-preview.mintlify.site/examples/custom-tools.md#preload-selected-tools-while-keeping-discovery) |
| 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](https://composio-preview.mintlify.site/examples/custom-tools.md), [configure sessions](https://composio-preview.mintlify.site/docs/configuring-sessions.md) |
| 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](https://composio-preview.mintlify.site/docs/how-composio-works.md) |
| 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](https://composio-preview.mintlify.site/examples/csv-report-agent.md), [remote sandbox](https://composio-preview.mintlify.site/docs/sandbox/remote.md) |
| 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](https://composio-preview.mintlify.site/docs/authentication) |
| 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](https://composio-preview.mintlify.site/examples/multiple-accounts.md) |
| 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](https://composio-preview.mintlify.site/examples/email-triggered-agent.md), [receive events](https://composio-preview.mintlify.site/docs/setting-up-triggers/subscribing-to-events.md) |

## Run a repository example

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.

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](https://composio-preview.mintlify.site/examples/python-mcp-agents.md).

For a standalone project, use a walkthrough above. To choose a framework first, see [SDKs and frameworks](https://composio-preview.mintlify.site/docs/providers).
