harbor-pi-sdk-agent 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- harbor_pi_sdk_agent-0.1.0/PKG-INFO +163 -0
- harbor_pi_sdk_agent-0.1.0/README.md +139 -0
- harbor_pi_sdk_agent-0.1.0/pyproject.toml +46 -0
- harbor_pi_sdk_agent-0.1.0/setup.cfg +4 -0
- harbor_pi_sdk_agent-0.1.0/src/harbor_pi_sdk_agent/__init__.py +20 -0
- harbor_pi_sdk_agent-0.1.0/src/harbor_pi_sdk_agent/agent.py +364 -0
- harbor_pi_sdk_agent-0.1.0/src/harbor_pi_sdk_agent/harbor_pi_sdk_runner.mjs +710 -0
- harbor_pi_sdk_agent-0.1.0/src/harbor_pi_sdk_agent/py.typed +1 -0
- harbor_pi_sdk_agent-0.1.0/src/harbor_pi_sdk_agent.egg-info/PKG-INFO +163 -0
- harbor_pi_sdk_agent-0.1.0/src/harbor_pi_sdk_agent.egg-info/SOURCES.txt +12 -0
- harbor_pi_sdk_agent-0.1.0/src/harbor_pi_sdk_agent.egg-info/dependency_links.txt +1 -0
- harbor_pi_sdk_agent-0.1.0/src/harbor_pi_sdk_agent.egg-info/requires.txt +6 -0
- harbor_pi_sdk_agent-0.1.0/src/harbor_pi_sdk_agent.egg-info/top_level.txt +1 -0
- harbor_pi_sdk_agent-0.1.0/tests/test_package_metadata.py +103 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: harbor-pi-sdk-agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Reusable Harbor custom agent that runs Pi SDK sessions and writes trajectory artifacts.
|
|
5
|
+
Author: Kingwl
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Project-URL: Repository, https://github.com/Kingwl/harbor-pi-sdk-agent
|
|
8
|
+
Keywords: harbor,pi,agent,atif,trajectory
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: build; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest; extra == "dev"
|
|
22
|
+
Requires-Dist: ruff; extra == "dev"
|
|
23
|
+
Requires-Dist: twine; extra == "dev"
|
|
24
|
+
|
|
25
|
+
# harbor-pi-sdk-agent
|
|
26
|
+
|
|
27
|
+
Run the Pi coding agent from Harbor.
|
|
28
|
+
|
|
29
|
+
Use this package when you want Harbor to launch a Pi SDK agent and collect Harbor-compatible trajectory artifacts.
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
Install this package into the same Python environment or image that runs Harbor.
|
|
34
|
+
|
|
35
|
+
From a private package index:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install harbor-pi-sdk-agent
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
From this private GitHub repo:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install git+ssh://git@github.com/Kingwl/harbor-pi-sdk-agent.git
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
With `uv`:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
uv pip install git+ssh://git@github.com/Kingwl/harbor-pi-sdk-agent.git
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Harbor should already be available in that environment. This package is loaded by import path.
|
|
54
|
+
|
|
55
|
+
## Run
|
|
56
|
+
|
|
57
|
+
Set the API key for the provider you want to use:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
export OPENAI_API_KEY=...
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Then pass the agent import path to Harbor:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
harbor run \
|
|
67
|
+
--agent-import-path harbor_pi_sdk_agent.agent:PiSdkAgent \
|
|
68
|
+
--agent-kwarg 'model_name=openai/gpt-4.1' \
|
|
69
|
+
--agent-kwarg 'api_key_env=OPENAI_API_KEY'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For an OpenAI-compatible endpoint:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
export DEEPSEEK_API_KEY=...
|
|
76
|
+
|
|
77
|
+
harbor run \
|
|
78
|
+
--agent-import-path harbor_pi_sdk_agent.agent:PiSdkAgent \
|
|
79
|
+
--agent-kwarg 'model_name=deepseek/deepseek-v4-pro' \
|
|
80
|
+
--agent-kwarg 'api_key_env=DEEPSEEK_API_KEY' \
|
|
81
|
+
--agent-kwarg 'base_url=https://api.deepseek.com'
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For an Anthropic-compatible Messages endpoint:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
export ANTHROPIC_API_KEY=...
|
|
88
|
+
|
|
89
|
+
harbor run \
|
|
90
|
+
--agent-import-path harbor_pi_sdk_agent.agent:PiSdkAgent \
|
|
91
|
+
--agent-kwarg 'model_name=anthropic/model-id' \
|
|
92
|
+
--agent-kwarg 'api_key_env=ANTHROPIC_API_KEY' \
|
|
93
|
+
--agent-kwarg 'base_url=https://your-anthropic-compatible-endpoint' \
|
|
94
|
+
--agent-kwarg 'model_api=anthropic-messages'
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Launcher Setup
|
|
98
|
+
|
|
99
|
+
In your Harbor launcher or task wrapper, use:
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
harbor_pi_sdk_agent.agent:PiSdkAgent
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Recommended kwargs:
|
|
106
|
+
|
|
107
|
+
```text
|
|
108
|
+
model_name=provider/model-id
|
|
109
|
+
api_key_env=PROVIDER_API_KEY
|
|
110
|
+
agent_label=pi-sdk
|
|
111
|
+
base_url=https://...
|
|
112
|
+
thinking=xhigh
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Optional kwargs:
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
model_api=anthropic-messages
|
|
119
|
+
provider_headers_json={"User-Agent":"..."}
|
|
120
|
+
compaction_enabled=0
|
|
121
|
+
filtered_events=1
|
|
122
|
+
raw_events=0
|
|
123
|
+
max_field_chars=200000
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Recommended artifacts:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
/logs/agent/trajectory.json
|
|
130
|
+
/logs/agent/trajectory.steps.jsonl
|
|
131
|
+
/logs/agent/pi-filtered.jsonl
|
|
132
|
+
/logs/agent/pi-sdk-runner.txt
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Add this only when you explicitly want raw SDK events:
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
/logs/agent/pi-raw.jsonl
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Outputs
|
|
142
|
+
|
|
143
|
+
- `trajectory.json`: the main Harbor trajectory.
|
|
144
|
+
- `trajectory.steps.jsonl`: step-by-step trajectory stream for long or interrupted runs.
|
|
145
|
+
- `pi-filtered.jsonl`: compact Pi SDK event log.
|
|
146
|
+
- `pi-raw.jsonl`: raw Pi SDK event log when `raw_events=1`.
|
|
147
|
+
- `pi-sdk-runner.txt`: concise agent stdout.
|
|
148
|
+
|
|
149
|
+
## Python Usage
|
|
150
|
+
|
|
151
|
+
Harbor usually creates the agent from the import path. If you need to construct it in Python:
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
from harbor_pi_sdk_agent import PiSdkAgent
|
|
155
|
+
|
|
156
|
+
agent = PiSdkAgent(
|
|
157
|
+
logs_dir=logs_dir,
|
|
158
|
+
model_name="openai/gpt-4.1",
|
|
159
|
+
api_key_env="OPENAI_API_KEY",
|
|
160
|
+
)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Use this package as a Harbor agent plugin, not as a standalone command-line tool.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# harbor-pi-sdk-agent
|
|
2
|
+
|
|
3
|
+
Run the Pi coding agent from Harbor.
|
|
4
|
+
|
|
5
|
+
Use this package when you want Harbor to launch a Pi SDK agent and collect Harbor-compatible trajectory artifacts.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Install this package into the same Python environment or image that runs Harbor.
|
|
10
|
+
|
|
11
|
+
From a private package index:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install harbor-pi-sdk-agent
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
From this private GitHub repo:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install git+ssh://git@github.com/Kingwl/harbor-pi-sdk-agent.git
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
With `uv`:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
uv pip install git+ssh://git@github.com/Kingwl/harbor-pi-sdk-agent.git
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Harbor should already be available in that environment. This package is loaded by import path.
|
|
30
|
+
|
|
31
|
+
## Run
|
|
32
|
+
|
|
33
|
+
Set the API key for the provider you want to use:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
export OPENAI_API_KEY=...
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Then pass the agent import path to Harbor:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
harbor run \
|
|
43
|
+
--agent-import-path harbor_pi_sdk_agent.agent:PiSdkAgent \
|
|
44
|
+
--agent-kwarg 'model_name=openai/gpt-4.1' \
|
|
45
|
+
--agent-kwarg 'api_key_env=OPENAI_API_KEY'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For an OpenAI-compatible endpoint:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
export DEEPSEEK_API_KEY=...
|
|
52
|
+
|
|
53
|
+
harbor run \
|
|
54
|
+
--agent-import-path harbor_pi_sdk_agent.agent:PiSdkAgent \
|
|
55
|
+
--agent-kwarg 'model_name=deepseek/deepseek-v4-pro' \
|
|
56
|
+
--agent-kwarg 'api_key_env=DEEPSEEK_API_KEY' \
|
|
57
|
+
--agent-kwarg 'base_url=https://api.deepseek.com'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
For an Anthropic-compatible Messages endpoint:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
export ANTHROPIC_API_KEY=...
|
|
64
|
+
|
|
65
|
+
harbor run \
|
|
66
|
+
--agent-import-path harbor_pi_sdk_agent.agent:PiSdkAgent \
|
|
67
|
+
--agent-kwarg 'model_name=anthropic/model-id' \
|
|
68
|
+
--agent-kwarg 'api_key_env=ANTHROPIC_API_KEY' \
|
|
69
|
+
--agent-kwarg 'base_url=https://your-anthropic-compatible-endpoint' \
|
|
70
|
+
--agent-kwarg 'model_api=anthropic-messages'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Launcher Setup
|
|
74
|
+
|
|
75
|
+
In your Harbor launcher or task wrapper, use:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
harbor_pi_sdk_agent.agent:PiSdkAgent
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Recommended kwargs:
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
model_name=provider/model-id
|
|
85
|
+
api_key_env=PROVIDER_API_KEY
|
|
86
|
+
agent_label=pi-sdk
|
|
87
|
+
base_url=https://...
|
|
88
|
+
thinking=xhigh
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Optional kwargs:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
model_api=anthropic-messages
|
|
95
|
+
provider_headers_json={"User-Agent":"..."}
|
|
96
|
+
compaction_enabled=0
|
|
97
|
+
filtered_events=1
|
|
98
|
+
raw_events=0
|
|
99
|
+
max_field_chars=200000
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Recommended artifacts:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
/logs/agent/trajectory.json
|
|
106
|
+
/logs/agent/trajectory.steps.jsonl
|
|
107
|
+
/logs/agent/pi-filtered.jsonl
|
|
108
|
+
/logs/agent/pi-sdk-runner.txt
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Add this only when you explicitly want raw SDK events:
|
|
112
|
+
|
|
113
|
+
```text
|
|
114
|
+
/logs/agent/pi-raw.jsonl
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Outputs
|
|
118
|
+
|
|
119
|
+
- `trajectory.json`: the main Harbor trajectory.
|
|
120
|
+
- `trajectory.steps.jsonl`: step-by-step trajectory stream for long or interrupted runs.
|
|
121
|
+
- `pi-filtered.jsonl`: compact Pi SDK event log.
|
|
122
|
+
- `pi-raw.jsonl`: raw Pi SDK event log when `raw_events=1`.
|
|
123
|
+
- `pi-sdk-runner.txt`: concise agent stdout.
|
|
124
|
+
|
|
125
|
+
## Python Usage
|
|
126
|
+
|
|
127
|
+
Harbor usually creates the agent from the import path. If you need to construct it in Python:
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from harbor_pi_sdk_agent import PiSdkAgent
|
|
131
|
+
|
|
132
|
+
agent = PiSdkAgent(
|
|
133
|
+
logs_dir=logs_dir,
|
|
134
|
+
model_name="openai/gpt-4.1",
|
|
135
|
+
api_key_env="OPENAI_API_KEY",
|
|
136
|
+
)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Use this package as a Harbor agent plugin, not as a standalone command-line tool.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "harbor-pi-sdk-agent"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Reusable Harbor custom agent that runs Pi SDK sessions and writes trajectory artifacts."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "LicenseRef-Proprietary"
|
|
12
|
+
keywords = ["harbor", "pi", "agent", "atif", "trajectory"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Kingwl" }
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Typing :: Typed",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Repository = "https://github.com/Kingwl/harbor-pi-sdk-agent"
|
|
29
|
+
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
dev = [
|
|
32
|
+
"build",
|
|
33
|
+
"pytest",
|
|
34
|
+
"ruff",
|
|
35
|
+
"twine",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.package-data]
|
|
42
|
+
harbor_pi_sdk_agent = ["*.mjs", "py.typed"]
|
|
43
|
+
|
|
44
|
+
[tool.ruff]
|
|
45
|
+
line-length = 100
|
|
46
|
+
target-version = "py311"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Reusable Harbor Pi SDK agent package."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__version__ = "0.1.0"
|
|
6
|
+
|
|
7
|
+
_EXPORTS = {
|
|
8
|
+
"PiSdkAgent": "PiSdkAgent",
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def __getattr__(name: str):
|
|
13
|
+
if name not in _EXPORTS:
|
|
14
|
+
raise AttributeError(name)
|
|
15
|
+
from . import agent
|
|
16
|
+
|
|
17
|
+
return getattr(agent, _EXPORTS[name])
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__all__ = ["__version__", "PiSdkAgent"]
|