pi-agent-harness-lc (pi_agent_harness)
pi-agent-harness-lc (pi_agent_harness) is the higher-level harness runtime package for pi-agent-core-lc, corresponding to packages/agent/src/harness in the pi project (unofficial Python port).
What it provides
It contains the Phase 3 runtime pieces that are intentionally kept outside the lightweight core loop:
AgentHarness— stateful session runtime coordinating hooks, steering/follow-up queues, tool execution gating, model/thinking changes, and persistence- Session tree storage & repositories — append-only JSONL and in-memory session stores (
Session,JsonlSessionStorage,DeferredJsonlSessionStorage,MemorySessionStorage,JsonlSessionRepo,MemorySessionRepo,build_session_context) - Compaction & tree navigation — context compaction (
CompactionSettings,CompactionPreparation,CompactionResult), branch summaries, leaf/tree switching, and optional auto-compaction - Harness-specific custom messages — extensible
AgentMessageProtocoland built-in custom message roles with LLM boundary conversion (harness_convert_to_llm) - Skills, prompt templates & system prompt assembly —
load_skills,format_skills_for_system_prompt,load_prompt_templates,build_harness_system_prompt - Execution environment —
ExecutionEnvprotocol andLocalExecutionEnv(filesystem + shell abstraction)
Install
Install alongside core:
pip install pi-agent-core-lc pi-agent-harness-lc
For local development from the monorepo:
pip install -e ".[dev]" -e "./packages/pi-agent-harness"
uv run --extra dev --extra harness python -m pytest
Custom messages
AgentMessage is structurally open: anything with a string role flows through the loop and persists to the session (AgentMessageProtocol, a runtime-checkable Protocol in pi_agent_harness). The harness ships four custom roles — bashExecution, custom, branchSummary, compactionSummary — and harness_convert_to_llm decides how each role reaches the LLM; unknown roles are dropped at that boundary:
from pydantic import BaseModel
from pi_agent_harness import AgentMessageProtocol
from pi_agent_harness.messages import BashExecutionMessage, harness_convert_to_llm
# Built-in custom role: record a shell run in the session/context
bash = BashExecutionMessage(command="pytest -q", output="97 passed", exitCode=0, timestamp=0)
await harness.append_message(bash) # persisted; replayed to the LLM as a user message
# Your own role: any object with `role: str` satisfies the protocol
class DeployNote(BaseModel):
role: str = "deployNote"
environment: str
timestamp: int
assert isinstance(DeployNote(environment="staging", timestamp=0), AgentMessageProtocol)
To make a custom role visible to the LLM, wrap harness_convert_to_llm (or pass your own convert_to_llm to the core loop) and map it to a UserMessage — the same pattern the harness uses for its own roles.
Related documentation
- Phase 3 spec — AgentHarness design
- Harness batch audits: H1 session, H2 runtime, H3 compaction, H4 skills/env
- Architecture & module design
- Core runtime:
pi-agent-core-lc - Coding agent (zycode): repository README
Metadata
Release files for pi-agent-harness-lc 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pi_agent_harness_lc-1.2.0.tar.gz | 100.4 kB | Without provenance | Details for pi_agent_harness_lc-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pi_agent_harness_lc-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for pi_agent_harness_lc-1.2.0-py3-none-any.whl |
Total release size: 162.7 kB
Release files / pi_agent_harness_lc-1.2.0.tar.gz
| Download URL | pi_agent_harness_lc-1.2.0.tar.gz |
|---|---|
| Size | 100.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5357b884e6c4e012604473e3cfccbb5c26054fd1f2fdce612efcbd74bbb9e82f
|
|
BLAKE2b-256 checksum How to use checksums |
fdac4ec214c4b0e9aed031e3fe67ca176ea4ab91a7d3f059a7d4737bc5d48215
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pi_agent_harness_lc-1.2.0-py3-none-any.whl
| Download URL | pi_agent_harness_lc-1.2.0-py3-none-any.whl |
|---|---|
| Size | 62.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b9d2e706638f431078e1c0af56dac0abc637d08cb4a8babebe8cc63dd5e4d8e
|
|
BLAKE2b-256 checksum How to use checksums |
bce3be1a962fdd484537131a61b84f17c9c1c0a621d6b84d8216242f1e46b924
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for pi-agent-harness-lc 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.