Harness as a traversal
This example delegates harness-example.answer to a local atfHar process through app.harness(provider="atf-harness"). It returns the text, usage, price and session ID the CLI supplies, while the graph server stores the traversal and progress. A provider error fails the traverser with the harness message; no fixture answer is substituted.
Capabilities
| Capability | Kind | Signature | Module | Summary |
|---|---|---|---|---|
answer | traversal | (prompt: str, model: Optional[str] = None, cwd: Optional[str] = None, variant: Optional[str] = None, provider: Optional[str] = None, timeout: float = DEFAULT_TIMEOUT_SECONDS) -> dict | examples/harness/python/agent.py | Run one prompt through the harness with no tools and return what it reported. |
doctor | skill | () -> dict | examples/harness/python/agent.py | Which harness CLIs are available on this worker (nothing is executed). |
continue | traversal | (task: str, timeout: Optional[float] = None) -> dict | examples/harness/remote/agent.py | A follow-up in the same harness session (same ATFGraph session id required). |
doctor | skill | () -> dict | examples/harness/remote/agent.py | Reachability, readiness and profile availability of the configured harness. No turn is started. |
implement | traversal | (task: str, timeout: Optional[float] = None) -> dict | examples/harness/remote/agent.py | Run ``task`` in the operator's workspace. One attempt: coding work has side effects. |
Commands
atfg traverse remote-coder.continue --in '{"task": "Now add a test"}' --session <id>
atfg traverse remote-coder.doctor --in '{}'
atfg traverse remote-coder.implement --in '{"task": "Fix the failing parser tests"}' --new-session
python -m atfgraph.worker --module examples.harness.python.agent:app
python -m atfgraph.worker --module examples.harness.remote.agent:app
python -m examples.harness.python.call "Reply with the word ready."
python -m examples.harness.python.call --doctor
python -m examples.harness.remote.call "Fix the failing parser tests and explain the change"
python -m examples.harness.remote.call "Fix the failing parser tests" # new ATFGraph session → new harness session
python -m examples.harness.remote.call --doctor
python -m examples.harness.remote.call --session <id> "Now add a test" # follow-up in the same harness session
Files
examples/harness/README.mdexamples/harness/__init__.pyexamples/harness/python/__init__.pyexamples/harness/python/agent.pyexamples/harness/python/agentnode.yamlexamples/harness/python/call.pyexamples/harness/python/requirements.txtexamples/harness/remote/__init__.pyexamples/harness/remote/agent.pyexamples/harness/remote/agentnode.yamlexamples/harness/remote/call.pyexamples/harness/remote/requirements.txt
README
This example delegates harness-example.answer to a local atfHar process through app.harness(provider="atf-harness"). It returns the text, usage, price and session ID the CLI supplies, while the graph server stores the traversal and progress. A provider error fails the traverser with the harness message; no fixture answer is substituted.
| Capability | Kind | What it does |
|---|---|---|
answer | traversal | one prompt, no tools, one attempt, 120 s harness timeout |
doctor | skill | which harness CLIs are installed on the worker host (none is executed) |
Prerequisites
Use Python 3.10+, the installed SDK, a running graph server, and atfHar on the worker's PATH. Configure its model and credentials in ~/.atf-harness/agent/config.yml and models.yml. The example does not edit those files or log into providers.
Run
atfHar --version
export ATFGRAPH_HARNESS_MODEL='your-provider/your-model'
export ATFGRAPH_HARNESS_WORKDIR="$PWD"
# Export the provider credentials your harness model needs into this shell:
# the worker process is what runs atfHar.
target/debug/atfgraphd
python -m atfgraph.worker --module examples.harness.python.agent:app
# Another terminal:
python -m examples.harness.python.call --doctor
python -m examples.harness.python.call "Reply with the word ready."
The server defaults to http://127.0.0.1:18880. Input options can override model, cwd, variant, provider and timeout; environment values supply defaults. cwd selects a working directory, not a sandbox. Set ATFGRAPH_HARNESS_THINKING only to override a configured variant. Other supported providers can be selected through ATFGRAPH_HARNESS_PROVIDER or --provider; their tool controls differ.
Missing or expired credentials appear as a failed traverser, including the provider's reported authentication error. doctor checks executable availability only; it does not verify model access.
Package or install
target/debug/atfg install examples/harness/python --python python3 --sdk python
target/debug/atfg run harness-example
The package manifest asks for ATFGRAPH_HARNESS_MODEL and ATFGRAPH_HARNESS_WORKDIR. Provider credentials remain in the operator's harness configuration rather than being packaged with the node.
Differences from the original
- The node is an outbound worker with no inbound agent port.
max_attempts=1places retry control on the registered capability.- atfHar print mode runs one turn; Claude Code supports an explicit
max_turnsoption if selected instead. - Invocation errors raise
HarnessFailure, reported in the traverser error. - Streamed harness JSON events become progress events within the traversal, not independent graph steps. Local harness usage needs explicit recording when it should appear in shared usage totals.
The migrated-operations tests use a fixture atfHar executable with a real local daemon. They verify adapter behavior without contacting a model provider.
Remote harness (remote/)
The remote-coder node uses the same harness call with RemoteHarness transport and an existing workspace on another host. The remote service executes the task while ATFGraph records orchestration, approval pauses and reported usage. The worker needs no local coding CLI.
| Capability | Kind | What it does |
|---|---|---|
implement | traversal | one task in the operator's workspace, one attempt |
continue | traversal | a follow-up in the same harness session (same ATFGraph session id) |
doctor | skill | reachability, readiness and profile availability of the harness; no turn |
Set ATFGRAPH_HARNESS_URL, ATFGRAPH_HARNESS_PROFILE and ATFGRAPH_HARNESS_WORKSPACE, plus edge authentication/token settings when required. Start examples.harness.remote.agent:app with the worker, then call examples.harness.remote.call. The workspace must already exist on the remote host; this example does not clone repositories or return patches. See the remote harness guide.