Skip to main content

Programmatic Usage

Pi can be embedded in your own applications using the SDK. This enables building custom workflows, IDE integrations, chatbots, and automated agents.

Installation

The SDK includes all necessary dependencies for agent functionality.

Quick Start

Core API

createAgentSession

Creates a new agent session with optional configuration.

AgentSession

The main interface for interacting with the agent.

Built-in Tools

Pi provides pre-built tools for common operations.

Custom Tools

Define custom tools with TypeBox schemas for type safety.

Session Management

Resource Loading

Load skills, prompt templates, and other resources.

Real-World Examples

API Reference

For complete API documentation, see:

TypeScript Types

All APIs are fully typed. Import types from the SDK: