Make agent-tool subtrees suspendable
Propagate graceful-suspend signals through detached run contexts and let only opt-in suspendable tools re-attach cancellation, so AsTool sub-agents can checkpoint and restore across nested trees while leaf tools keep running detached. Add focused agent and worker tests for single and multi-level suspend/ restore flows, plus heartbeat lease-loss and nested-restore error paths to harden functional behavior under failure conditions. Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -39,6 +39,17 @@ type (
|
||||
ToolDescriptor
|
||||
Execute(ctx context.Context, arguments string) (ToolResult, error)
|
||||
}
|
||||
|
||||
// SuspendableTool marks tools that can safely receive the run's
|
||||
// graceful-suspend signal and checkpoint their own progress.
|
||||
//
|
||||
// Leaf tools should generally not implement this interface: they are
|
||||
// expected to run on a detached context so in-flight side effects are
|
||||
// not aborted during shutdown.
|
||||
SuspendableTool interface {
|
||||
Tool
|
||||
Suspendable()
|
||||
}
|
||||
)
|
||||
|
||||
// ResultJSON marshals v to JSON and returns a successful ToolResult.
|
||||
|
||||
Reference in New Issue
Block a user