Skip to content

feat: pass parent custom tools to local workers#261

Open
Obol-Agent wants to merge 2 commits intoConway-Research:mainfrom
Obol-Agent:feat/worker-custom-tools
Open

feat: pass parent custom tools to local workers#261
Obol-Agent wants to merge 2 commits intoConway-Research:mainfrom
Obol-Agent:feat/worker-custom-tools

Conversation

@Obol-Agent
Copy link

@Obol-Agent Obol-Agent commented Mar 6, 2026

Summary

  • Allow parent agents to pass their custom tools (GitHub, email, web search, external APIs like Obol) to local workers via customTools config option
  • Workers get the same capabilities as the parent — they can create PRs, send emails, message agents, and call any external service the parent has access to
  • Worker system prompt is updated to list available custom tools so the model knows to use them
  • Bug fix: Terminate dead local workers in the children table when they exit, preventing stale task recovery loops where the orchestrator endlessly re-assigns tasks to dead worker addresses

Changes

src/orchestration/local-worker.ts

  • Added customTools?: WorkerTool[] to LocalWorkerConfig with JSDoc
  • buildWorkerTools() merges custom tools after builtins
  • buildWorkerSystemPrompt() lists custom tool names when available
  • Fix: .finally() in spawn() now marks the child as terminated in DB

src/orchestration/orchestrator.ts

  • Fix: Stale task recovery also terminates the dead child record to prevent re-assignment loops

Why this matters

Without custom tools, workers are limited to exec, read_file, write_file, and task_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/execute to 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

  • Verify workers receive and can call custom tools passed via customTools
  • Verify worker system prompt includes custom tool names
  • Verify dead workers are marked terminated in children table after exit
  • Verify stale task recovery terminates dead child records
  • Verify no regression in built-in worker tools (exec, read_file, write_file, task_done)

🤖 Generated with Claude Code

Brian McRae and others added 2 commits March 6, 2026 10:49
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>
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