import type { Tool, ToolExecutionContext } from "../../tool/types.js"; import type { Agent } from "../types.js"; import { type AgentToolInput } from "../schemas/index.js"; import { AGENT_DELEGATE_TOOL_PREFIX, isProviderSafeDelegateId } from "./agent-delegation-names.js"; export { AGENT_DELEGATE_TOOL_PREFIX, isProviderSafeDelegateId }; export declare const INVOKE_AGENT_TOOL_ID = "invoke_agent"; /** Resolves a registered agent by id (defaults to the global registry). */ export type DelegateAgentResolver = (id: string) => Agent | undefined; /** Fixed-target delegate execution used by hosts with their own child-run lifecycle. */ export type DelegateAgentExecutor = (input: { delegateId: string; agent: Agent; toolInput: AgentToolInput; context?: ToolExecutionContext; }) => Promise; /** Input payload for creating the generic local invoke_agent platform tool. */ export type CreateInvokeAgentToolInput = { /** Id of the invoking agent, excluded to prevent self-invocation. */ selfId?: string; /** Override the project-scoped agent resolver (testing / custom registries). */ resolveAgent?: DelegateAgentResolver; }; /** * Create the generic invoke_agent platform tool for direct runtimes. * * Targets resolve lazily from the active project registry so agent discovery * order and HMR updates do not freeze the available child definitions. */ export declare function createInvokeAgentTool(input?: CreateInvokeAgentToolInput): Tool; /** Input payload for build agent delegate tools. */ export type BuildAgentDelegateToolsInput = { /** Specialist agent ids this coordinator is allowed to delegate to. */ delegates: readonly string[]; /** Id of the delegating agent, excluded to prevent self-delegation. */ selfId?: string; /** Override the agent resolver (testing / custom registries). */ resolveAgent?: DelegateAgentResolver; /** Override execution while keeping the delegate id fixed by the tool wrapper. */ executeDelegate?: DelegateAgentExecutor; }; /** * Builds the opt-in delegate tools for a coordinator agent. * * Each entry in `delegates` becomes an `agent_{id}` tool that runs the named * specialist agent. Agents are resolved lazily at execution time so discovery * order does not matter. Self-delegation, duplicates, and ids that would * produce a provider-unsafe tool name are skipped defensively here; markdown * parsing rejects the latter two cases up front with an explicit diagnostic. * Returns an empty map when `delegates` is empty — i.e. an agent with no * `delegates` runs with no orchestration. * * Delegation chains are intentionally not cycle-detected here. Each delegated * call is a separate agent run with its own maxSteps budget; hosted nested * invocation metadata enforces a runtime depth cap, but authors should still * keep delegate graphs acyclic so cycles do not burn the available depth. */ export declare function buildAgentDelegateTools(input: BuildAgentDelegateToolsInput): Record; //# sourceMappingURL=agent-delegation.d.ts.map