Skip to content

Function: executeAgent() ​

ts
function executeAgent<TIn, TOut, THandle>(
   node, 
   input, 
   ctx
): Promise<TOut>;

Defined in: runtime/agent/execute-agent.ts:86

Executes a passive AgentNode across turns, tool batches, policy guards, skills, capabilities, and beforeStop gates (SPEC.md §3.7.1).

Sequences session initialization (initializeAgentTurnSession), turn-loop execution (runAgentTurnLoop), and deterministic finalization (finalizeAgentTurnSession) at one uniform level of abstraction (Rule 3.1).

Type Parameters ​

Type ParameterDefault typeDescription
TInunknownValidated agent input payload type.
TOutunknownValidated agent output payload type.
THandleunknownRuntime handle type of the active isolation scope.

Parameters ​

ParameterTypeDescription
nodeAgentNode<TIn, TOut, THandle>Passive AgentNode AST definition.
inputTInRaw or pre-mapped input payload for the agent.
ctxStepExecutionContext<THandle>Active step execution context.

Returns ​

Promise<TOut>

Schema-validated agent output payload.

Released under the MIT License.