import type * as ElevenLabs from "../../../api/index"; import type { Tool } from "../tools/Tool"; import type { ConditionModel } from "./Condition"; import type { Destination } from "./Destination"; import type { WorkflowIssue } from "./errors"; export type NodeModel = ElevenLabs.AgentWorkflowRequestModelNodesValue; export interface GraphEdge { /** Set for edges loaded from an existing workflow; generated at build time otherwise. */ id?: string; source: string; target: string; forwardCondition?: ConditionModel; backwardCondition?: ConditionModel; /** Editor bend points, kept for loaded edges. */ reroutes?: ElevenLabs.PositionInput[]; } /** A tool by id, or a `Tool` object whose id is filled in when the workflow is built. */ export type ToolRef = string | Tool; /** The placeholder a `Tool` object stands under in the graph until `build()` swaps in its id. */ export declare function toolPlaceholder(name: string): string; export interface NodeOptions { /** Position in the workflow editor. Nodes without one are laid out automatically. */ position?: ElevenLabs.PositionInput; } export interface ConverseOptions extends NodeOptions { /** Name shown in the workflow editor. Defaults to the node id. */ label?: string; /** * Tools available to this subagent, on top of the agent's own: tool ids, or `Tool` objects whose ids are filled in * when the workflow is built with `toolIds`, as `agents.push()` does. */ toolIds?: ToolRef[]; /** Knowledge base documents available to this subagent, on top of the agent's own. */ knowledgeBase?: ElevenLabs.KnowledgeBaseLocator[]; /** Overrides for the agent's conversation config (LLM, voice, ...) while this subagent is active. */ conversationConfig?: ElevenLabs.ConversationalConfigApiModelWorkflowOverrideInput; entryBehavior?: ElevenLabs.EntryBehavior; } export interface ToolOptions extends NodeOptions { /** * Parameter overrides per tool id (or tool name, for a `Tool` object), keyed by dotted parameter path (e.g. * `path_params.order_id`). */ schemaOverrides?: Record>; } export interface TransferOptions extends NodeOptions { /** Phone and SIP transfers only. */ transferType?: ElevenLabs.TransferTypeEnum; /** Phone and SIP transfers only. */ customSipHeaders?: ElevenLabs.WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem[]; /** Phone and SIP transfers only. */ sipReferPlayDialtone?: boolean; /** Phone and SIP transfers only. */ uui?: ElevenLabs.UuiTransferConfig; /** Phone and SIP transfers only. */ postDialDigits?: ElevenLabs.WorkflowPhoneNumberNodeModelInputPostDialDigits; /** Agent transfers only. */ delayMs?: number; /** Agent transfers only. */ transferMessage?: string; /** Agent transfers only. */ enableTransferredAgentFirstMessage?: boolean; /** Agent transfers only. */ preserveClientTtsOverrides?: boolean; /** Agent transfers only. */ preserveVoiceSettings?: boolean; } export interface EndOptions extends NodeOptions { /** Defaults to `"end"`, which every `end()` without an id shares. */ id?: string; } /** Fields accepted by `WorkflowNode.update()`. Only the fields that apply to the node's kind may be set. */ export interface NodeUpdate extends ConverseOptions, ToolOptions, TransferOptions { /** Subagent nodes: the instructions added to the agent's prompt. */ prompt?: string; /** Subagent nodes: extra tools. Tool nodes: the tools to run. */ toolIds?: ToolRef[]; /** Transfer nodes: where to transfer to. */ destination?: Destination; } /** Mutable state shared by a `Workflow` and every node handle created from it. */ export declare class WorkflowGraph { readonly nodes: Map; edges: GraphEdge[]; readonly issues: WorkflowIssue[]; startId: string; /** Each loaded node's `edgeOrder`, as edges. `build()` keeps this order and appends edges added since. */ readonly loadedOrder: Map; preventSubagentLoops: boolean | undefined; /** `Tool` objects referenced by nodes, by placeholder. */ readonly toolRefs: Map; /** Swaps `Tool` objects for placeholders, remembering each one. */ refTools(nodeId: string, refs: ToolRef[]): string[]; private _usesPlaceholder; addNode(id: string, model: NodeModel): void; applyOptions(id: string, model: NodeModel, options: NodeUpdate): NodeModel; /** Replaces the graph's contents with an existing workflow, keeping ids, positions and edge order. */ load(workflow: ElevenLabs.AgentWorkflowRequestModel): void; private _invalidOption; } /** A tool id as shown in messages: the name for a `Tool` object's placeholder. */ export declare function displayTool(id: string): string;