Add checkpoint types and stop signal for agent suspension

Introduce Checkpoint, CheckpointStore, SuspendedError, AgentRegistry,
and CompletedCall types. Add cooperative stop signal via context.
Export CompletedCall (was unexported completedCall) so checkpoints
can reference completed tool results. Add JSON tags to ToolResult
and ApprovalResult for checkpoint serialization.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-04-10 18:52:57 +02:00
parent 19a2610056
commit 51df618c93
6 changed files with 180 additions and 11 deletions

View File

@@ -59,7 +59,7 @@ type (
inner *InterruptedError
toolCallID string
allToolCalls []llm.ToolCall
completedCalls []completedCall
completedCalls []CompletedCall
}
outerLoopState struct {
@@ -69,14 +69,9 @@ type (
turns int
allToolCalls []llm.ToolCall
toolCallID string
completedCalls []completedCall
completedCalls []CompletedCall
innerInterrupt *InterruptedError
}
completedCall struct {
toolCallID string
result ToolResult
}
)
func (e *MaxTurnsExceededError) Error() string {