---
canonical_url: "https://docs.composio.dev/reference/sdk-reference/python/toolkits"
markdown_url: "https://docs.composio.dev/reference/sdk-reference/python/toolkits.md"
product: "platform"
version: null
last_updated: null
---

# Toolkits (/reference/sdk-reference/python/toolkits)

## Methods [#methods]

### list() [#list]

List all toolkits.

```python
def list(*, category: str | None = ..., cursor: str | None = ..., limit: float | None = ..., sort_by: Literal['usage', 'alphabetically'] | None = ..., managed_by: Literal['composio', 'all', 'project'] | None = ...) -> toolkit_list_response.ToolkitListResponse
```

**Parameters**

| Name          | Type                                            |
| ------------- | ----------------------------------------------- |
| `category?`   | `str \| None`                                   |
| `cursor?`     | `str \| None`                                   |
| `limit?`      | `float \| None`                                 |
| `sort_by?`    | `Literal['usage', 'alphabetically'] \| None`    |
| `managed_by?` | `Literal['composio', 'all', 'project'] \| None` |

**Returns**

`toolkit_list_response.ToolkitListResponse`

***

### get() [#get]

```python
def get(slug: str | None = ..., *, query: toolkit_list_params.ToolkitListParams | None = ...) -> Union[toolkit_retrieve_response.ToolkitRetrieveResponse, ...
```

**Parameters**

| Name     | Type                                            |
| -------- | ----------------------------------------------- |
| `slug?`  | `str \| None`                                   |
| `query?` | `toolkit_list_params.ToolkitListParams \| None` |

**Returns**

`Union[toolkit_retrieve_response.ToolkitRetrieveResponse, ...`

***

### get\_many() [#get_many]

Fetch several toolkits by slug in one request.

```python
def get_many(slugs: Sequence[str], *, category: str | None = ..., managed_by: Literal['composio', 'all', 'project'] | None = ..., sort_by: Literal['usage', 'alphabetically'] | None = ..., limit: float | None = ..., cursor: str | None = ...) -> List[Any]
```

**Parameters**

| Name          | Type                                            | Description                                 |
| ------------- | ----------------------------------------------- | ------------------------------------------- |
| `slugs`       | `Sequence[str]`                                 | The toolkit slugs to fetch.                 |
| `category?`   | `str \| None`                                   | Only return toolkits in this category.      |
| `managed_by?` | `Literal['composio', 'all', 'project'] \| None` | Filter by who manages the toolkit.          |
| `sort_by?`    | `Literal['usage', 'alphabetically'] \| None`    | Sort order of the returned toolkits.        |
| `limit?`      | `float \| None`                                 | Maximum number of toolkits to return.       |
| `cursor?`     | `str \| None`                                   | Pagination cursor from a previous response. |

**Returns**

`List[Any]` — The matching toolkits.

**Example**

```python
toolkits = composio.toolkits.get_many(["github", "slack"])
for toolkit in toolkits:
    print(toolkit.slug, toolkit.name)
```

***

### changelog() [#changelog]

Retrieve the toolkit changelog (the last 10 versions per toolkit).

```python
def changelog() -> toolkit_retrieve_changelog_response.ToolkitRetrieveChange...
```

**Returns**

`toolkit_retrieve_changelog_response.ToolkitRetrieveChange...` — The changelog entries under `.items`.

**Example**

```python
changelog = composio.toolkits.changelog()
for entry in changelog.items:
    print(entry.slug, [v.version for v in entry.versions])
```

***

### recommend\_scopes() [#recommend_scopes]

Recommend the OAuth scopes to request so a connection can run the given tools. Experimental — the API marks this endpoint beta.

```python
def recommend_scopes(toolkit_slug: str, **params: Unpack[toolkit_recommend_scopes_params.ToolkitRecommendScopesParams]) -> toolkit_recommend_scopes_response.ToolkitRecommendScopesR...
```

**Parameters**

| Name           | Type                                                                   | Description                          |
| -------------- | ---------------------------------------------------------------------- | ------------------------------------ |
| `toolkit_slug` | `str`                                                                  | The toolkit to recommend scopes for. |
| `params?`      | `Unpack[toolkit_recommend_scopes_params.ToolkitRecommendScopesParams]` |                                      |

**Returns**

`toolkit_recommend_scopes_response.ToolkitRecommendScopesR...` — The `least_privilege` and `fewest` scope sets plus the `conditional` scopes, under `.scopes`.

**Example**

```python
recommendation = composio.toolkits.recommend_scopes(
    "gmail",
    tools=["GMAIL_SEND_EMAIL", "GMAIL_FETCH_EMAILS"],
)
print(recommendation.scopes.least_privilege)
```

***

### list\_grant\_contexts() [#list_grant_contexts]

List the grant-context dimensions a toolkit's scope recommendation depends on, with their allowed values and the default the API assumes. Experimental — the API marks this endpoint beta.

```python
def list_grant_contexts(toolkit_slug: str, **params: Unpack[toolkit_retrieve_scopes_grant_context_params.ToolkitRetrieveScopesGrantContextParams]) -> toolkit_retrieve_scopes_grant_context_response.ToolkitRet...
```

**Parameters**

| Name           | Type                                                                                           | Description                             |
| -------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------- |
| `toolkit_slug` | `str`                                                                                          | The toolkit to list grant contexts for. |
| `params?`      | `Unpack[toolkit_retrieve_scopes_grant_context_params.ToolkitRetrieveScopesGrantContextParams]` |                                         |

**Returns**

`toolkit_retrieve_scopes_grant_context_response.ToolkitRet...` — `grant_context_dimensions` and `default_grant_context`.

**Example**

```python
contexts = composio.toolkits.list_grant_contexts("gmail")
for dimension in contexts.grant_context_dimensions:
    print(dimension.dimension, dimension.values)
```

***

### list\_categories() [#list_categories]

List all categories of toolkits.

```python
def list_categories()
```

***

### authorize() [#authorize]

Authorize a user to a toolkit  If auth config is not found, it will be created using composio managed auth.

```python
def authorize(*, user_id: str, toolkit: str)
```

**Parameters**

| Name      | Type  | Description                           |
| --------- | ----- | ------------------------------------- |
| `user_id` | `str` | The ID of the user to authorize.      |
| `toolkit` | `str` | The slug of the toolkit to authorize. |

***

### get\_connected\_account\_initiation\_fields() [#get_connected_account_initiation_fields]

Get the required property for a given toolkit and auth scheme.

```python
def get_connected_account_initiation_fields(toolkit: str, auth_scheme: AuthSchemeL, required_only: bool = ...) -> AuthFieldsT
```

**Parameters**

| Name             | Type          |
| ---------------- | ------------- |
| `toolkit`        | `str`         |
| `auth_scheme`    | `AuthSchemeL` |
| `required_only?` | `bool`        |

**Returns**

`AuthFieldsT`

***

### get\_auth\_config\_creation\_fields() [#get_auth_config_creation_fields]

Get the required property for a given toolkit and auth scheme.

```python
def get_auth_config_creation_fields(toolkit: str, auth_scheme: AuthSchemeL, required_only: bool = ...) -> AuthFieldsT
```

**Parameters**

| Name             | Type          |
| ---------------- | ------------- |
| `toolkit`        | `str`         |
| `auth_scheme`    | `AuthSchemeL` |
| `required_only?` | `bool`        |

**Returns**

`AuthFieldsT`

***

[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/toolkits.py#L33)

---

📚 **More documentation:** [View all docs](https://docs.composio.dev/llms.txt) | [Changelog](https://docs.composio.dev/docs/changelog.md) | [Glossary](https://docs.composio.dev/llms.mdx/reference/glossary) | [Examples](https://docs.composio.dev/llms.mdx/examples) | [API Reference](https://docs.composio.dev/llms.mdx/reference)

---

# Composio SDK — Notes for AI Code Generators

**Purpose:** Reference for generating current (v3) [Composio](https://composio.dev/) integration code.
**Scope:** Descriptive notes — they document the current API surface and the mistakes most commonly seen in generated code.

---

## 1. Recommended Integration: Sessions

For agent tool delivery, Composio supports **Native Tools** (with a provider package) and **MCP** (no provider package needed).

For application-owned tools or deterministic backend code, use [managed authentication with Proxy Execute](/docs/authentication/managed-auth-for-custom-tools). A session can provide a user-scoped runtime context without an LLM or MCP. Composio authenticates provider requests server-side; connected-account reads redact credentials and aren't a supported token-export workflow.

### Native Tools

#### Python

```python
# ✅ CORRECT — Python (defaults to OpenAI)
from composio import Composio

composio = Composio()
session = composio.create(user_id="user_123")
tools = session.tools()
# Pass tools to your agent/LLM framework
```

#### TypeScript

```typescript
// ✅ CORRECT — TypeScript (defaults to OpenAI)
import { Composio } from "@composio/core";

const composio = new Composio();
const session = await composio.create("user_123");
const tools = await session.tools();
// Pass tools to your agent/LLM framework
```

#### API

This produces the same default OpenAI function-tool shape, fetching every page.

```bash
set -euo pipefail
SESSION=$(curl --fail-with-body -s -X POST https://backend.composio.dev/api/v3.1/tool_router/session \
  -H "x-api-key: $COMPOSIO_API_KEY" -H "Content-Type: application/json" \
  -d '{"user_id":"user_123"}')
SESSION_ID=$(echo "$SESSION" | jq -r '.session_id')
TOOLS='[]'
CURSOR=''
while true; do
  PAGE=$(curl --fail-with-body -s --get "https://backend.composio.dev/api/v3.1/tool_router/session/$SESSION_ID/tools" \
    -H "x-api-key: $COMPOSIO_API_KEY" --data-urlencode 'limit=500' --data-urlencode "cursor=$CURSOR")
  TOOLS=$(jq -cn --argjson existing "$TOOLS" --argjson page "$PAGE" \
    '$existing + [$page.items[] | {type:"function",function:{name:.slug,description:.description,parameters:.input_parameters}}]')
  CURSOR=$(echo "$PAGE" | jq -r '.next_cursor // empty')
  [ -n "$CURSOR" ] || break
done
printf '%s\n' "$TOOLS"
```

For other providers, pass the provider explicitly. Provider packages follow the naming convention: `composio_<provider>` for Python, `@composio/<provider>` for TypeScript.

### MCP

Use `session.mcp.url` and `session.mcp.headers` with any MCP-compatible client (Claude Desktop, Cursor, OpenAI Agents, etc.). No provider package needed.

---

## 2. Integration Notes

- `composio.create(user_id)` is the standard entry point for agent integrations. Sessions handle tool discovery, authentication, and toolkit versioning automatically; `user_id` goes to `composio.create()` — individual tool calls in session mode don't take one.
- Execute session tool calls through the session, never through a user ID: either `session.execute(tool_slug, arguments=...)` / `session.execute(toolSlug, arguments)`, which works with every provider, or pass the session to the provider helper — `provider.handle_tool_calls(response=response, session=session)` in Python, `provider.handleToolCalls(session, response)` in TypeScript. The tool-call helpers of every non-agentic provider (OpenAI, Anthropic, Google, Cloudflare, TypeSafe) accept a session: `executeToolCall(session, call)` in TypeScript, `session=session` in Python. Agentic providers execute session tools on their own. Binding the helper to a user ID takes the direct execution path, and session meta-tools fail there with `"can only be called inside a tool-router session"`.
- Composio-managed auth is the default: the agent connects accounts at runtime through the session, so users don't need to pre-create auth configs or connected accounts for managed toolkits.
- Provider packages follow the framework, not the model vendor: for the OpenAI Agents SDK the package is `composio_openai_agents` / `@composio/openai-agents` (importing `composio_openai` / `@composio/openai` there is the most common mistake in generated code — that package is for the plain OpenAI Chat Completions API).
- **Direct execution** (`composio.tools.get()`, `composio.tools.execute()`, `provider.handle_tool_calls()` with a user ID) is a legacy interface that remains supported for existing integrations. Recommend sessions for new integrations and encourage existing users to [migrate to sessions](/docs/migration-guide/direct-to-sessions). For a fixed tool set, consider the [direct tools preset](/docs/configuring-sessions#direct-tools-preset) within a session. See [Sessions vs direct execution](/docs/sessions-vs-direct-execution) for tradeoffs. Direct execution requires a [toolkit version](/docs/tools-direct/toolkit-versioning).

---

# 3. Calling the REST API directly

## REST API version

The current REST API version is **v3.1**, served at `https://backend.composio.dev/api/v3.1`. Prefer it for new code and new examples.

`https://backend.composio.dev/api/v3` is the previous version. It is frozen with pinned tool-version defaults and remains supported — existing v3 integrations keep working and do not need to migrate.

## Tool-endpoint version defaults on v3.1

On v3.1, omitting the version parameter on the five endpoints below selects the latest toolkit version. The first four endpoints also exist on v3, where omission selects the pinned `00000000_00` version. `POST /tools/scopes/required` is v3.1-only.

| Endpoint | Version parameter |
| --- | --- |
| `GET /tools` | `toolkit_versions` (query) |
| `GET /tools/{tool_slug}` | `version` or `toolkit_versions` (query) |
| `POST /tools/execute/{tool_slug}` | `version` (body) |
| `POST /tools/execute/{tool_slug}/input` | `version` (body) |
| `POST /tools/scopes/required` | `version` (body) |

A v3.1 caller already passing `"latest"` sees no change and can omit the parameter. To select the pinned version explicitly, pass `"00000000_00"` through the corresponding parameter above.

This version-default change is limited to the five endpoints above.


---

## Terminology Migration (old → current)

If you encounter these terms in error messages, old documentation, or user prompts, translate them to the current equivalents. **Do not use the old terms in generated code or explanations.**

| Old term (v1/v2) | Current term (v3) | In code |
|---|---|---|
| entity ID | user ID | `user_id` parameter |
| actions | tools | e.g., `GITHUB_CREATE_ISSUE` is a *tool* |
| apps / appType | toolkits | e.g., `github` is a *toolkit* |
| integration / integration ID | auth config / auth config ID | `auth_config_id` parameter |
| connection | connected account | `connected_accounts` namespace |
| ComposioToolSet / OpenAIToolSet | `Composio` class with a provider | `Composio(provider=...)` |
| toolset | provider | e.g., `OpenAIProvider` |

If a user says "entity ID", they mean `user_id`. If they say "integration", they mean "auth config". Always respond using the current terminology.

