You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
- add Python tabs to the main custom tools and toolkits docs page
- update the changelog entry to include Python support and versions
- keep inline references limited to docs/reference pages that already
exist today
## Notes
- the Python docs intentionally describe the decorator + Pydantic
annotation DX rather than mirroring the TypeScript builder API
- I did not add Python ToolRouterSession / SessionContext reference
links because those generated reference pages are not currently surfaced
in the Python SDK reference
## Validation
- content reviewed locally in a clean worktree
- docs build/link validation could not be run in this environment
because the docs workspace dependencies were not installed (`next` /
`fumadocs-mdx` resolution failed)
Copy file name to clipboardExpand all lines: docs/content/changelog/03-23-26-custom-tools-and-toolkits.mdx
+93-6Lines changed: 93 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,16 @@ You can now create custom tools and toolkits that run locally alongside remote C
11
11
| Package | Version |
12
12
|---------|---------|
13
13
|@composio/core| v0.6.6 |
14
+
| composio | v0.11.4 |
14
15
15
16
---
16
17
17
18
## What's New
18
19
19
-
Custom tools support three patterns — standalone tools for internal logic, extension tools that wrap Composio toolkit APIs with business logic, and custom toolkits that group related tools.
20
+
Custom tools support three patterns — standalone tools for internal logic, extension tools that wrap Composio toolkit APIs with business logic, and custom toolkits that group related tools. TypeScript uses builder functions with Zod schemas; Python uses decorators with Pydantic annotations.
Custom tools are experimental. The `experimental_` prefix and `experimental`session option may change in future releases. TypeScript only.
8
+
Custom tool APIs are experimental. TypeScript uses `experimental_createTool()` / `experimental_createToolkit()`. Python uses `@composio.experimental.tool()` / `composio.experimental.Toolkit(...)`. The session `experimental`option may change in future releases.
9
9
</Callout>
10
10
11
11
<Callouttype="info">
@@ -15,11 +15,14 @@ Custom tools work with **native tools** (`session.tools()`). MCP support is comi
15
15
Custom tools let you define tools that run in-process alongside remote Composio tools within a session. There are three patterns:
16
16
17
17
-**Standalone tools** — for internal app logic that doesn't need Composio auth (DB lookups, in-memory data, business rules)
18
-
-**Extension tools** — wrap a Composio toolkit's API with custom business logic via `extendsToolkit`, using `ctx.proxyExecute()` for authenticated requests
18
+
-**Extension tools** — wrap a Composio toolkit's API with custom business logic via `extendsToolkit` / `extends_toolkit`, using `ctx.proxyExecute()` / `ctx.proxy_execute()` for authenticated requests
19
19
-**Custom toolkits** — group related standalone tools under a namespace
20
20
21
21
The example below defines one of each and binds them to a session:
Custom tools integrate seamlessly with Composio's meta tools:
@@ -116,27 +215,51 @@ Custom tools integrate seamlessly with Composio's meta tools:
116
215
117
216
## Best practices
118
217
119
-
-**Descriptive names and slugs** — The agent sees your tool's name and description to decide when to use it. Be specific: "Send weekly promo email" is better than "Send email". Slugs should be uppercase with underscores:`SEND_PROMO_EMAIL`.
218
+
-**Descriptive names and slugs** — The agent sees your tool's name and description to decide when to use it. Be specific: "Send weekly promo email" is better than "Send email". In TypeScript, define uppercase slugs like`SEND_PROMO_EMAIL`. In Python, inferred slugs come from the function name, so `snake_case` function names produce the cleanest defaults; or pass `slug=` / `name=` explicitly.
120
219
-**Detailed descriptions** — Include what the tool does, when to use it, and what it returns. The agent relies on this to pick the right tool.
121
-
-**Use `extendsToolkit` for auth** — If your tool needs Gmail/GitHub/etc. auth for `ctx.proxyExecute()` or `ctx.execute()`, set `extendsToolkit` so connection management is handled seamlessly via `COMPOSIO_MANAGE_CONNECTIONS`.
220
+
-**Use `extendsToolkit` / `extends_toolkit` for auth** — If your tool needs Gmail/GitHub/etc. auth for `ctx.proxyExecute()` / `ctx.proxy_execute()` or `ctx.execute()`, set the toolkit extension so connection management is handled seamlessly via `COMPOSIO_MANAGE_CONNECTIONS`.
221
+
-**In Python, annotations are the schema** — The first parameter must be a Pydantic `BaseModel`, and its field descriptions become the input schema. Docstrings are used as the default tool description unless you pass `description=`.
122
222
-**Tool names get prefixed** — Slugs exposed to the agent are automatically prefixed with `LOCAL_` and the toolkit name (if any). `GET_USER_PROFILE` becomes `LOCAL_GET_USER_PROFILE`, `ASSIGN_ROLE` in `USER_MANAGEMENT` becomes `LOCAL_USER_MANAGEMENT_ASSIGN_ROLE`. Your slugs cannot start with `LOCAL_` — this prefix is reserved.
123
223
124
224
For more best practices, see [How to Build Tools for AI Agents: A Field Guide](https://composio.dev/blog/how-to-build-tools-for-ai-agents-a-field-guide).
125
225
126
226
## Verifying registration
127
227
128
-
Use `session.customTools()` to list registered tools (with their final `LOCAL_` prefixed slugs), or filter by toolkit with `session.customTools({ toolkit: "USER_MANAGEMENT" })`. Use `session.customToolkits()` to list registered toolkits.
228
+
Use `session.customTools()` / `session.customToolkits()` in TypeScript or `session.custom_tools()` / `session.custom_toolkits()` in Python to list registered tools and toolkits. Registered tool slugs include their final `LOCAL_` prefix, and toolkit-scoped tools also include the toolkit slug.
Use `session.execute()` to run custom tools directly, outside of an agent loop (e.g. `session.execute("GET_USER_PROFILE")`). Custom tools execute in-process; remote tools are sent to the backend automatically.
0 commit comments