agent-orchestration-process 0.3.0__tar.gz → 0.4.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.
- agent_orchestration_process-0.4.0/PKG-INFO +142 -0
- agent_orchestration_process-0.4.0/README.md +120 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/pyproject.toml +1 -1
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/pyproject.toml.orig +1 -1
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/cli.py +59 -11
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/egress_bridge.py +4 -9
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/models.py +8 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/prompt_transport.py +6 -2
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/runner.py +277 -129
- agent_orchestration_process-0.4.0/src/agent_orchestration_process/sandbox_launch.py +137 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/zcode_protocol.py +4 -8
- agent_orchestration_process-0.3.0/PKG-INFO +0 -144
- agent_orchestration_process-0.3.0/README.md +0 -122
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/LICENSE +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/__init__.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/__main__.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/batch.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/codex_auth.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/codex_routes.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/dsh_runner.mjs +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/egress.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/integration.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/isolation.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/locks.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/migration.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/model_catalog.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/model_listing.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/pricing.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/provider_versions.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/worktrees.py +0 -0
- {agent_orchestration_process-0.3.0 → agent_orchestration_process-0.4.0}/src/agent_orchestration_process/zcode.py +0 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-orchestration-process
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Run bounded, non-interactive jobs across agent harnesses with isolation, exact resume, and provenance
|
|
5
|
+
Keywords: agent-orchestration,ai-agents,autoresearch,coding-agents,git-worktrees
|
|
6
|
+
Author: AOP contributors
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Topic :: Software Development
|
|
15
|
+
Requires-Dist: model-prices>=0.0.3
|
|
16
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Project-URL: Homepage, https://github.com/wakamex/agent-orchestration-process
|
|
19
|
+
Project-URL: Repository, https://github.com/wakamex/agent-orchestration-process.git
|
|
20
|
+
Project-URL: Issues, https://github.com/wakamex/agent-orchestration-process/issues
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# Agent Orchestration Process (AOP)
|
|
24
|
+
|
|
25
|
+
AOP is a command-line tool for running coding agents such as Claude Code and Codex as unattended jobs. It is for automation: CI jobs, batch experiments, benchmarks, and programs that hand work to an agent and need a dependable result back. One `aop run` command drives ten different agent CLIs, called harnesses here, and gives every run the same sandbox, deadline, and result record, so a caller does not need a separate adapter for each CLI's flags, sessions, and output.
|
|
26
|
+
|
|
27
|
+
- Run [Codex](https://github.com/openai/codex), [Claude Code](https://code.claude.com/docs/en/overview), [Cursor Agent](https://docs.cursor.com/en/cli/overview), [Devin CLI](https://docs.devin.ai/cli/index), [OpenCode](https://github.com/anomalyco/opencode), [Antigravity (`agy`)](https://github.com/google-antigravity/antigravity-cli), [Grok Build](https://github.com/xai-org/grok-build), [Hermes](https://github.com/NousResearch/hermes-agent), [DeepSeek Harness (`dsh`)](https://github.com/deepseek-ai/deepseek-harness), and Zcode through the same `run` and `resume` commands. Each keeps its own login, models, and tools.
|
|
28
|
+
- Isolate each run in a Git worktree or an empty sealed workspace, inside a [bubblewrap](https://github.com/containers/bubblewrap) sandbox, with optional network-level blocking of web access.
|
|
29
|
+
- Get one JSON result per run: the answer, timing, token usage, an API-equivalent cost, the harness session ID for exact resume, and whether the provider refused.
|
|
30
|
+
- Keep cleanup, checkpointing, and Git integration outside the agent's control.
|
|
31
|
+
|
|
32
|
+
[Agent Client Protocol (ACP)](https://agentclientprotocol.com/) connects agents to editors for interactive sessions, where a person chats, approves actions, and steers. AOP serves the opposite case: software running bounded jobs with nobody watching. The two are complementary.
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
- Linux. AOP's sandbox is built on Linux namespaces.
|
|
37
|
+
- Python 3.11 or newer and [uv](https://docs.astral.sh/uv/).
|
|
38
|
+
- `bwrap` (bubblewrap) for the sandboxed profiles, with unprivileged user namespaces allowed. On Fedora and Debian, install the `bubblewrap` package. Ubuntu 24.04 and later also need `sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0`.
|
|
39
|
+
- Git, for runs in a repository.
|
|
40
|
+
- At least one harness, installed and signed in. Codex needs version 0.150.1 or newer and Antigravity 1.1.16 or newer; [Harness adapters](docs/harnesses.md#supported-harnesses) lists the versions each adapter was last tested with.
|
|
41
|
+
|
|
42
|
+
## Quickstart
|
|
43
|
+
|
|
44
|
+
Install AOP from [PyPI](https://pypi.org/project/agent-orchestration-process/):
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
uv tool install agent-orchestration-process
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Run a sealed task. It sees no repository and no local files, only what you pass with `--input`:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
aop run --agent claude --profile sealed --prompt "Reply with only the word copper."
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The answer goes to stdout; the run's details go to stderr:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
aop: run_id=74a91b9f-d64e-45cd-9c56-b308c8840d58 session_id=fba843cd-3050-4672-a39b-1deaa63ef5d9 time=2.13s tokens=16887 accounting=complete calculated_cost=$0.000171 provider_reported_cost=n/a billing=subscription artifacts=/home/me/.aop/runs/74a91b9f-d64e-45cd-9c56-b308c8840d58
|
|
60
|
+
copper
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
AOP records the run in a `.aop` folder in the directory you ran it from. Add `--json` for the full result as one object, abridged here:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"run_id": "5f668bbc-cad7-4852-b1b3-00b021952dd2",
|
|
68
|
+
"provider": "claude",
|
|
69
|
+
"model": "claude-haiku-5-5",
|
|
70
|
+
"status": "succeeded",
|
|
71
|
+
"final_message": "copper",
|
|
72
|
+
"session_id": "24ec7778-cd70-450f-a1f1-9090ae51b889",
|
|
73
|
+
"duration_seconds": 2.18,
|
|
74
|
+
"error": null,
|
|
75
|
+
"usage": {"input_tokens": 16883, "cached_input_tokens": 11227, "output_tokens": 4},
|
|
76
|
+
"accounting_status": "complete",
|
|
77
|
+
"calculated_cost": {"amount_usd": 0.00124527, "currency": "USD", "priced_as": "claude-haiku-5-5"},
|
|
78
|
+
"billing": {"route": "subscription", "credential_source": "claude-oauth"},
|
|
79
|
+
"refusal": null
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Continue the same harness session from any directory with the run ID:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
aop resume 5f668bbc-cad7-4852-b1b3-00b021952dd2 --prompt "Now reply with silver."
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
To work on a repository, run from inside it. AOP creates a worktree for the task and leaves your checkout alone:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
aop init
|
|
93
|
+
aop run task-a --agent codex --prompt "Implement the parser and its tests"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`aop init` adds `/.aop/` to `.gitignore`; commit that before integrating tasks. See [Integration](docs/integration.md) for merging a task's changes back.
|
|
97
|
+
|
|
98
|
+
## Safety defaults
|
|
99
|
+
|
|
100
|
+
AOP is built to run agents unattended, so know what a run can do before you start one:
|
|
101
|
+
|
|
102
|
+
> [!WARNING]
|
|
103
|
+
> - Harness permission prompts are always bypassed. The agent runs its tools without asking; the AOP sandbox and profile are the boundary.
|
|
104
|
+
> - The network is open unless you pass `--no-web`. Without it, an agent can reach any host, including to send data out.
|
|
105
|
+
> - The agent can read the credentials of its own harness, which AOP copies into the run so the harness can sign in.
|
|
106
|
+
> - The `host` profile has no sandbox: the agent has your full user account and filesystem.
|
|
107
|
+
> - AOP limits a run only by wall-clock time with `--timeout`. It has no spending, token, or resource cap.
|
|
108
|
+
|
|
109
|
+
[Running unattended](docs/unattended.md) covers what the sandbox does and does not stop, every result status and exit code, recovery after a crash, and cleanup.
|
|
110
|
+
|
|
111
|
+
## Execution profiles
|
|
112
|
+
|
|
113
|
+
`--profile` sets what a run can see and change. The default is `edit`.
|
|
114
|
+
|
|
115
|
+
| Profile | Use it when |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| `edit` | The agent should modify an isolated task worktree. |
|
|
118
|
+
| `review` | The agent should inspect a task worktree without modifying it. |
|
|
119
|
+
| `sealed` | The agent should see only explicit input snapshots, with no repository or inherited instructions. |
|
|
120
|
+
| `host` | The command needs the native host environment and filesystem, with no sandbox. |
|
|
121
|
+
|
|
122
|
+
Preview a run's boundary without starting it:
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
aop run --agent codex --profile sealed --prompt "Answer using only declared inputs" --dry-run
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
See [Execution profiles](docs/profiles.md) for exact filesystem, instruction, environment, credential, input, and output boundaries, and [CLI guide](docs/cli.md#disable-model-controlled-web-access) for `--no-web`.
|
|
129
|
+
|
|
130
|
+
## Documentation
|
|
131
|
+
|
|
132
|
+
- [CLI guide](docs/cli.md): running and resuming tasks, inputs and artifacts, batches, models, and cleanup.
|
|
133
|
+
- [Execution profiles](docs/profiles.md): what each profile exposes.
|
|
134
|
+
- [Running unattended](docs/unattended.md): safety, statuses, exit codes, and recovery.
|
|
135
|
+
- [Harness adapters](docs/harnesses.md): per-harness support, versions, and options.
|
|
136
|
+
- [Token usage and pricing](docs/token-usage.md): the usage and cost fields, and upgrading old run records.
|
|
137
|
+
- [Integration](docs/integration.md): checkpointing and merging task changes.
|
|
138
|
+
- [Glossary](docs/glossary.md): the terms these pages use.
|
|
139
|
+
|
|
140
|
+
## Development
|
|
141
|
+
|
|
142
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setting up a checkout and running the tests, including the opt-in tests against installed harnesses.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Agent Orchestration Process (AOP)
|
|
2
|
+
|
|
3
|
+
AOP is a command-line tool for running coding agents such as Claude Code and Codex as unattended jobs. It is for automation: CI jobs, batch experiments, benchmarks, and programs that hand work to an agent and need a dependable result back. One `aop run` command drives ten different agent CLIs, called harnesses here, and gives every run the same sandbox, deadline, and result record, so a caller does not need a separate adapter for each CLI's flags, sessions, and output.
|
|
4
|
+
|
|
5
|
+
- Run [Codex](https://github.com/openai/codex), [Claude Code](https://code.claude.com/docs/en/overview), [Cursor Agent](https://docs.cursor.com/en/cli/overview), [Devin CLI](https://docs.devin.ai/cli/index), [OpenCode](https://github.com/anomalyco/opencode), [Antigravity (`agy`)](https://github.com/google-antigravity/antigravity-cli), [Grok Build](https://github.com/xai-org/grok-build), [Hermes](https://github.com/NousResearch/hermes-agent), [DeepSeek Harness (`dsh`)](https://github.com/deepseek-ai/deepseek-harness), and Zcode through the same `run` and `resume` commands. Each keeps its own login, models, and tools.
|
|
6
|
+
- Isolate each run in a Git worktree or an empty sealed workspace, inside a [bubblewrap](https://github.com/containers/bubblewrap) sandbox, with optional network-level blocking of web access.
|
|
7
|
+
- Get one JSON result per run: the answer, timing, token usage, an API-equivalent cost, the harness session ID for exact resume, and whether the provider refused.
|
|
8
|
+
- Keep cleanup, checkpointing, and Git integration outside the agent's control.
|
|
9
|
+
|
|
10
|
+
[Agent Client Protocol (ACP)](https://agentclientprotocol.com/) connects agents to editors for interactive sessions, where a person chats, approves actions, and steers. AOP serves the opposite case: software running bounded jobs with nobody watching. The two are complementary.
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
|
|
14
|
+
- Linux. AOP's sandbox is built on Linux namespaces.
|
|
15
|
+
- Python 3.11 or newer and [uv](https://docs.astral.sh/uv/).
|
|
16
|
+
- `bwrap` (bubblewrap) for the sandboxed profiles, with unprivileged user namespaces allowed. On Fedora and Debian, install the `bubblewrap` package. Ubuntu 24.04 and later also need `sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0`.
|
|
17
|
+
- Git, for runs in a repository.
|
|
18
|
+
- At least one harness, installed and signed in. Codex needs version 0.150.1 or newer and Antigravity 1.1.16 or newer; [Harness adapters](docs/harnesses.md#supported-harnesses) lists the versions each adapter was last tested with.
|
|
19
|
+
|
|
20
|
+
## Quickstart
|
|
21
|
+
|
|
22
|
+
Install AOP from [PyPI](https://pypi.org/project/agent-orchestration-process/):
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
uv tool install agent-orchestration-process
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Run a sealed task. It sees no repository and no local files, only what you pass with `--input`:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
aop run --agent claude --profile sealed --prompt "Reply with only the word copper."
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The answer goes to stdout; the run's details go to stderr:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
aop: run_id=74a91b9f-d64e-45cd-9c56-b308c8840d58 session_id=fba843cd-3050-4672-a39b-1deaa63ef5d9 time=2.13s tokens=16887 accounting=complete calculated_cost=$0.000171 provider_reported_cost=n/a billing=subscription artifacts=/home/me/.aop/runs/74a91b9f-d64e-45cd-9c56-b308c8840d58
|
|
38
|
+
copper
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
AOP records the run in a `.aop` folder in the directory you ran it from. Add `--json` for the full result as one object, abridged here:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"run_id": "5f668bbc-cad7-4852-b1b3-00b021952dd2",
|
|
46
|
+
"provider": "claude",
|
|
47
|
+
"model": "claude-haiku-5-5",
|
|
48
|
+
"status": "succeeded",
|
|
49
|
+
"final_message": "copper",
|
|
50
|
+
"session_id": "24ec7778-cd70-450f-a1f1-9090ae51b889",
|
|
51
|
+
"duration_seconds": 2.18,
|
|
52
|
+
"error": null,
|
|
53
|
+
"usage": {"input_tokens": 16883, "cached_input_tokens": 11227, "output_tokens": 4},
|
|
54
|
+
"accounting_status": "complete",
|
|
55
|
+
"calculated_cost": {"amount_usd": 0.00124527, "currency": "USD", "priced_as": "claude-haiku-5-5"},
|
|
56
|
+
"billing": {"route": "subscription", "credential_source": "claude-oauth"},
|
|
57
|
+
"refusal": null
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Continue the same harness session from any directory with the run ID:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
aop resume 5f668bbc-cad7-4852-b1b3-00b021952dd2 --prompt "Now reply with silver."
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
To work on a repository, run from inside it. AOP creates a worktree for the task and leaves your checkout alone:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
aop init
|
|
71
|
+
aop run task-a --agent codex --prompt "Implement the parser and its tests"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`aop init` adds `/.aop/` to `.gitignore`; commit that before integrating tasks. See [Integration](docs/integration.md) for merging a task's changes back.
|
|
75
|
+
|
|
76
|
+
## Safety defaults
|
|
77
|
+
|
|
78
|
+
AOP is built to run agents unattended, so know what a run can do before you start one:
|
|
79
|
+
|
|
80
|
+
> [!WARNING]
|
|
81
|
+
> - Harness permission prompts are always bypassed. The agent runs its tools without asking; the AOP sandbox and profile are the boundary.
|
|
82
|
+
> - The network is open unless you pass `--no-web`. Without it, an agent can reach any host, including to send data out.
|
|
83
|
+
> - The agent can read the credentials of its own harness, which AOP copies into the run so the harness can sign in.
|
|
84
|
+
> - The `host` profile has no sandbox: the agent has your full user account and filesystem.
|
|
85
|
+
> - AOP limits a run only by wall-clock time with `--timeout`. It has no spending, token, or resource cap.
|
|
86
|
+
|
|
87
|
+
[Running unattended](docs/unattended.md) covers what the sandbox does and does not stop, every result status and exit code, recovery after a crash, and cleanup.
|
|
88
|
+
|
|
89
|
+
## Execution profiles
|
|
90
|
+
|
|
91
|
+
`--profile` sets what a run can see and change. The default is `edit`.
|
|
92
|
+
|
|
93
|
+
| Profile | Use it when |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| `edit` | The agent should modify an isolated task worktree. |
|
|
96
|
+
| `review` | The agent should inspect a task worktree without modifying it. |
|
|
97
|
+
| `sealed` | The agent should see only explicit input snapshots, with no repository or inherited instructions. |
|
|
98
|
+
| `host` | The command needs the native host environment and filesystem, with no sandbox. |
|
|
99
|
+
|
|
100
|
+
Preview a run's boundary without starting it:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
aop run --agent codex --profile sealed --prompt "Answer using only declared inputs" --dry-run
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
See [Execution profiles](docs/profiles.md) for exact filesystem, instruction, environment, credential, input, and output boundaries, and [CLI guide](docs/cli.md#disable-model-controlled-web-access) for `--no-web`.
|
|
107
|
+
|
|
108
|
+
## Documentation
|
|
109
|
+
|
|
110
|
+
- [CLI guide](docs/cli.md): running and resuming tasks, inputs and artifacts, batches, models, and cleanup.
|
|
111
|
+
- [Execution profiles](docs/profiles.md): what each profile exposes.
|
|
112
|
+
- [Running unattended](docs/unattended.md): safety, statuses, exit codes, and recovery.
|
|
113
|
+
- [Harness adapters](docs/harnesses.md): per-harness support, versions, and options.
|
|
114
|
+
- [Token usage and pricing](docs/token-usage.md): the usage and cost fields, and upgrading old run records.
|
|
115
|
+
- [Integration](docs/integration.md): checkpointing and merging task changes.
|
|
116
|
+
- [Glossary](docs/glossary.md): the terms these pages use.
|
|
117
|
+
|
|
118
|
+
## Development
|
|
119
|
+
|
|
120
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setting up a checkout and running the tests, including the opt-in tests against installed harnesses.
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "agent-orchestration-process"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.0"
|
|
8
8
|
description = "Run bounded, non-interactive jobs across agent harnesses with isolation, exact resume, and provenance"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "agent-orchestration-process"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.0"
|
|
8
8
|
description = "Run bounded, non-interactive jobs across agent harnesses with isolation, exact resume, and provenance"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -27,6 +27,7 @@ from .runner import (
|
|
|
27
27
|
AgentRunner,
|
|
28
28
|
RunStore,
|
|
29
29
|
adapter_for,
|
|
30
|
+
NATIVE_STATE_PROVIDERS,
|
|
30
31
|
plan_inputs,
|
|
31
32
|
provider_runtime_record,
|
|
32
33
|
)
|
|
@@ -200,6 +201,20 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
200
201
|
help="how Claude returns the model's thinking, such as official summaries "
|
|
201
202
|
"(claude only)",
|
|
202
203
|
)
|
|
204
|
+
run.add_argument(
|
|
205
|
+
"--workdir",
|
|
206
|
+
type=Path,
|
|
207
|
+
metavar="DIR",
|
|
208
|
+
help="with --profile host, run the harness in DIR itself, Git or not, "
|
|
209
|
+
"instead of a task worktree; TASK becomes optional and AOP keeps its "
|
|
210
|
+
"records in the current directory",
|
|
211
|
+
)
|
|
212
|
+
run.add_argument(
|
|
213
|
+
"--native-state",
|
|
214
|
+
action="store_true",
|
|
215
|
+
help="with --profile host, let the harness use its own home, settings, "
|
|
216
|
+
"memory and sessions instead of AOP's private copy (claude only)",
|
|
217
|
+
)
|
|
203
218
|
run.add_argument(
|
|
204
219
|
"--writable-workspace",
|
|
205
220
|
action="store_true",
|
|
@@ -328,7 +343,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
|
328
343
|
_report_policy(policy, json_output=args.json)
|
|
329
344
|
return 0
|
|
330
345
|
|
|
331
|
-
if args.command == "run" and args.profile == "sealed":
|
|
346
|
+
if args.command == "run" and (args.profile == "sealed" or args.workdir):
|
|
332
347
|
manager = WorktreeManager.standalone(Path.cwd())
|
|
333
348
|
elif args.command in {"resume", "cleanup"}:
|
|
334
349
|
manager = _manager_holding_run(args.run_id)
|
|
@@ -344,6 +359,8 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
|
344
359
|
request = RunStore(manager.state_dir / "runs").load_request(args.run_id)
|
|
345
360
|
if request.profile == "sealed":
|
|
346
361
|
_cleanup_sealed(manager, request)
|
|
362
|
+
elif request.workdir is not None:
|
|
363
|
+
pass # The caller's directory is not AOP's to remove.
|
|
347
364
|
elif any(item.task == request.task for item in manager.list()):
|
|
348
365
|
manager.remove(request.task, force=True)
|
|
349
366
|
print(request.task)
|
|
@@ -396,8 +413,10 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
|
396
413
|
|
|
397
414
|
if args.command == "run":
|
|
398
415
|
task = args.task or str(uuid.uuid4())
|
|
399
|
-
if args.task is None and args.profile != "sealed":
|
|
400
|
-
raise AOPError(
|
|
416
|
+
if args.task is None and args.profile != "sealed" and not args.workdir:
|
|
417
|
+
raise AOPError(
|
|
418
|
+
"TASK is required unless --profile sealed or --workdir is selected"
|
|
419
|
+
)
|
|
401
420
|
preview = resolve_policy(
|
|
402
421
|
args.profile,
|
|
403
422
|
provider=args.agent,
|
|
@@ -405,6 +424,17 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
|
405
424
|
input_names=tuple(Path(path).name for path in args.input_paths),
|
|
406
425
|
).to_dict()
|
|
407
426
|
preview["provider"] = args.agent
|
|
427
|
+
workdir = AgentRunner._validated_workdir(args.workdir, args.profile)
|
|
428
|
+
if workdir is not None:
|
|
429
|
+
preview["workspace"]["content"] = "caller-directory"
|
|
430
|
+
preview["workspace"]["host_path"] = workdir
|
|
431
|
+
preview["working_directory"] = workdir
|
|
432
|
+
if args.native_state:
|
|
433
|
+
if args.profile != "host":
|
|
434
|
+
raise AOPError("--native-state applies only to the host profile")
|
|
435
|
+
if args.agent not in NATIVE_STATE_PROVIDERS:
|
|
436
|
+
raise AOPError(f"{args.agent} does not support --native-state")
|
|
437
|
+
preview["state"] = "harness-native"
|
|
408
438
|
planned = plan_inputs(
|
|
409
439
|
args.input_paths,
|
|
410
440
|
excludes=args.input_excludes,
|
|
@@ -454,6 +484,8 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
|
454
484
|
input_paths=args.input_paths,
|
|
455
485
|
input_excludes=args.input_excludes,
|
|
456
486
|
skip_external_links=args.skip_external_links,
|
|
487
|
+
workdir=args.workdir,
|
|
488
|
+
native_state=args.native_state,
|
|
457
489
|
system_prompt=_read_system_prompt(args),
|
|
458
490
|
tools=args.tools,
|
|
459
491
|
provider_base_url=args.provider_base_url,
|
|
@@ -717,20 +749,36 @@ def _report_policy(
|
|
|
717
749
|
|
|
718
750
|
|
|
719
751
|
def _manager_holding_run(run_id: str) -> WorktreeManager:
|
|
720
|
-
"""The state
|
|
752
|
+
"""The state that holds the run, found from any directory.
|
|
721
753
|
|
|
722
|
-
|
|
723
|
-
|
|
754
|
+
The repository or current directory comes first, since sealed runs
|
|
755
|
+
record themselves under the current directory even inside a repository.
|
|
756
|
+
Otherwise the run's archived result names its state root, and failing
|
|
757
|
+
that the registered state roots are searched.
|
|
724
758
|
"""
|
|
725
759
|
try:
|
|
726
760
|
repository = WorktreeManager.discover(Path.cwd())
|
|
727
761
|
except AOPError:
|
|
728
762
|
repository = None
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
763
|
+
for state_dir in (
|
|
764
|
+
repository.state_dir if repository is not None else None,
|
|
765
|
+
Path.cwd() / ".aop",
|
|
766
|
+
_archived_state_root(run_id),
|
|
767
|
+
*registered_state_roots(),
|
|
768
|
+
):
|
|
769
|
+
if state_dir is not None and (state_dir / "runs" / run_id).is_dir():
|
|
770
|
+
return WorktreeManager(state_dir.parent)
|
|
771
|
+
return repository or WorktreeManager.standalone(Path.cwd())
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
def _archived_state_root(run_id: str) -> Path | None:
|
|
775
|
+
try:
|
|
776
|
+
recorded = json.loads(
|
|
777
|
+
(results_archive_dir() / f"{run_id}.json").read_text()
|
|
778
|
+
)["state_root"]
|
|
779
|
+
except (OSError, ValueError, KeyError, TypeError):
|
|
780
|
+
return None
|
|
781
|
+
return Path(recorded) if isinstance(recorded, str) else None
|
|
734
782
|
|
|
735
783
|
|
|
736
784
|
def _migrate_results(runs_dirs: Sequence[Path], *, dry_run: bool) -> int:
|
|
@@ -5,11 +5,10 @@ Usage: egress_bridge.py SOCKET PROXY_PORT [HOST:PORT ...] -- COMMAND...
|
|
|
5
5
|
Inside the namespace, 127.0.0.1:PROXY_PORT reaches the controller's CONNECT
|
|
6
6
|
proxy through SOCKET, and each HOST:PORT (a loopback endpoint) is forwarded to
|
|
7
7
|
the same endpoint outside. The controller decides what is allowed, so this
|
|
8
|
-
script holds no policy. It
|
|
9
|
-
the command
|
|
8
|
+
script holds no policy. It forwards stop signals to the command and exits
|
|
9
|
+
with the command's status; bubblewrap's own process 1 collects orphans.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
import os
|
|
13
12
|
import signal
|
|
14
13
|
import socket
|
|
15
14
|
import subprocess
|
|
@@ -88,12 +87,8 @@ def main(argv):
|
|
|
88
87
|
child = subprocess.Popen(command)
|
|
89
88
|
for number in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP):
|
|
90
89
|
signal.signal(number, lambda signum, frame: child.send_signal(signum))
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
pid, status = os.wait()
|
|
94
|
-
if pid == child.pid:
|
|
95
|
-
code = os.waitstatus_to_exitcode(status)
|
|
96
|
-
return code if code >= 0 else 128 - code
|
|
90
|
+
code = child.wait()
|
|
91
|
+
return code if code >= 0 else 128 - code
|
|
97
92
|
|
|
98
93
|
|
|
99
94
|
if __name__ == "__main__":
|
|
@@ -114,6 +114,10 @@ class RunRequest:
|
|
|
114
114
|
# that leave their input are skipped instead of failing the run.
|
|
115
115
|
input_excludes: tuple[str, ...] = ()
|
|
116
116
|
skip_external_links: bool = False
|
|
117
|
+
# A host run in this directory itself instead of a task worktree, and
|
|
118
|
+
# whether the harness keeps its own home and state there.
|
|
119
|
+
workdir: str | None = None
|
|
120
|
+
native_state: bool = False
|
|
117
121
|
# How `aop migrate-results` converted an older record, if it did.
|
|
118
122
|
migration: dict[str, Any] | None = None
|
|
119
123
|
|
|
@@ -203,6 +207,10 @@ class RunResult:
|
|
|
203
207
|
provider_duration_seconds: float | None = None
|
|
204
208
|
provider_status: str | None = None
|
|
205
209
|
provider_error: str | None = None
|
|
210
|
+
# Set when the provider refused the input: its category and explanation
|
|
211
|
+
# when reported, the models that refused, the messages the harness
|
|
212
|
+
# withdrew, and the line of events.jsonl where the refusal begins.
|
|
213
|
+
refusal: dict[str, Any] | None = None
|
|
206
214
|
accounting_status: str = "complete"
|
|
207
215
|
usage_schema: str = TOKEN_USAGE_SCHEMA
|
|
208
216
|
# The .aop state directory the run was recorded in, as listed in the
|
|
@@ -91,6 +91,10 @@ sys.argv = sys.argv[1:]
|
|
|
91
91
|
flag = '--prompt' if '--prompt' in sys.argv else '-q'
|
|
92
92
|
i = sys.argv.index(flag) + 1
|
|
93
93
|
sys.argv[i] = pathlib.Path(sys.argv[i]).read_bytes().decode('utf-8')
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
if sys.argv[0] == '-c':
|
|
95
|
+
code = sys.argv.pop(1)
|
|
96
|
+
exec(compile(code, '<string>', 'exec'), {'__name__': '__main__'})
|
|
97
|
+
else:
|
|
98
|
+
sys.path.insert(0, str(pathlib.Path(sys.argv[0]).resolve().parent))
|
|
99
|
+
runpy.run_path(sys.argv[0], run_name='__main__')
|
|
96
100
|
"""
|