> ## 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.

# Migrating from Experimental Tool Router

> Migrate from the experimental tool router to Composio sessions

This guide is for users who adopted the **experimental tool router** (`composio.experimental.tool_router`) during its beta period. The tool router has now graduated to a stable, first-class feature called **sessions** — with a simpler API, better auth handling, and full framework support.

If you never used `composio.experimental.tool_router`, you can skip this guide and start with [Configuring Sessions](https://composio-preview.mintlify.site/docs/configuring-sessions.md).

## The basics

**1. Upgrade composio package**

Upgrade to the latest stable version:

> [tab] Python
>
> ```bash theme={null}
> pip install --upgrade composio
> ```

> [tab] TypeScript
>
> ```bash npm theme={null}
> npm install @composio/core@latest
> ```
>
> ```bash pnpm theme={null}
> pnpm add @composio/core@latest
> ```
>
> ```bash yarn theme={null}
> yarn add @composio/core@latest
> ```
>
> ```bash bun theme={null}
> bun add @composio/core@latest
> ```

**2. Update session creation**

Beta (before):

> [tab] Python (previous)
>
> ```python theme={null}
> session = composio.experimental.tool_router.create_session(
>     user_id="user_123"
> )
> ```

> [tab] TypeScript (previous)
>
> ```typescript theme={null}
> const session = await composio.experimental.toolRouter.createSession('user_123');
> ```

Stable (after):

> [tab] Python
>
> ```python theme={null}
> from composio import Composio
>
> composio = Composio()
> session = composio.create(user_id="user_123")
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> import { Composio } from '@composio/core';
>
> const composio = new Composio();
> const session = await composio.create('user_123');
> ```

> [tab] API
>
> ```bash theme={null}
> # Stable (after)
> curl -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"}'
> ```

**3. Moving users (optional)**

If you have existing users on tool router and you don't want them to authenticate again:

* Tool Router will auto-detect auth configs and connected accounts it created (from the beta version).
* If you have custom auth configs (not created by Tool Router):
  * Search for the Auth config for that connected account. See [Connected Accounts](https://composio-preview.mintlify.site/docs/auth-configuration/connected-accounts.md) to fetch existing accounts programmatically.
  * While creating a session configure to use this Auth config.
  * You need to repeat this for each toolkit you want to enable for that session.

> [tab] Python
>
> ```python theme={null}
> session = composio.create(
>     user_id="user_123",
>     auth_configs={
>         "github": "ac_your_github_config",
>         "slack": "ac_your_slack_config"
>     }
> )
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> import { Composio } from '@composio/core';
> const composio = new Composio({ apiKey: 'your_api_key' });
> const session = await composio.create('user_123',
>     {
>         authConfigs: {
>             github: "ac_your_github_config",
>             slack: "ac_your_slack_config",
>         },
>     }
> );
> ```

> [tab] API
>
> ```bash theme={null}
> curl -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",
>     "auth_configs": {"github": "ac_your_github_config", "slack": "ac_your_slack_config"}
>   }'
> ```

## Next

> [card] [Configuring Sessions](https://composio-preview.mintlify.site/docs/configuring-sessions.md)
>
> Restrict toolkits, set auth configs, and select connected accounts
