@earendil-works/pi-coding-agent. A Pi session can search tools, manage connections, execute tools, and run the remote sandbox. Unlike the other providers, PiProvider ships its own hook interface to intercept, allow, deny, or rewrite every helper call before the model sees the result.
The Pi provider ships from
@composio/experimental for TypeScript projects.Dynamic session helpers
For most Pi apps, expose the dynamic helper tools. They let the model discover exact Composio tool slugs before it executes, request missing connections, and run sandbox commands when you enable them.1
Install
Install
2
Configure API keys
Configure API keys
.env
3
Create a Composio session and Pi tools
Create a Composio session and Pi tools
composio_search_toolssearches Composio for exact tool slugs and schemas.composio_manage_connectionschecks connection state and initiates auth for missing toolkits.composio_execute_toolexecutes an exact Composio tool slug.composio_remote_workbenchruns Python in the Composio sandbox, and requiresincludeWorkbenchTools: true.composio_remote_bashruns short bash commands in the sandbox filesystem, and requiresincludeWorkbenchTools: true.
names option on createSessionTools, and the constants live on PI_COMPOSIO_SESSION_TOOL_NAMES.
Hooks
Hooks are the Pi provider’s distinctive feature: middleware that wraps each helper so you control what runs and what the model sees. Pass ahooks object to createSessionTools. Each hook is (ctx, next): await next() runs the default behavior, returning a value replaces what the model sees, and ctx.deny(reason) blocks the call. ctx.request is mutable; ctx.context is read-only.
PiSessionHooks:
Every
ctx.request is fully typed, so your editor surfaces the exact fields. ctx.deny is also exported as denyPiToolCall(reason).