Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
docs: Update Python SDK reference (#2366)
github-actions[bot]67329eb6b9e6
diff --git a/docs/content/reference/sdk-reference/python/composio.mdx b/docs/content/reference/sdk-reference/python/composio.mdxindex b0e6df06e..4b40faba3 100644--- a/docs/content/reference/sdk-reference/python/composio.mdx+++ b/docs/content/reference/sdk-reference/python/composio.mdx@@ -13,4 +13,4 @@ description: Composio SDK for Python.| [`auth_configs`](/reference/sdk-reference/python/auth-configs) | `AuthConfigs` || [`connected_accounts`](/reference/sdk-reference/python/connected-accounts) | `ConnectedAccounts` |-[View source](https://github.com/composiohq/composio/blob/next/python/composio/sdk.py#L52)+[View source](https://github.com/composiohq/composio/blob/next/python/composio/sdk.py#L53)diff --git a/docs/content/reference/sdk-reference/python/index.mdx b/docs/content/reference/sdk-reference/python/index.mdxindex 3c19bceaf..ac1a95500 100644--- a/docs/content/reference/sdk-reference/python/index.mdx+++ b/docs/content/reference/sdk-reference/python/index.mdx@@ -52,7 +52,7 @@ result = composio.tools.execute(### before_execute-[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/_modifiers.py#L171)+[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/_modifiers.py#L183)```python@before_execute(modifier: BeforeExecute | None = ..., tools: List[str | None] = ..., toolkits: List[str | None] = ...)@@ -62,7 +62,7 @@ def my_modifier(...):### after_execute-[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/_modifiers.py#L132)+[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/_modifiers.py#L144)```python@after_execute(modifier: AfterExecute | None = ..., tools: List[str | None] = ..., toolkits: List[str | None] = ...)@@ -72,7 +72,7 @@ def my_modifier(...):### schema_modifier-[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/_modifiers.py#L210)+[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/_modifiers.py#L222)```python@schema_modifier(modifier: SchemaModifier | None = ..., tools: List[str | None] = ..., toolkits: List[str | None] = ...)diff --git a/docs/content/reference/sdk-reference/python/tools.mdx b/docs/content/reference/sdk-reference/python/tools.mdxindex 581e268c8..cd25224a6 100644--- a/docs/content/reference/sdk-reference/python/tools.mdx+++ b/docs/content/reference/sdk-reference/python/tools.mdx@@ -49,6 +49,56 @@ def get_raw_composio_tools(tools: list[str | None] = ..., search: str | None = .---+### get_raw_tool_router_meta_tools()++Fetches the meta tools for a tool router session. This method fetches the meta tools from the Composio API and transforms them to the expected format. It provides access to the underlying meta tool data without provider-specific wrapping.++```python+def get_raw_tool_router_meta_tools(session_id: str, modifiers: 'Modifiers' | None = ...) -> list[Tool]+```++**Parameters**++| Name | Type |+|------|------|+| `session_id` | `str` |+| `modifiers?` | `'Modifiers' \| None` |++**Returns**++`list[Tool]` — The list of meta tools++**Example**++```python+```python+ from composio import Composio++ composio = Composio()+ tools_model = composio.tools++ # Get meta tools for a session+ meta_tools = tools_model.get_raw_tool_router_meta_tools("session_123")+ print(meta_tools)++ # Get meta tools with schema modifiers+ from composio.core.models import schema_modifier++ @schema_modifier+ def modify_schema(tool: str, toolkit: str, schema):+ # Customize the schema+ schema.description = f"Modified: {schema.description}"+ return schema++ meta_tools = tools_model.get_raw_tool_router_meta_tools(+ "session_123",+ modifiers=[modify_schema]+ )+ ```+```++---+### get()Get a tool or list of tools based on the provided arguments.diff --git a/docs/content/reference/sdk-reference/python/triggers.mdx b/docs/content/reference/sdk-reference/python/triggers.mdxindex dfbd9768a..3807d218e 100644--- a/docs/content/reference/sdk-reference/python/triggers.mdx+++ b/docs/content/reference/sdk-reference/python/triggers.mdx@@ -110,24 +110,26 @@ def subscribe(timeout: float = ...) -> TriggerSubscription### verify_webhook()-Verify an incoming webhook payload and signature. This method validates that the webhook request is authentic by: 1. Verifying the HMAC-SHA256 signature matches the payload 2. Optionally checking that the webhook timestamp is within the tolerance window+Verify an incoming webhook payload and signature. This method validates that the webhook request is authentic by: 1. Validating the webhook timestamp is within the tolerance window 2. Verifying the HMAC-SHA256 signature using the correct algorithm 3. Parsing the payload and detecting the webhook version (V1, V2, or V3)```python-def verify_webhook(payload: str, signature: str, secret: str, tolerance: int = ...) -> TriggerEvent+def verify_webhook(id: str, payload: str, secret: str, signature: str, timestamp: str, tolerance: int = ...) -> VerifyWebhookResult```**Parameters**| Name | Type ||------|------|+| `id` | `str` || `payload` | `str` |-| `signature` | `str` || `secret` | `str` |+| `signature` | `str` |+| `timestamp` | `str` || `tolerance?` | `int` |**Returns**-`TriggerEvent` — The verified and parsed webhook payload as a TriggerEvent :raises WebhookSignatureVerificationError: If the signature verification fails :raises WebhookPayloadError: If the payload cannot be parsed or is invalid+`VerifyWebhookResult` — VerifyWebhookResult containing version, normalized payload, and raw payload :raises WebhookSignatureVerificationError: If the signature verification fails :raises WebhookPayloadError: If the payload cannot be parsed or is invalid**Example**@@ -136,14 +138,17 @@ def verify_webhook(payload: str, signature: str, secret: str, tolerance: int = .@app.route('/webhook', methods=['POST'])def webhook():try:- event = composio.triggers.verify_webhook(+ result = composio.triggers.verify_webhook(+ id=request.headers.get('webhook-id', ''),payload=request.get_data(as_text=True),- signature=request.headers.get('x-composio-signature', ''),+ signature=request.headers.get('webhook-signature', ''),+ timestamp=request.headers.get('webhook-timestamp', ''),secret=os.environ['COMPOSIO_WEBHOOK_SECRET'],)# Process the verified payload- print(f"Received trigger: {event['trigger_slug']}")+ print(f"Version: {result['version']}")+ print(f"Received trigger: {result['payload']['trigger_slug']}")return 'OK', 200except WebhookSignatureVerificationError:return 'Unauthorized', 401@@ -151,4 +156,4 @@ def verify_webhook(payload: str, signature: str, secret: str, tolerance: int = .----[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/triggers.py#L629)+[View source](https://github.com/composiohq/composio/blob/next/python/composio/core/models/triggers.py#L689)