Skip to content

feat(executor): Add parallel tool executor and dev agent#7

Merged
ATMackay merged 2 commits into
mainfrom
feature/parallel-executor-dev-agent
May 24, 2026
Merged

feat(executor): Add parallel tool executor and dev agent#7
ATMackay merged 2 commits into
mainfrom
feature/parallel-executor-dev-agent

Conversation

@ATMackay
Copy link
Copy Markdown
Owner

Summary

  • executor/ — Custom agent.Agent that bypasses ADK's sequential llmagent loop. Injects *genai.FunctionDeclarations via genai.GenerateContentConfig.Tools, calls model.GenerateContent directly, and fans out every tool call batch from a single LLM response as goroutines (sync.WaitGroup). Each dispatch logs tool start/done with per-call timing.
  • devtools/ — 9 dev-focused tools, all path-resolved against an explicit workDir: bash (200 KB sandwich truncation, process-group kill via Setpgid+WaitDelay for reliable timeouts), read_file, write_file, edit_file (uniqueness guard + replace_all), list_dir, glob, search_files (with context lines), git_status/diff/commit/push/branch, spawn_agent (runs agent run dev as subprocess).
  • agents/dev/NewDev() wires executor + devtools with a TDD-first system prompt (write failing tests first, verify build after every edit, conventional commits).
  • cmd/dev.goagent run dev --task "..." --work-dir . subcommand.
  • pipeline/ — Adds "dev" stage type to runStage() switch. StageConfig gains an optional task field for dev stage instructions.

Key design decisions

Why bypass llmagent? ADK's base_flow.go iterates function calls sequentially in a plain for loop. Parallel execution requires owning that loop. agent.New(agent.Config{Run: customFn}) provides the hook without rip-and-replace of existing agents.

Reliable bash timeouts: /bin/sh -c cmd forks child processes that inherit the pipe. Killing only the shell leaves children holding the pipe open, blocking cmd.Wait() indefinitely. Fix: SysProcAttr{Setpgid: true} + cmd.Cancel kills the entire process group; cmd.WaitDelay caps any remaining drain time.

Test plan

  • go build ./... — clean compile, no import cycles
  • go test -race ./... — all tests pass including new:
    • executor/executor_test.go — parallel dispatch timing, no data race, unknown tool error, response construction
    • devtools/bash_test.go — sandwich truncation, timeout (now ~2s not 60s), exit code capture, workDir
    • devtools/edit_test.go — basic replacement, not-found error, uniqueness guard, replace_all
    • agents/dev/config_test.go — Validate() with/without WorkDir
  • agent run dev --help — flags and description render correctly

🤖 Generated with Claude Code

ATMackay and others added 2 commits May 24, 2026 15:42
Implements V2 of the software lifecycle harness: a custom ADK agent
that dispatches tool calls concurrently using sync.WaitGroup, bypassing
llmagent's sequential execution loop.

New packages:
- executor/: Custom agent.Agent backed by a parallel tool dispatch loop.
  Injects function declarations via genai.GenerateContentConfig.Tools,
  calls model.GenerateContent directly, and fans out all tool calls in a
  single LLM response as goroutines.
- devtools/: 9 dev-focused tools (bash with sandwich truncation + process-
  group kill, read_file, write_file, edit_file with uniqueness guard,
  list_dir, glob, search_files, git_status/diff/commit/push/branch,
  spawn_agent). All paths resolved against an explicit workDir.
- agents/dev/: NewDev() wires executor + devtools into an agent.Agent.
  System prompt enforces TDD-first workflow and conventional commits.

CLI: `agent run dev --task "..." --work-dir .` added as a subcommand.

Pipeline: adds "dev" stage type to runStage() switch, allowing the
implementation agent to be orchestrated as part of a multi-stage pipeline.
StageConfig gains an optional `task` field for dev stage instructions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ATMackay ATMackay merged commit 6705e86 into main May 24, 2026
2 checks passed
@ATMackay ATMackay deleted the feature/parallel-executor-dev-agent branch May 24, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant