Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(halo): add zod undefined regression test case (#19112)

Nimar6d0a02c8a118
diff --git a/worker/src/features/in-app-agent/runtime/__fixtures__/bedrock-tool-call.eventstream b/worker/src/features/in-app-agent/runtime/__fixtures__/bedrock-tool-call.eventstream
new file mode 100644
index 0000000000..555f5484f4
Binary files /dev/null and b/worker/src/features/in-app-agent/runtime/__fixtures__/bedrock-tool-call.eventstream differ
diff --git a/worker/src/features/in-app-agent/runtime/model.bedrock.test.ts b/worker/src/features/in-app-agent/runtime/model.bedrock.test.ts
new file mode 100644
index 0000000000..e0a1e6647b
--- /dev/null
+++ b/worker/src/features/in-app-agent/runtime/model.bedrock.test.ts
@@ -0,0 +1,35 @@
+import { readFileSync } from "node:fs";
+import { createAmazonBedrock } from "ai-sdk-amazon-bedrock-v4";
+import { expect, it } from "vitest";
+
+it("parses a Bedrock tool call whose start event omits input", async () => {
+ // ConverseStream: start has only toolUseId/name; the delta supplies input "{}".
+ const response = readFileSync(
+ new URL("./__fixtures__/bedrock-tool-call.eventstream", import.meta.url),
+ );
+ const bedrock = createAmazonBedrock({
+ region: "us-east-1",
+ accessKeyId: "test-access-key",
+ secretAccessKey: "test-secret-key",
+ fetch: async () =>
+ new Response(response, {
+ headers: { "content-type": "application/vnd.amazon.eventstream" },
+ }),
+ });
+ const { stream } = await bedrock(
+ "anthropic.claude-sonnet-4-20250514-v1:0",
+ ).doStream({
+ prompt: [
+ { role: "user", content: [{ type: "text", text: "My timezone?" }] },
+ ],
+ });
+ const chunks = await Array.fromAsync(stream);
+
+ expect(chunks.filter((chunk) => chunk.type === "error")).toEqual([]);
+ expect(chunks).toContainEqual({
+ type: "tool-call",
+ toolCallId: "call-context",
+ toolName: "getRequestContext",
+ input: "{}",
+ });
+});