import type { AgentRuntimeContext } from '../../types/agent/base.js'; import type { TaskScheduler } from '../../types/agent/scheduler.js'; import type { ToolDefinition } from '../../types/tool/index.js'; import type { TaskLaunchedCallback } from './index.js'; /** * Build the `Agent` tool — synchronous subagent delegation. * * Semantics: parent calls `Agent({ description, prompt, subagent_type })`, * the runtime spawns the chosen subagent with its own context window, * the parent's tool call BLOCKS until the subagent finishes, and the * subagent's final text comes back as the tool result. Intermediate * subagent tool calls are isolated — only the summary surfaces to * the parent. * * **How this relates to `create_task`.** This paragraph used to say the two * were different shapes — that `create_task` / `continue_task` / * `cancel_task` were a non-blocking trio driven by a `` * callback, and that the blocking `Agent` tool should be preferred. None of * that is true any more. `create_task` blocks and returns the worker's output * as its own `tool_result`, exactly like this tool; `continue_task` and * `cancel_task` are still defined in `./index.ts` but are deliberately not * registered, because a blocking launch leaves every worker terminal by the * time a later turn learns its id. So a reader following the old advice was * choosing between two tools on a distinction that no longer existed. * * What actually separates them is the surface, not the timing: * * - `create_task` arrives with the rest of the coordinator surface — * `agent_task_list`, and `approve_plan` / `ask_user_question` when their * dependencies are wired. That is the supervisor's toolkit. * - This builds one tool and nothing else, for an agent whose only delegation * need is "hand this to a specialist". `terminal: true` additionally lets a * pure router settle on the specialist's answer instead of spending a turn * at full parent context to paraphrase it. * * Neither is legacy. Pick by how much of the coordinator surface you want. */ export interface AgentToolOptions { gateway: TaskScheduler; workingDirectory: string; runtimeContext?: AgentRuntimeContext; allowedAgentIds: string[]; onTaskLaunched?: TaskLaunchedCallback; /** * Settle the parent session with the subagent's answer instead of looping * once more to restate it. See {@link ToolDefinition.terminal}. * * For a router — an agent whose whole job is to pick a specialist — * the relay turn is pure overhead at the parent's full context size, * and it hands the caller the parent's paraphrase rather than the * specialist's answer. Off by default: an agent that delegates as one * step of a longer plan needs the loop to continue. */ terminal?: boolean; } export declare function buildAgentTool(opts: AgentToolOptions): ToolDefinition; //# sourceMappingURL=agent.d.ts.map