Skip to main content
The Pi provider adapts Composio tools for @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
The provider creates these Pi tools:
  • composio_search_tools searches Composio for exact tool slugs and schemas.
  • composio_manage_connections checks connection state and initiates auth for missing toolkits.
  • composio_execute_tool executes an exact Composio tool slug.
  • composio_remote_workbench runs Python in the Composio sandbox, and requires includeWorkbenchTools: true.
  • composio_remote_bash runs short bash commands in the sandbox filesystem, and requires includeWorkbenchTools: true.
You can rename any of these helpers through the 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 a hooks 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.
Available hooks, each keyed on PiSessionHooks: Every ctx.request is fully typed, so your editor surfaces the exact fields. ctx.deny is also exported as denyPiToolCall(reason).

Next

What is a session?