TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/badlogic/pi-mono/llms.txt
Use this file to discover all available pages before exploring further.
@mariozechner/pi-agent-core package provides a stateful agent runtime built on top of the unified LLM API. It handles tool execution, message queuing, and streaming events for building interactive AI agents.
Key Features
Stateful Runtime
Manages conversation state, tools, and model configuration
Tool Execution
Automatic tool calling with validation and error handling
Event Streaming
Real-time events for UI updates during agent operations
Message Queuing
Steering and follow-up message queues for interruptions
Quick Start
Core Concepts
Agent State
The agent maintains state including:- System prompt - Instructions for the LLM
- Model - Active LLM model
- Thinking level - Reasoning depth
- Tools - Available functions
- Messages - Conversation history
- Stream status - Current streaming state
Message Types
The agent works withAgentMessage, which can include:
- Standard LLM messages (
user,assistant,toolResult) - Custom app-specific message types via declaration merging
convertToLlm function filters and transforms messages before LLM calls.
Event Flow
The agent emits granular events for UI updates:Installation
Next Steps
Transport
Custom backends and proxy usage
State Management
Managing agent state and message queues
API Reference
Complete Agent class API documentation