Weave for Agents is in public preview. Features, APIs, and the Agents view UI may change before general availability.
createOtelExtension integration, which conforms to the GenAI semantic conventions.
Pi is a TypeScript/Node.js framework with no Python equivalent. Pi requires the ESM module system — your project must use
"type": "module" in package.json, or compile TypeScript to ESM output. CommonJS projects will error. For more information on setting up an ESM project, see Typescript SDK integration.Prerequisites
Install packages
- Install Weave, Pi, and Node type definitions as local project dependencies:
Trace a Pi prompt and response
Callweave.init() before creating your agent session, then pass createOtelExtension() as an extension factory. Weave traces the full agent lifecycle: the session, each prompt/response cycle (invoke_agent), individual LLM calls (chat), and tool executions (execute_tool). The session ID is generated automatically by SessionManager.inMemory().
https://wandb.ai/[YOUR-TEAM]/[YOUR-PROJECT]/weave/agents.
Next steps
You can turn this example into a multi-turn session by adding additional prompts. Each call tosession.prompt() is traced as a separate invoke_agent span, all nested under a single root span. The agent retains context across prompts automatically.
After running the code, the Agents tab shows the full multi-turn timeline with nested LLM calls, tool executions, token usage, and cost.