feat: pass parent custom tools to local workers#261
Open
Obol-Agent wants to merge 2 commits intoConway-Research:mainfrom
Open
feat: pass parent custom tools to local workers#261Obol-Agent wants to merge 2 commits intoConway-Research:mainfrom
Obol-Agent wants to merge 2 commits intoConway-Research:mainfrom
Conversation
Workers are currently limited to exec, read_file, write_file, and task_done. This means any task requiring external actions — GitHub PRs, email outreach, web API calls, or third-party execution platforms — can't be completed by workers. The parent orchestrator has to do everything itself, which defeats the purpose of multi-agent task decomposition. This change lets the parent agent pass its custom tools to LocalWorkerPool. Workers automatically inherit all parent tools except orchestration-internal ones (create_goal, list_goals, etc.). Use case that motivated this: we're building an Obol (https://obolagents.com) integration for our agent. Obol is an execution layer that gives agents access to Stripe, GitHub, Discord, Twitter, Slack, and Notion through a single POST /v1/execute call ($0.005/call). With this change, worker agents can call Obol directly to perform real-world actions as part of their tasks instead of the parent having to proxy everything. Changes: - LocalWorkerConfig: add optional customTools array - buildWorkerTools(): merge custom tools after builtins - buildWorkerSystemPrompt(): list custom tools when available - loop.ts: adapt parent AutomatonTools to WorkerTool interface and pass them to the pool (excluding orchestration-internal tools) Backwards compatible — customTools defaults to empty array.
When a local worker finishes (success or crash), it removes itself from the in-memory pool but leaves its `children` DB record as "running". The orchestrator's stale task recovery detects the dead worker and resets the task to pending, but `matchTaskToAgent` then finds the still-"running" child record and re-assigns the task to the same dead address — creating an infinite recovery loop. Fix in two places (belt-and-suspenders): 1. local-worker.ts: Workers now mark their children record as "terminated" in .finally() when they exit. 2. orchestrator.ts: Stale task recovery also terminates the dead child record, catching edge cases where the worker crashed before cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
customToolsconfig optionchildrentable when they exit, preventing stale task recovery loops where the orchestrator endlessly re-assigns tasks to dead worker addressesChanges
src/orchestration/local-worker.tscustomTools?: WorkerTool[]toLocalWorkerConfigwith JSDocbuildWorkerTools()merges custom tools after builtinsbuildWorkerSystemPrompt()lists custom tool names when available.finally()inspawn()now marks the child asterminatedin DBsrc/orchestration/orchestrator.tsWhy this matters
Without custom tools, workers are limited to
exec,read_file,write_file, andtask_done. Any goal involving external actions (submitting a PR, sending an email, calling an API) would silently fail — the worker would build files locally but never publish them.This is especially important for agents using external execution layers like Obol — workers can now call
POST /v1/executeto interact with Stripe, GitHub, Discord, Twitter, Slack, and Notion through the parent's credentials.The dead worker bug caused orchestrators to burn inference credits in infinite recovery loops, repeatedly assigning tasks to workers that had already exited.
Test plan
customToolsterminatedin children table after exit🤖 Generated with Claude Code