Four agent SDKs, one feature, and the line of code none of them deleted

In January 2026 my team built the same agent feature four times. The feature was an analyzer that reads the recent activity around a contact and proposes what to do next, with six tools running over byte-identical mock data: fetch email threads, fetch meeting summaries, two CRM lookups, draft an email, generate a meeting prep.

Once on the vanilla OpenAI SDK, where I wrote the agent loop by hand: send the conversation to the model, run whatever tool it asks for, append the result, ask again. Once on the OpenAI Agents SDK, once on Google's Agent Development Kit for TypeScript, and once on the raw Anthropic Messages API, standing in for the Claude Agent SDK.

The four orchestrators, meaning the files that hold the agent loop and the tool dispatch, differ at the import line. Below it, all four contain this:

const jsonMatch = content.match(/\{[\s\S]*\}/);
if (!jsonMatch) {
  throw new Error('No JSON found in model output');
}
const analysis = JSON.parse(jsonMatch[0]);

A greedy regular expression pulls the outermost pair of braces out of a text blob, then trusts that what falls out is the object the prompt asked for. It shows up twice in every orchestrator, once on the streaming path and once on the non-streaming path, ten occurrences across the five orchestrator files. All four SDKs advertise some form of structured output. None of the four prototypes used it.

The four differ visibly in the part you read about in the README, and behave alike in the part that produced every bug I found.

Where they really do differ

Tool definition is the part of an agent SDK you see in the README, and the marketing there is honest. Putting a schema next to the function that implements it is a real improvement, and writing the same signature four times is a real tax. Here is one tool, getEmailThreads, across the four:

ImplementationLinesPlaces
OpenAI Agents SDK21one
Google ADK for TypeScript20one
Vanilla OpenAI SDK32two (19 lines of JSON Schema, 13-line case in a dispatcher)
Raw Anthropic Messages APIthe same signature written out four timesfour

The Agents SDK version is a single tool({ name, description, parameters: z.object({...}), execute }) call, where z is Zod, the TypeScript schema library most of these frameworks have standardised on. That is worth having. It is also about fifteen lines of a two-thousand-line codebase.

That table needs a caveat before anyone picks a framework from it. Google's headline tool ergonomic is the one every article shows: you hand over a plain function and its docstring becomes the schema. That was Python-only at the time. The TypeScript package wanted new FunctionTool({ name, description, parameters: <hand-written JSON Schema>, func }), which is the vanilla OpenAI ergonomic with a constructor around it. On that row my comparison was Python ADK against TypeScript everything else. The flaw is in how I set the comparison up, not in the product.

The tool definition is the small half

I wrote the estimate in the comparison doc before any code existed. A hand-written agent loop would be roughly 150 to 200 lines, and the SDK version 50 to 80, because the framework owns the loop.

The hand-written orchestrator came in at 426 lines. The Agents SDK orchestrator came in at 518. The SDK version is 22 percent longer than the loop it replaced.

Whole-repo totals landed close together: 2,245 lines vanilla OpenAI, 2,268 Agents SDK, 2,418 raw Anthropic, 2,774 Google ADK. The framework did not save code. It moved it.

What owning the loop actually buys you

When you write the loop yourself, you hold a tool call and its result in the same scope. You call the tool, you get a value back, you push both into an array. The pairing is free because it never came apart.

When the framework owns the loop, you get an event stream instead, and reassembling it is your problem. All three framework-backed implementations paid for this, in three different ways.

On the Agents SDK non-streaming path, the only way to recover which tools ran and with what arguments was to walk result.rawResponses after the run had finished. Arguments came back. Results did not. The code I wrote records this:

toolCalls.push({
  name: toolName,
  arguments: parsedArgs,
  result: null, // Results are captured separately
});

They are not captured separately. The downstream function that lifts a drafted email out of the tool calls and into the final payload iterates looking for an entry with a non-null result, finds none, and returns cleanly. The agent drafts an email, the output contains no email, and nothing throws. I found it by grepping for null in the tool-call shapes.

The streaming path in the same file hand-rolls what the manual loop got for free: a pendingToolCalls Map keyed by call_id, plus a fallback branch that takes whichever entry happens to be first in the Map when the id does not match. That fallback is only correct when there is exactly one call in flight.

Google ADK's TypeScript version has the same class of bug in a different flavour. It matches a function response back to its call like this:

const call = toolCalls.find(
  (toolCall) => toolCall.name === response.name && toolCall.result === null
);

The match is name plus empty slot. That is wrong the first time the model calls the same tool twice in one turn, which for a tool like getEmailThreads is an ordinary thing to do.

Two independent frameworks produced the same failure for the same structural reason. Turning a loop into an event stream means someone has to put the events back together, and that someone is you.

The typing tells the same story. Zod gave me real types on the way into a tool, and the event stream handed them back as unknown:

if (rawItem && typeof rawItem === 'object' && 'name' in rawItem) {
  toolName = rawItem.name as string;
}

That cast appears once for the name, once for the arguments, and once for the call id.

A schema that validated nothing

The Anthropic implementation defines GetEmailThreadsSchema with z.string().email() on the participant and z.number().optional().default(10) on the limit. It looks like the most carefully typed tool file of the four.

The JSON Schema the model actually sees is built somewhere else entirely, by a hand-written getSchemaProperties() switch and a separate getRequiredProperties() switch in the orchestrator. Incoming arguments are cast with args as z.infer<typeof GetEmailThreadsSchema> and never .parse()d. There is no .parse() call anywhere in that implementation.

So the email-format validation exists in the repo and enforces nothing. The only code that reads the Zod object at all does this:

JSON.stringify(tool.inputSchema._def)

and pastes the result into the system prompt. _def is a private internal of the Zod library, serialised into text for a model to read.

That one is on the exercise rather than on a vendor. That prototype used the raw Messages API as a stand-in for the Claude Agent SDK, so what it shows is what happens when you hand-roll tool plumbing under time pressure, not how that SDK behaves.

The optional parameter we deleted

Our own tool-design note used getEmailThreads as the worked example of a self-describing tool, with four optional parameters so the model could narrow the query: participant domain, a since date, a limit, and whether to include tracking data.

The shipped Agents SDK version of that tool has exactly one required parameter and no optional ones. limit is gone from the schema, replaced by const limit = 10; in the body. A nested isDecisionMaker field that the vanilla implementation had left out of required became a plain z.boolean().

The scoring notes for that SDK list "optional Zod parameters require workarounds" as a known weakness. I could not verify the library mechanism behind that, since node_modules was never installed in any of the prototypes. Treat it as observed behaviour on that preview version plus a note we wrote at the time, rather than a claim about how the library works today. The workaround, in practice, was deletion. The SDK's own README example in the same repo still shows limit: z.number().optional(). We gave up an ergonomic the docs advertise, and the giving-up is invisible unless you diff against the earlier implementation.

Which half of this is mine

The manual loop passed request context to tools as an ordinary function argument. The Agents SDK version introduced a module-level mutable globalContext, with setToolContext() before the run and clearToolContext() after, which breaks the moment two runs overlap in the same process.

The Agents SDK ships RunContext<T> and run(agent, message, { context }) for exactly this. The prototype's own README documents it under "Context Variables (Dependency Injection)". I did not wire it up. The framework did not regress there. I skipped a README I had written a section of.

There is a bigger version of the same admission. We picked the OpenAI Agents SDK partly on its native support for pausing a run so a person can approve a tool call before it executes. Grepping all four source trees for needsApproval, interruption, RunState, handoff, guardrail and outputType returns nothing. The feature we chose it for is the one no prototype exercised.

The decision still holds up. The Agents SDK came third on the weighted scorecard and still won the write-up, on TypeScript maturity and that approval story. The write-up named AWS Strands, Amazon's agent framework, for a second look once its TypeScript SDK leaves preview. All of these were preview or near-preview builds in January 2026 and several of the ratings are already stale. I would make the same call again. I would just be honest that the code, and not the scorecard, is where the call came from.

What ported for free, and what did not

scenarios.ts, the mock data, was byte-identical across all four. prompts.ts was byte-identical between two of them. The shared type definitions were identical across three.

The prompt and the tool contract are portable. The orchestrator is not, and the orchestrator is where the bugs were.

So the rule I would give someone starting this evaluation next week is to stop scoring the tool-definition syntax, because it is fifteen lines and every candidate is fine at it. Score how you get a trace out. Write down, before you commit, how you will obtain the ordered list of tool calls with their arguments and their results paired correctly, on both the streaming and the non-streaming path, and what happens to that list when the same tool runs twice in one turn. If the answer involves walking a raw response array and casting, you have found the real cost of the framework.

And whichever one you pick, assume your own output parsing and your own tool-result bookkeeping will survive it. Ours did, in all four, down to the same regex.