External Tasks

Some work cannot run inside the agent process: it belongs to a separate worker, a CI runner, or a human in another system. When a lane is routed to an external handler, the tools on that lane are queued instead of executed — they wait as external tasks. Your host code drains the pending queue, does the work however it likes, and reports the outcome back with completeExternalTask. Reach for this only when an outside worker is genuinely part of your architecture.

External tasks are produced by the lane queue: you must register at least one external (or hybrid) lane handler first, otherwise every task runs in-process and there is nothing to drain.

Node.js
Python

Notes:

  • Each pending task carries task_id, session_id, lane, command_type, payload, and timeout_ms. Pass the task_id back to completeExternalTask / complete_external_task to match the completion to the right task.
  • The result shape is { success, result?, error? }. result holds any JSON-serializable payload; error is an optional message for failures.
  • On success, return compact structured evidence (a summary plus the key facts), not raw logs only — the agent reasons over the result, so keep it small and machine-readable.
  • completeExternalTask / complete_external_task returns true when the task was found and completed, false otherwise. In Python these queue methods are synchronous; in Node pendingExternalTasks and completeExternalTask return promises.