mirror of
https://github.com/ComposioHQ/composio.git
synced 2026-09-22 11:46:35 +08:00
8086ef02cb
## Summary - Repairs runnable TypeScript and Python examples for current backend requirements, including authenticated MCP endpoints, current transports, valid tool identifiers, provider limits, and resource uniqueness. - Replaces placeholder resource IDs with explicit `COMPOSIO_EXAMPLES_*` configuration and makes failed examples exit loudly. - Adds `scripts/examples-provision.mjs` as an idempotent provisioning check for a disposable examples project. ## Scope - This PR no longer changes the Python SDK runtime or generated-client dependency. - Python remains pinned to the published `composio-client==1.43.0` in `pyproject.toml`, `setup.py`, and `uv.lock`. - The owned 2.x client integration is deferred until that client completes its release guarantees and is explicitly published. - The scheduled live workflow and manifest remain deferred until their runner is tracked. ## Verification - `make chk` - `make tst` (`927 passed, 33 skipped`) - Hosted checks rerun against commit `12691aca7`.
49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
"""
|
|
Tool Router - Session Update Example
|
|
|
|
Demonstrates using session.update() to modify a session's configuration
|
|
after creation — e.g. adding toolkits, changing workbench settings, or
|
|
updating preload config without creating a new session.
|
|
"""
|
|
|
|
import os
|
|
|
|
from composio import Composio
|
|
|
|
composio = Composio()
|
|
|
|
# Create a session with gmail only
|
|
session = composio.create(
|
|
# The provisioned examples user (raises KeyError when unset)
|
|
user_id=os.environ["COMPOSIO_EXAMPLES_USER_ID"],
|
|
toolkits=["gmail"],
|
|
manage_connections=False,
|
|
)
|
|
|
|
print(f"Session created: {session.session_id}")
|
|
print(f"Preload: {session.preload}")
|
|
|
|
# Update: add github toolkit, enable workbench, and preload a tool
|
|
session.update(
|
|
toolkits={"enable": ["gmail", "github"]},
|
|
workbench={"enable": True, "sandbox_size": "medium"},
|
|
preload={"tools": ["GITHUB_CREATE_AN_ISSUE"]},
|
|
)
|
|
|
|
print("\nAfter update:")
|
|
print(f"Preload: {session.preload}")
|
|
|
|
# Update: disable workbench entirely
|
|
session.update(
|
|
workbench={"enable": False},
|
|
)
|
|
|
|
print("\nAfter disabling workbench: done")
|
|
|
|
# Update: clear manage_connections by passing None
|
|
session.update(
|
|
manage_connections=None,
|
|
)
|
|
|
|
print("\nAfter clearing manage_connections: done")
|