Codex/Hermes-style goal mode as an ADK-Rust example: set a goal + a verifiable success condition (a shell command that must exit 0), and the agent loops plan → act → verify, self-correcting from the check's output, until the condition passes or the iteration budget is reached.
It's durable: after every iteration the goal state is atomically
checkpointed to disk (.adk/goal.json), so a restart can resume from where it
left off — and a completed goal is recognized as done.
cargo run --manifest-path examples/coding_goal/Cargo.tomlRequires GOOGLE_API_KEY (Gemini 3, default) — or CODING_PROVIDER=openai with
OPENAI_API_KEY. Override the model with CODING_MODEL.
- Seeds a workspace with a buggy
stats.py(meanforgets to divide) + a failingtest_stats.py. - Runs the goal loop until
python3 test_stats.pyexits 0, checkpointing each iteration. - Prints the persisted checkpoint.
- Re-runs with
resume = trueto show a completed goal is a no-op (simulating a restart). - Independently verifies the result.
━━ iteration 1/5 ━━
🔧 bash (python3 test_stats.py → fails)
🔧 read_file stats.py
🔧 edit_file return sum(xs) → return sum(xs) / len(xs)
🔧 bash (python3 test_stats.py → ok)
✅ goal met after 1 iteration(s)
══ durable checkpoint (.adk/goal.json) ══
{ "goal": "...", "until": "python3 test_stats.py", "iteration": 1, "status": "done", ... }
══ resume (simulating a restart) ══
goal already complete (per checkpoint); nothing to do.
══ verification ══
✅ PASS python3 test_stats.py (exit Some(0)) after 1 iteration(s)
The same capability ships in the CLI, with --resume:
adk-rust goal "make all tests pass" --until "cargo test" --max-iters 8
adk-rust goal "..." --until "cargo test" --resume # continue after a restart