Method ResumeAsync
ResumeAsync(Agent, AgentRunState, AgentRunInput, AgentExecutionOptions, CancellationToken)
Continues a run that stopped (AwaitingApproval, AwaitingInput, AwaitingReconciliation), or that was interrupted (Suspended), from its state: in a new process, on any instance of the model. The run keeps its identifier.
public Task<AgentExecutionResult> ResumeAsync(Agent agent, AgentRunState state, AgentRunInput input = null, AgentExecutionOptions options = null, CancellationToken cancellationToken = default)
Parameters
agentAgentThe agent the run belongs to.
stateAgentRunStateThe run's state, from RunState or an IAgentRunStore.
inputAgentRunInputWhat unblocks the run; null to continue an interrupted run as it stood.
optionsAgentExecutionOptionsExecution options; the run's identifier is the state's.
cancellationTokenCancellationTokenA token to cancel the run.
Returns
- Task<AgentExecutionResult>
The result of the run, which may stop again.
Remarks
A round the run stopped in runs with the input's decisions: an approved
call runs (with the edited arguments, when the decision carries them), a denied call never
runs and the model is told why, a call whose result the state holds is not run again. A
call still undecided stops the run again. A decision is refused unless it names a call of
the round that waits for approval and the exact arguments hash it was shown.
Use a fresh executor, whose conversation is rebuilt from the state's history, or an executor over a conversation the host configured and that has said nothing yet (AgentExecutor(MultiTurnConversation)): it takes the run's history and keeps its tools, memory and knowledge. Resuming is an authorization boundary; the host checks that the caller may still run the agent before calling this method.
Exceptions
- ArgumentNullException
Thrown when
agentorstateis null.- InvalidOperationException
Thrown when the run cannot be resumed, or the executor already holds a conversation.
- ArgumentException
Thrown when a decision does not match a call awaiting approval, or an answer is missing.