Skip to content
Docs
GitHub

Coding Review Agent

Tool-based code inspection, a tightly scoped execution tool, and distinguishing test failure from tool failure.

3 min readEdit on GitHub

Browse the complete example.

Review a refund implementation against a written contract, then execute a bundled regression test before reporting a defect. A proposed test is not treated as proof: the agent gets actual compiler and test output.

Tool-based code inspection, a tightly scoped execution tool, and distinguishing test failure from tool failure.

Two refunds of 1,000 cents are requested against a 1,000-cent payment. Each individual call caps its own amount, but the implementation retains no cumulative refunded balance.

The regression fails with left: 2000 and right: 1000. The review should connect that observed failure to the missing cumulative-refund state, describe the over-refund risk, and propose a minimal fix. It must not claim the code was changed or fixed.

Install Rust/Cargo (including rustc), clone the repository, and run from its root. These folders are self-contained within the workspace: their Cargo manifests reference the local Framework crates, so copying one folder alone is not sufficient.

Terminal window
git clone https://github.com/everruns/everruns.git
cd everruns
export ANTHROPIC_API_KEY="your-key"
cargo run -p everruns-coding-review-agent

The configured model is claude-sonnet-5. Provider access and funded credits are required; a model identifier alone does not grant access. Keep keys in your environment, not in source control. Missing variables, provider errors, or unsuccessful turns exit nonzero.

Try a contrasting question:

Terminal window
cargo run -p everruns-coding-review-agent -- "Read the contract and test. Reproduce the cumulative refund bug and explain the smallest safe fix."

This builder combines the agent instructions, tools, and model. Tools/capabilities supply evidence and actions; the model chooses how to use them.

let agent = Agent::builder()
.name("coding-review-agent")
.instructions(include_str!("instructions.md"))
.provider(everruns::Anthropic::from_env()?)
.model(MODEL)
.max_iterations(12)
.tool(tools::inspect_change())
.tool(tools::run_regression())
.build()?;

The shared demo helper subscribes before sending, filters events to this turn, shows bounded tool previews, waits for completion, and rejects unsuccessful turns. It changes presentation only; use session.send_and_wait(question).await? when you do not need the live tool timeline.

let engine = Engine::new();
let session = engine.create(agent);
println!("MODEL: {MODEL}");
demo::run(&session, question).await?;

This engine is in-memory. It does not demonstrate durable session storage; the Everruns Support example can explain that API, but does not itself persist its session.

inspect_change can read only sample_payment.rs, contract.md, and regression.rs. run_regression invokes rustc --test on that fixed trusted fixture, runs the temporary binary, and returns its exit code and assertion output. Compilation and execution have timeouts; temporary files are removed automatically.

Terminal window
cargo test -p everruns-coding-review-agent
python3 examples/coding-review-agent/src/render_demo.py --check

The offline test compiles and runs the bundled regression and asserts the observed failure. cargo test -p everruns-coding-review-agent passes because it verifies reproduction of the intentionally buggy fixture. A failing subprocess is expected evidence, not a failing example test.

These checks run offline without provider credentials. To check the model’s answer, run the example and compare its output with the expected outcome above.

Coding Review Agent recorded run

Read the captured transcript for the full recorded output. The GIF shows excerpts from the run.

With credentials exported and Python 3, VHS, ffmpeg, and a VHS-compatible browser installed:

Terminal window
cd examples/coding-review-agent
bash src/record.sh

The script captures a successful run, generates correctly wrapped pages and page durations, and renders src/demo.gif. It preserves the previous transcript when the provider run fails. To replay an existing transcript without another model call, run (cd src && python3 render_demo.py && vhs demo.tape). src/demo.txt retains the displayed output; .demo-pages/ is generated and ignored. Inspect results before sharing: public/demo data is safe here, but adapting tools may expose private data.

Replace the fixture with a trusted review checkout and a restricted test selection. Use a sandbox before accepting arbitrary repositories, generated code, or model-selected commands. Add a second verified run after applying a fix in a separate approved workflow.

This is one deliberately buggy, trusted fixture—not a general-purpose coding agent. The execution tool takes no shell command or user-supplied path, and cannot edit code. Rust including rustc must be installed.