Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
mdx 49 lines 2.69 KB
Raw
1 ---
2 title: 'SDK releases: session hooks in Python 0.30.0 and TypeScript 0.27.0'
3 description: 'Block tool calls or results with session hooks, inspect hook outcomes, and handle blocked proxy requests.'
4 date: '2026-10-22'
5 ---
6
7 You can now attach hooks to a session to block a tool call before it runs or block its result before your agent sees it.
8
9 ### Release versions
10
11 | SDK | Version |
12 | -------------------------------- | -------- |
13 | Python `composio` | `0.30.0` |
14 | TypeScript `@composio/core` | `0.27.0` |
15 | TypeScript `@composio/slim` | `0.27.0` |
16 | TypeScript `@composio/anthropic` | `0.11.6` |
17
18 All 13 Python provider packages are released at `0.30.0`.
19
20 ### What's new
21
22 - **Session hooks.** Pass `hooks` when you create or update a session. Hooks can run before execution or after execution, and can apply to selected toolkits. Updating `hooks` replaces the whole list; `None` in Python or `null` in TypeScript removes every hook. You cannot combine `hooks` with `experimental.session_config_id` in Python or `experimental.sessionConfigId` in TypeScript in the same call.
23 - **Hook outcomes.** Session execution returns `result_type="blocked"` in Python or `resultType: 'blocked'` in TypeScript when a hook blocks a call or result. The response contains empty `data`, the hook's message in `error`, and `block_reason` or `blockReason`. When hooks apply, inspect `hook_results` or `hookResults` for their outcomes. Provider integrations return blocked execution as a failed tool call with the hook's message.
24
25 ### Migration notes
26
27 <Callout type="warn">
28 Session proxy execution now distinguishes completed requests from blocked requests. A blocked
29 request has no HTTP response. Check the result type before reading HTTP response fields.
30 </Callout>
31
32 In Python, replace direct access to a proxy response's `status` with a result-type check:
33
34 Before: `print(response.status)`.
35
36 After: `print(response["status"] if response["result_type"] == "completed" else response["message"])`.
37
38 In TypeScript, make the equivalent check:
39
40 Before: `console.log(response.status)`.
41
42 After: `console.log(response.resultType === 'completed' ? response.status : response.message)`.
43
44 This applies to `session.proxy_execute()` and `ctx.proxy_execute()` in Python, and `session.proxyExecute()` and `ctx.proxyExecute()` in TypeScript.
45
46 ### Bug fixes
47
48 - **Python custom-tool annotations.** `@composio.experimental.tool` reports unresolved input annotations when you register the tool, with the affected parameter and the original resolution error.
49 - **Anthropic provider dependencies.** The TypeScript Anthropic provider removes its unused `@mastra/mcp` peer dependency, avoiding unrelated packages during installation.