Skip to content

sdk: make interpreterTool run code and answer provider tool calls - #85

Merged
karthik2804 merged 2 commits into
mainfrom
client-sdk-tools-cleanup
Nov 20, 2026
Merged

karthik2804 merged 2 commits into
mainfrom
client-sdk-tools-cleanup

Conversation

@karthik2804

Copy link
Copy Markdown
Collaborator

interpreterTool({ interpreters, policy }) now validates, runs, and formats each tool call, replacing the glue every app had to write. The interpreters' keys set the languages offered.

  • call/parse/run/execute cover raw input, validation, structured results, and Vercel AI SDK use.
  • sandbox.anthropic, .openai, and .openaiResponses give each provider's tool definition and a results() helper for its tool calls.
  • withPolicy() derives a tool with a merged policy (e.g. per conversation), the same way for every provider.
  • Errors go back to the model as isError output, naming bad fields.
  • zod is an optional peer dependency, exported only from /tools.
  • Fix the example's zod resolution on a fresh clone and regenerate the example lockfiles.

The schema and description the model sees are unchanged.

@karthik2804
karthik2804 force-pushed the client-sdk-tools-cleanup branch from f8ac1ca to 79660d4 Compare November 19, 2026 13:39
@karthik2804
karthik2804 changed the base branch from client-sdk-tools to main November 19, 2026 13:40
@karthik2804
karthik2804 force-pushed the client-sdk-tools-cleanup branch from 79660d4 to 5e95bdd Compare November 19, 2026 16:28

@thorstenhans thorstenhans left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

thorstenhans and others added 2 commits November 20, 2026 12:25
interpreterTool() now returns a strict Zod schema as inputSchema, which the
Vercel AI SDK consumes directly. toAnthropicTool(), toOpenAITool(), and the new
toToolDefinition() derive JSON Schema from it with z.toJSONSchema; hand-written
JSON Schema ToolDefinitions are still accepted.

- The derived schema and description are identical to the previous
  hand-written output for every language configuration, pinned by a golden
  fixture test.
- The input type narrows to the configured languages (no `dependencies` for
  Python-only tools).
- inputSchema.safeParse() rejects unknown fields such as allowedHosts,
  replacing hand-rolled argument checks in the ai-code-executor example.
- README documents Interpreter + tool setup for the Vercel AI SDK
  ToolLoopAgent and the Anthropic SDK.

interpreterTool({ interpreters, policy }) now validates, runs, and
formats each tool call, replacing the glue every app had to write.
The interpreters' keys set the languages offered.

- call/parse/run/execute cover raw input, validation, structured
  results, and Vercel AI SDK use.
- sandbox.anthropic, .openai, and .openaiResponses give each provider's
  tool definition and a results() helper for its tool calls.
- withPolicy() derives a tool with a merged policy (e.g. per
  conversation), the same way for every provider.
- Errors go back to the model as isError output, naming bad fields.
- zod is an optional peer dependency, exported only from /tools.
- Fix the example's zod resolution on a fresh clone and regenerate the
  example lockfiles.

The schema and description the model sees are unchanged.

Co-authored-by: Thorsten Hans <thorsten.hans@gmail.com>
Signed-off-by: Karthik Ganeshram <kganeshr@akamai.com>
Signed-off-by: Karthik Ganeshram <kganeshr@akamai.com>
@karthik2804
karthik2804 force-pushed the client-sdk-tools-cleanup branch from 5e95bdd to 5cdda29 Compare November 20, 2026 11:26
@karthik2804
karthik2804 merged commit 1a25ca4 into main Nov 20, 2026
6 checks passed
@karthik2804
karthik2804 deleted the client-sdk-tools-cleanup branch November 20, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants