Beta to Stable Migration

View as markdown

The stable version includes improved session management, multiple configuring options, and enhanced authentication capabilities.

The basics

Upgrade composio package

Upgrade to the latest stable version:

pip install --upgrade composio
npm install @composio/core@latest

Update session creation

# Beta (before)
session = composio.experimental.tool_router.create_session(
    user_id="user@example.com"
)

# Stable (after)
session = composio.create(
    user_id="user@example.com"
)
// Beta (before)
const const session: anysession = await composio.experimental.toolRouter.createSession('user_123');

// Stable (after)
const const session: anysession = await composio.create('user_123');

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 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.
session = composio.create(
    user_id="user_123",
    auth_configs={
        "github": "ac_your_github_config",
        "slack": "ac_your_slack_config"
    }
)
const const session: ToolRouterSession<unknown, unknown, OpenAIProvider>session = await const composio: Composio<OpenAIProvider>composio.Composio<OpenAIProvider>.create: (userId: string, routerConfig?: ToolRouterCreateSessionConfig) => Promise<ToolRouterSession<unknown, unknown, OpenAIProvider>>
Creates a new tool router session for a user.
@paramuserId The user id to create the session for@paramconfig The config for the tool router session@returnsThe tool router session@example```typescript import { Composio } from '@composio/core'; const composio = new Composio(); const userId = 'user_123'; const session = await composio.create(userId, { manageConnections: true, }); console.log(session.sessionId); console.log(session.url); console.log(session.tools()); ```
create
('user_123',
{ authConfigs?: Record<string, string> | undefinedauthConfigs: { github: stringgithub: "ac_your_github_config", slack: stringslack: "ac_your_slack_config", }, } );

Explore new capabilities

Check out these new features available in the stable version: