Yield Tool
yield_tool · Nodes · AI
Exposes a tool that ends the agent run and hands the call to the workflow.
Yield Tool#
Exposes a tool that ends the agent run instead of executing. When the AI calls it, the AI node finishes successfully and the call leaves on its structured socket — a yielded call is the run's final message, so it goes out the same channel any other final message does. The workflow does whatever the call asked for, then resumes the agent by appending the answer to the transcript.
The name you configure is the entire name the AI sees. Nothing is prefixed and nothing is decorated, so to the model this is an ordinary tool: ask_on_discord, wait_until, request_approval.
Yield has the workflow execution surface because the graph owns its handoff and resume protocol.
It is not General: Agents sessions and Spawn Agent Tool children cannot select it, nor can the
hosted MCP server. Use this specialized node, not the generic Tool Provider's group picker.
When to Use#
- Ask a person, anywhere - Post the question to Discord, Telegram, or email, and resume when the reply arrives. Agents sessions ask through their own
ask_usercard; this is how a workflow agent asks. - Wait for time or a condition - The agent yields, the workflow sleeps or ends, and a later trigger resumes it. The wait can outlive the run.
- Approval gates - Pause before a consequential action and continue only once someone approves.
- Hand off to deterministic logic - Let the workflow decide something the agent should not, and return the decision as the tool's result.
Use Subworkflow Tool instead when the work can finish during the call. Yield Tool is for work that cannot: it exists precisely because the answer is not available while the agent is waiting.
How It Works#
- The AI calls the tool with arguments matching your schema.
- The run ends successfully with no further turns. The tool never executes, so it cannot fail.
- The call arrives on the AI node's
structuredsocket as{response: "yield", calls: [call]}, the call being{tool_name, tool_use_id, arguments}.callsalways holds exactly one call: the one that stopped the batch.tool_use_ididentifies it; a call made by an OpenAI Responses model also carriesprovider_item_id, that provider's own item id, which you never need to match on. - The rest of the workflow acts on it.
- To continue, fill in the open entry the run left on
messages, and feed that transcript into an AI Conversation node'smessagessocket.
The transcript on messages contains the yielded call as an open entry — the call, with no result. Filling it is what makes the resume valid.
Leaving one unfilled is an error, not a silent omission: an open entry becomes a tool_use with no answering tool_result, which no provider accepts. The run that reads it fails saying which call was never answered.
A yield stops the batch. A model can ask for several calls in one turn, and they start in the order it asked for them. The calls before the yield have already run and are recorded normally. The calls after it are recorded on messages as not started ("state": "not_started"): they have not run, and you do not fill them. When you fill the yielded call and run AI Conversation again, those calls run first, in order, before the AI is asked for its next turn. If one of them yields too, the run stops there again and hands you that call.
Configuration#
| Field | On screen | Required | Description |
|---|---|---|---|
tool_name |
Tool Name | Yes | The exact name the AI sees. Must not be return_output, which is reserved for structured output. |
ai_description |
AI Description | Recommended | Tells the AI when to call the tool and what the answer will be. Without it the model has nothing to go on. |
tool_description |
Description | No | Shown in the editor only. Never sent to the AI. |
params_schema |
Parameters | No | JSON Schema for the arguments. Must be an object schema. Omit it for a no-argument tool. |
Inputs and Outputs#
| Socket | Direction | Description |
|---|---|---|
input |
Input | Execution ordering only. The node builds the tool; it does not read this value. |
tool |
Output | Connect to an AI Conversation node's tools socket. |
Resuming#
Find the open entry by its tool_use_id and give it a result. The entry is already in the transcript with the ids the provider issued, so there is nothing to invent and nothing to match up:
const yielded = inputs.yielded.calls[0];
return inputs.messages.map(entry =>
entry.kind
&& entry.kind.type === "tool_invocation"
&& entry.kind.tool_use_id === yielded.tool_use_id
&& entry.kind.result === undefined
? { ...entry, kind: { ...entry.kind, result: { answer: "yes" }, success: true } }
: entry
);
result is whatever the AI should see as the tool's return value. id and timestamp may be omitted; they are filled in on load.
Fill on write wherever you already know the answer. A refusal, or a call you can answer at once, can be filled immediately and stored complete. Only a genuine wait needs to be left open.
That makes an open entry mean waiting, which is worth more than it looks: "is this run suspended?" becomes "does its transcript end with an open entry?", and you do not need a status column you have to keep honest alongside it.
Resuming does not have to happen in the same execution. Store the transcript in a table, end the workflow, and load it back when the answer arrives, days later if need be. That is what makes long waits and human replies possible.
Wiring#
[Trigger] ──→ [Yield Tool] ──(tool)──→ [AI Conversation]
│
(structured) ──────┼──→ [Send to Discord]
(messages) ─────┘
To offer more than one tool, connect them through a Flatten node. Two tool nodes wired straight into the same tools socket do not combine — only the first one that carries data is used.
Important#
- Resuming needs AI Conversation. Both AI nodes emit the call on
structured, so either can hand one to the workflow. Only AI Conversation outputs a transcript onmessages, which is what an answer is appended to, so a run you intend to resume belongs on that node. From AI Agent the yield is still useful when the call is the end of the work — notify someone, hand off, stop here. - A yield is a success. The run ends with no error. Branch on whether
structuredproduced a value, not on failure. - Not available to General agents. Agents sessions and Spawn Agent Tool children reject Workflow/Yield tools during tool resolution. Put the yielding tool on the workflow's own AI node.
- Calls the AI asked for after the yield in the same turn wait as not started and run when you resume. Calls before it have already run.
Troubleshooting#
The AI never calls the tool - The ai_description is empty or vague. Say when to call it and what comes back.
The resumed agent repeats itself, or the provider rejects the request - The appended entry has the wrong tool_use_id. Copy it from the structured output rather than constructing one.
The run ends but structured is empty - The agent answered normally without calling the tool. structured ends its branch in that case, which is the expected shape.
A node wired to both structured and messages never runs - A skip on any one input skips the node, so a node that must run whether or not the agent yielded cannot take structured as an input. Keep the resume path on its own branch.
A schema and a yield tool on the same agent - Both leave through structured. Branch on whether the value carries tool_name if an agent needs both.
Inputs
inputRequired
Outputs
tool
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
tool_name | string | Yes | Name the AI sees for this tool. Used exactly as written |
tool_description | text | Yes | Description shown in the editor. Not sent to the AI |
ai_description | text | Yes | AI-facing description: when to call this tool, and what the answer will be |
params_schema | json_schema | Yes | JSON Schema defining expected parameters for this tool |
base_config | record | No | Shared node configuration. failure_mode decides what a failure of this node does to the workflow; leave it at the default stop unless the workflow handles the failure itself on the node's error output (route_to_error) or the node is a rare emergency kill switch (stop_workflow). |