From 3f1ace16afc7877b0bfad374cb286d4d84140960 Mon Sep 17 00:00:00 2001 From: t Date: Thu, 4 Jun 2026 09:46:49 -0600 Subject: failure retries scheme --- libpanto/src/tool.zig | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'libpanto/src/tool.zig') diff --git a/libpanto/src/tool.zig b/libpanto/src/tool.zig index c912099..60a7736 100644 --- a/libpanto/src/tool.zig +++ b/libpanto/src/tool.zig @@ -84,11 +84,18 @@ pub const Tool = struct { /// agent takes ownership and frees the slice and every part (see /// `freeResultParts`). /// - /// Returning an error aborts the current turn. The agent surfaces - /// the error to the user. Native tool implementations are - /// responsible for catching their own panics — a panic in `invoke` - /// will crash the process. Adapters that bridge to safer languages - /// (Lua, Python, Go) should convert panics/exceptions into errors. + /// Returning an error normally becomes a model-visible error + /// `ToolResult`: the agent synthesizes an error result for this + /// call (and keeps the matching `ToolResult` for every other call + /// in the batch), then lets the model continue so it can correct + /// arguments, try another tool, or explain the failure. Only hard + /// host failures (`error.Canceled`, `error.OutOfMemory`) abort the + /// whole turn and propagate to the embedder. + /// + /// Native tool implementations are responsible for catching their + /// own panics — a panic in `invoke` will crash the process. + /// Adapters that bridge to safer languages (Lua, Python, Go) should + /// convert panics/exceptions into errors. invoke: *const fn ( ctx: *anyopaque, input: []const u8, -- cgit v1.3