Skip to main content

Reusable Harbor custom agent that runs Pi SDK sessions and writes trajectory artifacts.

Project description

harbor-pi-sdk-agent

Run the Pi coding agent from Harbor.

Use this package when you want Harbor to launch a Pi SDK agent and collect Harbor-compatible trajectory artifacts.

Install

Install this package into the same Python environment or image that runs Harbor.

From a private package index:

pip install harbor-pi-sdk-agent

From this private GitHub repo:

pip install git+ssh://git@github.com/Kingwl/harbor-pi-sdk-agent.git

With uv:

uv pip install git+ssh://git@github.com/Kingwl/harbor-pi-sdk-agent.git

Harbor should already be available in that environment. This package is loaded by import path.

Run

Set the API key for the provider you want to use:

export OPENAI_API_KEY=...

Then pass the agent import path to Harbor:

harbor run \
  --agent-import-path harbor_pi_sdk_agent.agent:PiSdkAgent \
  --agent-kwarg 'model_name=openai/gpt-4.1' \
  --agent-kwarg 'api_key_env=OPENAI_API_KEY'

For an OpenAI-compatible endpoint:

export DEEPSEEK_API_KEY=...

harbor run \
  --agent-import-path harbor_pi_sdk_agent.agent:PiSdkAgent \
  --agent-kwarg 'model_name=deepseek/deepseek-v4-pro' \
  --agent-kwarg 'api_key_env=DEEPSEEK_API_KEY' \
  --agent-kwarg 'base_url=https://api.deepseek.com'

For an Anthropic-compatible Messages endpoint:

export ANTHROPIC_API_KEY=...

harbor run \
  --agent-import-path harbor_pi_sdk_agent.agent:PiSdkAgent \
  --agent-kwarg 'model_name=anthropic/model-id' \
  --agent-kwarg 'api_key_env=ANTHROPIC_API_KEY' \
  --agent-kwarg 'base_url=https://your-anthropic-compatible-endpoint' \
  --agent-kwarg 'model_api=anthropic-messages'

Launcher Setup

In your Harbor launcher or task wrapper, use:

harbor_pi_sdk_agent.agent:PiSdkAgent

Recommended kwargs:

model_name=provider/model-id
api_key_env=PROVIDER_API_KEY
agent_label=pi-sdk
base_url=https://...
thinking=xhigh

Optional kwargs:

model_api=anthropic-messages
provider_headers_json={"User-Agent":"..."}
compaction_enabled=0
filtered_events=1
raw_events=0
max_field_chars=200000

Recommended artifacts:

/logs/agent/trajectory.json
/logs/agent/trajectory.steps.jsonl
/logs/agent/pi-filtered.jsonl
/logs/agent/pi-sdk-runner.txt

Add this only when you explicitly want raw SDK events:

/logs/agent/pi-raw.jsonl

Outputs

  • trajectory.json: the main Harbor trajectory.
  • trajectory.steps.jsonl: step-by-step trajectory stream for long or interrupted runs.
  • pi-filtered.jsonl: compact Pi SDK event log.
  • pi-raw.jsonl: raw Pi SDK event log when raw_events=1.
  • pi-sdk-runner.txt: concise agent stdout.

Python Usage

Harbor usually creates the agent from the import path. If you need to construct it in Python:

from harbor_pi_sdk_agent import PiSdkAgent

agent = PiSdkAgent(
    logs_dir=logs_dir,
    model_name="openai/gpt-4.1",
    api_key_env="OPENAI_API_KEY",
)

Use this package as a Harbor agent plugin, not as a standalone command-line tool.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harbor_pi_sdk_agent-0.1.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

harbor_pi_sdk_agent-0.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file harbor_pi_sdk_agent-0.1.0.tar.gz.

File metadata

  • Download URL: harbor_pi_sdk_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for harbor_pi_sdk_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 291689b893cc6d6f429e028eb114a59d149e9487c1c20648c4c0e60578c1cef5
MD5 5043bdfca194192209624ac36ead9626
BLAKE2b-256 5805b9d3894208c82f49a9c3896214247828c99e8e60700936cec90e1aec035e

See more details on using hashes here.

Provenance

The following attestation bundles were made for harbor_pi_sdk_agent-0.1.0.tar.gz:

Publisher: publish.yml on Kingwl/harbor-pi-sdk-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file harbor_pi_sdk_agent-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for harbor_pi_sdk_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0f468cd91c770c83a0fd02fe414fd0931126a1b9d621c82983ca0a74ecf86d1
MD5 67003e21da2df1a09785fa86cc0a6eaf
BLAKE2b-256 2180c69dea2f1e574d5492baedf937c63cfd5944d2ab9b9c866afb10562609b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for harbor_pi_sdk_agent-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Kingwl/harbor-pi-sdk-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page