Repository navigation
feat(examples): add coding agent harness example - #886
Agentic-JJ-Web3 wants to merge 4 commits into
Conversation
|
Opened #886 with steps 1–3. I made a few calls in the absence of answers to my questions above — they're listed in the PR description, happy to change any of them. |
|
Thanks for putting this together — the state-machine framing of the agent loop reads really well, and the scripted client makes it easy to try. I checked out this branch and ran it in a clean Python 3.14 venv built only from 1. Example fails to import from its own requirements
Suggested fix: drop the unused imports from 2.
|
|
Thanks for putting this together, and apologies for the delayed maintainer response. Your initial design choices make sense:
The functional findings from @DeepGandhi01 should be addressed before merge: clean-install imports, routing back through Two additional requirements:
The inactivity bot removed the assignment today, but I’d still like to move this contribution forward. Are you interested in making this follow-up? If useful, I’m also happy to push a cleanup commit to your branch since maintainer edits are enabled. |
|
Following up on the review above — I opened a PR against this branch with the fixes and the tests: Agentic-JJ-Web3#1 (base: It covers all seven findings from @DeepGandhi01 and the two requirements from @skrawcz:
Verified locally: The PR's base is this branch rather than Happy to adjust anything, and if it's easier to fold this straight into #886 rather than merging the follow-up, that works too. |
|
Yes, I’d like to make the follow-up — apologies for the slow response. @DeepGandhi01’s findings are all fair and I’ll work through them: the imports, routing tool actions back through create_prompt, unknown-tool handling, catching tool and argument failures, creating the workspace up front, realpath in _resolve, and the graphviz guard. Plus the ASF header and the test file. Should have something up this week. |
Addresses review findings on apache#886: - drop unused imports from tools.py so the example installs from its own requirements.txt - route tool actions back through create_prompt so the prompt seam runs before every model call, not just the first - report unknown tool names back to the model instead of halting silently, with a default transition as a safety net - catch tool and argument errors in execute_tool and return them as tool messages so the agent can recover - create the workspace at import so run_bash works before any write - resolve paths with realpath so symlinks cannot escape the workspace - guard json.loads in OpenAIClient and visualize() in __main__ - add the ASF license header to README.md - add test_coding_agent.py: 10 tests driven by ScriptedClient, no API key - regenerate notebook.ipynb from the fixed sources
|
Thanks both — @DeepGandhi01 that review was genuinely useful, and all seven Pushed fixes for everything, plus the two requirements:
Also regenerated Verified: @haigou-web thanks for the offer on Agentic-JJ-Web3#1 — I've worked through |
|
The documentation workflow shows a startup failure — that’s the ASF allowlist rejecting hasura/comment-progress@v2.2.0 before any job runs, not anything in this change. Looks like it affects all PRs. |
|
CI flagged two things in this PR, both fixed in the latest push:
The |
There was a problem hiding this comment.
🟡 Changes recommended
Invalid write contents can truncate existing files before validation, and timeout handling can leave child processes running and modifying files.
2 open issues
What changed in this PR
Adds a coding-agent example for #885, showing how Burr models an autonomous tool-calling loop with a step budget and tracked execution. CLI and permission controls remain separate follow-up work.
Changes:
- Adds four separately bound tools, prompt preparation, and recoverable tool-error handling.
- Supports OpenAI and a scripted client for runs without an API key.
- Includes a notebook walkthrough, tests, and setup and safety documentation.
| File | Description |
|---|---|
pyproject.toml |
Adds the example to an existing exclusion list. |
examples/coding-agent/tools.py |
Implements workspace file operations and shell execution. |
examples/coding-agent/test_coding_agent.py |
Tests the loop, termination, error recovery, and workspace boundaries. |
examples/coding-agent/requirements.txt |
Declares Burr and OpenAI dependencies. |
examples/coding-agent/README.md |
Explains the graph, setup, safety limits, and simplifications. |
examples/coding-agent/notebook.ipynb |
Walks through the harness with a recorded example run. |
examples/coding-agent/application.py |
Defines clients, actions, graph transitions, and tracking. |
examples/coding-agent/__init__.py |
Adds the package marker and license header. |
Review effort: Balanced
| full = _resolve(path) | ||
| os.makedirs(os.path.dirname(full), exist_ok=True) | ||
| with open(full, "w") as f: | ||
| f.write(contents) |
| cwd=os.path.abspath(WORKSPACE), | ||
| capture_output=True, | ||
| text=True, | ||
| timeout=30, |
|
Checked the current head ( 1.
|


Part of #885. This is the first of three PRs — steps 1–3 of your outline
(harness loop, basic tools, running it with tests and the Burr UI). CLI and
permissions follow separately.
What's here
examples/coding-agent/— an agent that reads files, writes files, lists adirectory, and runs shell commands, looping until the model answers without
requesting a tool or the step budget runs out.
The graph is
human_input → create_prompt → call_llm, with four bound toolactions fanning out of
call_llmand looping back to it. Each tool is boundseparately rather than dispatched from a registry, so the Burr UI shows which
one ran at each step.
Decisions I made without you
You hadn't replied yet, so these are assumptions rather than agreements —
happy to change any of them:
notebook.ipynbis a required file andhas to execute, so the example falls back to a client replaying a fixed
sequence of tool calls when
OPENAI_API_KEYisn't set. Real OpenAI clientwhen it is.
run_bashis not sandboxed. File paths are confined to a workspacedirectory, but a shell command can
cdout. The README says so plainly,which leaves step 5 something concrete to fix.
list_files, since an agent that can'tsee the directory can't orient itself.
are dropped. Documented as a known simplification.
Notes
validate_examples.pypasses forcoding-agent.required. Thetool-callingexample marks all of them, which misreports optional args —happy to open a separate issue for that.
examples/hello-world-countercrashes atapp.visualize()unless theGraphviz binary is installed, and passing a stale
app_idafter clearing~/.burrraises a pydantic error onPointerModel.app_id. Both separatefrom this PR; can file them if useful.