Skip to content

Pi Agent Framework: SDK, Tools & OpenClaw

Content updated How we compare Sources linked below
Company

Pi maintainers (created by Mario Zechner)

Languages

TypeScript

License

MIT

Focus

Coding Agent Harness

Pricing

Open-source toolkit; model usage and hosting are separate

Links

GitHub · Website

Key Features

What is the Pi agent framework?

Pi is an extensible agent harness for coding workflows. It provides a command-line agent and TypeScript libraries for applications that need to run their own agent sessions. The repository separates model access, the agent runtime, session behavior, and terminal UI into packages.

Choose Pi when the product you want to build revolves around an agent reading files, editing a project, and using tools in a session. For a process with explicit business steps, checkpoints, and approvals, compare the workflow runtime as well: LangChain and LangGraph vs Pi.

Repository, package names, and setup

Pi was created by Mario Zechner. Its former badlogic/pi-mono repository now redirects to earendil-works/pi. The current CLI documentation uses @earendil-works/pi-coding-agent; older examples may use a previous package namespace. Match a tutorial to the release you install.

The current README documents Node.js 22.19 or newer and this npm installation option:

npm install -g --ignore-scripts @earendil-works/pi-coding-agent

Run pi in the project directory and configure a supported provider. See the upstream installation instructions for pinned releases and other installation methods. This is a documentation-based setup example, not a report of a tested model run.

How the TypeScript SDK fits together

The SDK’s createAgentSession() factory creates an AgentSession. A session owns a conversation, selected model and tools, queued messages, context compaction, and extension runtime. SessionManager controls persisted history and the active branch. Persistent sessions are the default; the SDK also supports an in-memory manager.

This distinction matters when embedding Pi: restoring a user interface’s message list is not the same operation as restoring an agent session. Keep the session manager authoritative for history and use the documented session APIs for continuation and branching.

For model access without the full coding harness, inspect the pi-ai package. For a custom agent loop, inspect pi-agent-core. Use the coding-agent SDK when its session and resource-management behavior fits the application.

Tools and extensions

Pi’s early design is often summarized by four coding tools: read, write, edit, and bash. That is useful historical context, but it is not a complete description of every current configuration. The active tool set depends on the release, settings, and extensions.

Extensions can register tools and commands and respond to lifecycle events. Skills and prompt templates supply reusable instructions. The CLI and SDK do not automatically load every capability in the same way; the SDK documentation explains how to configure the resource loader and additional extensions. Check that distinction before copying a CLI configuration into an embedded app.

Pi and OpenClaw

Pi’s official documentation points to OpenClaw as an integration example. They are separate projects with different product responsibilities. Use the integration to understand an embedding pattern, rather than treating another project’s star count as evidence of Pi’s throughput or reliability.

For a Claude-focused alternative, read Pi vs Claude Agent SDK. For application workflows beyond a coding session, read LangChain vs Pi.

What your application still needs to own

Pi runs with the permissions of its host process. The upstream repository explicitly distinguishes the harness from an operating-system security boundary. A hosted application still needs to choose its execution environment, credential handling, file access, and isolation.

Session persistence also does not automatically provide a business workflow’s retry policy, task queue, or approval process. Identify those requirements before choosing a runtime. Pi’s extension model is useful when you want to implement the behavior yourself; it does not remove that engineering work.

Pros

  • + Useful starting point for an embedded TypeScript coding agent
  • + CLI and SDK provide different ways to use the same session model
  • + Extension API supports application-specific behavior
  • + Provider abstraction reduces the work of integrating several model APIs

Cons

  • - No built-in operating-system sandbox or comprehensive permission boundary
  • - Subagent orchestration is not a built-in default
  • - A session is not a substitute for a durable business workflow runtime
  • - Package names and APIs have changed; check the version you install

Compare Pi

Frequently Asked Questions

What is the Pi agent framework?

Pi is an open-source toolkit for coding agents. It includes a CLI, a TypeScript SDK, session management, model-provider integration, and an extension system. It is also described as an agent harness because it supplies the machinery around the model's tool-use loop.

Is Pi the same project as OpenClaw?

No. Pi's documentation links to OpenClaw as a real-world integration. Pi provides agent building blocks; OpenClaw is a separate application. Adoption of one project is not a performance benchmark for the other.

Where is the Pi GitHub repository?

The current repository is github.com/earendil-works/pi. The former badlogic/pi-mono address redirects there. Current documentation uses the @earendil-works npm namespace; older tutorials may use a different namespace.

Should I use Pi or LangGraph?

Start with Pi when you want an extensible coding-agent session. Consider LangGraph when you need explicit workflow state, durable execution, and human-in-the-loop orchestration. Compare their runtime responsibilities before choosing.

Sources & further reading

This article is based on documentation and source code. It is not a performance benchmark.