pi-agent-core
Python port of @earendil-works/pi-agent-core — General-purpose agent runtime.
Install
pip install pi-agent-core
Quick Start
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 | Issues
- PORTING.md — deviations from upstream
Metadata
Release files for pi-py-agent-core 0.84.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pi_py_agent_core-0.84.1.tar.gz | 33.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pi_py_agent_core-0.84.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.3 kB
Release files / pi_py_agent_core-0.84.1.tar.gz
| Download URL | pi_py_agent_core-0.84.1.tar.gz |
|---|---|
| Size | 33.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6efda6fcaf1ab5226936dde71427dffa4f978af49d155f2fbd0043d4696d427
|
|
BLAKE2b-256 checksum How to use checksums |
72e4da77364a21ca0ad7528825899610792cfefad879e80a3017db095a98ede2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / pi_py_agent_core-0.84.1-py3-none-any.whl
| Download URL | pi_py_agent_core-0.84.1-py3-none-any.whl |
|---|---|
| Size | 27.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f210f879b69b2e21f47ecfca7e02ceec07bc6ab8a7555cc46babf7ffb7aea51
|
|
BLAKE2b-256 checksum How to use checksums |
cdd739defc2304cf2ed6f56b6ec2d3328749c4f8381bbb30b4862713048906dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|