Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

merge: Gemini Interactions API (#741) into release/v0.0.288

justrachf08dab88b602
diff --cc src/agent.zig
index 57509b6a,af3c7232..d8c91f2a
--- a/src/agent.zig
+++ b/src/agent.zig
@@@ -386,18 -389,14 +388,14 @@@ pub const Agent = struct
}
}
const hist_len = self.messages.items.len;
- const root = try self.request(if (self.text_only) null else self.toolsJson());
+ const root = self.request(if (self.text_only) null else self.toolsJson()) catch |err| return @import("agent_model_loop.zig").finishError(self, err);
- const done = switch (self.provider.kind) {
- .anthropic => try self.stepAnthropic(root),
- .openai => try self.stepOpenAI(root),
- .responses => try self.stepResponses(root),
- };
+ const done = try @import("agent_steps.zig").stepForWire(self, root);
if (done) |final_text| {
- // A completion with no text and no tool calls used to end the turn
- // silently — mid-task that just looks like a dead session.
+ // Retry empty replies; reconcile plain finals with live work (#745).
if (try empty_completion.handle(self, final_text, hist_len)) continue;
if (try @import("named_work.zig").handle(self, final_text)) continue;
- return final_text;
+ if (try pending_work.finish(self, final_text)) |text| return text;
+ continue;
}
self.empty_completion_retries = 0;
}