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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pi_py_agent_core-0.83.0.tar.gz
(31.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pi_py_agent_core-0.83.0.tar.gz.
File metadata
- Download URL: pi_py_agent_core-0.83.0.tar.gz
- Upload date:
- Size: 31.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a145494f47f0db5094edf7a0d6c0c5ca5db6af6267fcfd645ccf2b5e92d0757e
|
|
| MD5 |
60cb19de498615fe50656d594a640873
|
|
| BLAKE2b-256 |
f83292492f8ad388d16b75e243747cc5d27a0dc7104df1b8d4bf87b4ef091310
|
File details
Details for the file pi_py_agent_core-0.83.0-py3-none-any.whl.
File metadata
- Download URL: pi_py_agent_core-0.83.0-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88cecd46a722f232830c5991a076dd1b4545bb8aeaaa9aeb96ac838107a3d7e6
|
|
| MD5 |
1f0fa158d982acb38e7a49b31eee95f4
|
|
| BLAKE2b-256 |
a54892eb5f0a0f369f8ccb1732f23e53769829f9b837ff7aff97b929ee2d412f
|