@earendil-works/pi-coding-agent — the library form of pi, where you run an AgentSession from your own Node process instead of the interactive CLI.
Running the interactive
pi CLI instead? Use the
TraceRoot pi extension.Setup
TraceRoot.initialize() before creating any session:
@earendil-works/pi-coding-agent is ESM-only and requires Node >=22.19.
Usage
Create and run sessions as usual — every session created after initialization is traced automatically:session.prompt() becomes a nested trace, with tool spans under the LLM span that requested them:
What Gets Captured
captureContent and captureToolIo (both default true) control whether prompt/response text and tool arguments/results are attached to spans. Pass them through the { module, config } form:
Run the example
TypeScript
Run a complete session end-to-end.