agent_handoff
Delegate a multi-step task (research, composing messages, booking, scheduling) to the full agentic planner. Use when a user ask needs more than a direct answer. The specialist runs synchronously — its response is already shown to the user in real-time. Summarize the OUTCOME in past tense (e.g. 'The Media Creator generated your video' or 'The Document Composer failed because...'). Do NOT say 'I will delegate' — the delegation already happened. If status is timeout or error, explain what went wrong and offer to retry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Execution mode: 'sync' (wait for result, default) or 'async' (fire and forget, child runs in background). Async is only available in background/trigger context. | sync |
| payload | No | Optional structured data for the target agent. For a rule_based (script) target this becomes the script's inputs['raw_data'] verbatim — pass the exact fields its script reads (same contract as the trigger event that script normally handles). For LLM targets it is appended to the task text as a [PAYLOAD] JSON block. VOICE callers: the voice pipeline's strict schemas seal free-form objects, so from a live call put the data in task_description instead — script targets receive it as inputs['message_text']. | |
| agent_id | No | Optional ID of another agent in the same workspace to delegate the task to. When set, this becomes cross-agent delegation; the target agent runs with ITS OWN prompt, tools, and model. Use this for specialty tasks (see agents.list to discover specialists). Prefer the in-loop variant (no `agent_id`) for one-off escalations. Spawns a new trace linked back to this trace via parent_trace_id (visible in the admin lineage card). | |
| target_slug | No | Optional stable slug of a system-template specialist to delegate to (e.g. 'doc-composer' for the Document Composer). Env-portable alternative to agent_id — resolves the workspace's fork of that template (auto-forking on first use). Used by async handoffs that target a specialist without knowing its per-workspace id. | |
| in_workspace | No | Run this one call in this workspace id instead of the session's. Nothing is stored; other sessions are not affected. | |
| task_description | Yes | Plain-language description of what the planner should accomplish. Include everything the planner needs: the user's goal, constraints, and any context already gathered in this voice call. |