Metadata-Version: 2.4
Name: pi-py-agent-core
Version: 0.83.0
Summary: Python port of @earendil-works/pi-agent-core — General-purpose agent runtime
Project-URL: Homepage, https://github.com/encyc/pi-py
Project-URL: Repository, https://github.com/encyc/pi-py
Project-URL: Issues, https://github.com/encyc/pi-py/issues
Author: Justin Gao
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: pi-py-ai<0.84,>=0.83.0
Requires-Dist: pydantic>=2.7
Requires-Dist: pyyaml>=6
Description-Content-Type: text/markdown

# pi-agent-core

Python port of [@earendil-works/pi-agent-core](https://github.com/earendil-works/pi) — General-purpose agent runtime.

## Install

```bash
pip install pi-agent-core
```

## Quick Start

```python
from pi_agent_core import Agent, AgentOptions, AgentToolResult
from pi_ai import TextContent

class WeatherTool:
    name = "get_weather"
    description = "Query weather"
    label = "Weather"
    parameters = {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}
    async def execute(self, tool_call_id, params, cancel_event=None, on_update=None):
        return AgentToolResult(content=[TextContent(text=f"{params['city']} sunny 25°C")])

agent = Agent(AgentOptions(
    initial_state={"system_prompt": "You are helpful", "model": model, "tools": [WeatherTool()]},
    get_api_key=lambda p: "sk-...",
))
await agent.prompt("What's the weather in Beijing?")
```

## Features

- Double-loop engine (follow-up + tool calls + steering)
- Stateful Agent class (prompt/continue_/steer/follow_up/abort)
- Harness: skills loading, session persistence, context compaction

## Links

- [GitHub](https://github.com/encyc/pi-py) | [Issues](https://github.com/encyc/pi-py/issues)
- [PORTING.md](./PORTING.md) — deviations from upstream
