Skip to content

Commit 4105fd6

Browse files
stainless-app[bot]dtmeadowsfelixfbeckermikecluck
authored
chore: release main (#973)
Co-authored-by: dtmeadows <dmeadows@stainless.com> Co-authored-by: Felix Becker <felix@anthropic.com> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: Mike Cluck <mcluck90@gmail.com>
1 parent 0b536ae commit 4105fd6

File tree

21 files changed

+517
-104
lines changed

21 files changed

+517
-104
lines changed

.release-please-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
".": "0.83.0",
2+
".": "0.84.0",
33
"packages/vertex-sdk": "0.15.0",
44
"packages/bedrock-sdk": "0.27.0",
55
"packages/foundry-sdk": "0.2.3",
6-
"packages/aws-sdk": "0.2.1"
6+
"packages/aws-sdk": "0.2.2"
77
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 34
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-efe26b096126c693462514b8cbd3ec3e376569232becbfb730cd26fb31c7c7e3.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-04225437444990f383d0581df2f07022baab6ad510de0f3a8bd6b07c38d83cc9.yml
33
openapi_spec_hash: cae9199aabfd7b87f0ff2dcc10760c92
4-
config_hash: 7aaaa92e479b2962424ce93d7d24e004
4+
config_hash: fcc34074db6eaf64bc99b578c6c82c61

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 0.84.0 (2026-04-07)
4+
5+
Full Changelog: [sdk-v0.83.0...sdk-v0.84.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.83.0...sdk-v0.84.0)
6+
7+
### Features
8+
9+
* **api:** Add support for claude-mythos-preview ([d4057b0](https://github.com/anthropics/anthropic-sdk-typescript/commit/d4057b0a9559d9a620e6a398a4199f5a416bc7a6))
10+
* **tools:** add AbortSignal support for tool runner ([#848](https://github.com/anthropics/anthropic-sdk-typescript/issues/848)) ([972d591](https://github.com/anthropics/anthropic-sdk-typescript/commit/972d5918a4d24b15686c8c407860cbfed4215ffa))
11+
312
## 0.83.0 (2026-04-03)
413

514
Full Changelog: [sdk-v0.82.0...sdk-v0.83.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.82.0...sdk-v0.83.0)

helpers.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,48 @@ console.log(await runner);
256256
See [`examples/tools-helpers-advanced-streaming.ts`](examples/tools-helpers-advanced-streaming.ts) for a more
257257
in-depth example.
258258
259+
#### Cancellation
260+
261+
The `BetaToolRunner` supports cancellation via `AbortSignal`. The signal is passed to both API calls and tool `run` methods via the `BetaToolRunContext`.
262+
263+
```ts
264+
const controller = new AbortController();
265+
266+
const runner = anthropic.beta.messages.toolRunner(
267+
{
268+
model: 'claude-sonnet-4-5-20250929',
269+
max_tokens: 1000,
270+
messages: [{ role: 'user', content: 'Do a long task' }],
271+
tools: [
272+
betaZodTool({
273+
name: 'long_task',
274+
inputSchema: z.object({ query: z.string() }),
275+
description: 'A long-running task',
276+
run: async (input, context) => {
277+
// Throws AbortError if already cancelled before run() was called
278+
context?.signal?.throwIfAborted();
279+
// Pass the signal to downstream operations for mid-flight cancellation
280+
const result = await fetch(url, { signal: context?.signal });
281+
return result.text();
282+
},
283+
}),
284+
],
285+
},
286+
{ signal: controller.signal },
287+
);
288+
289+
// Cancel after 5 seconds
290+
setTimeout(() => controller.abort(), 5000);
291+
292+
const finalMessage = await runner;
293+
```
294+
295+
You can also set or update the signal after creating the runner:
296+
297+
```ts
298+
runner.setRequestOptions({ signal: controller.signal });
299+
```
300+
259301
### `betaZodTool`
260302
261303
Zod schemas can be used to define the input schema for your tools:
@@ -386,9 +428,25 @@ runner.pushMessages(
386428
);
387429
```
388430
389-
#### `BetaToolRunner.generateToolResponse()`
431+
#### `BetaToolRunner.setRequestOptions()`
432+
433+
Updates the request options (e.g., headers, abort signal) for future API calls and tool executions.
434+
435+
```ts
436+
// Direct options update
437+
const controller = new AbortController();
438+
runner.setRequestOptions({ signal: controller.signal });
439+
440+
// Using mutator function to preserve existing options
441+
runner.setRequestOptions((prev) => ({
442+
...prev,
443+
signal: controller.signal,
444+
}));
445+
```
446+
447+
#### `BetaToolRunner.generateToolResponse(signal?)`
390448
391-
Gets the tool response for the last assistant message (if any tools need to be executed).
449+
Gets the tool response for the last assistant message (if any tools need to be executed). Accepts an optional `AbortSignal` parameter that will be passed to tool `run` methods; defaults to the signal from request options.
392450
393451
```ts
394452
for await (const message of runner) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@anthropic-ai/sdk",
3-
"version": "0.83.0",
3+
"version": "0.84.0",
44
"description": "The official TypeScript library for the Anthropic API",
55
"author": "Anthropic <support@anthropic.com>",
66
"types": "dist/index.d.ts",

packages/aws-sdk/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 0.2.2 (2026-04-07)
4+
5+
Full Changelog: [aws-sdk-v0.2.1...aws-sdk-v0.2.2](https://github.com/anthropics/anthropic-sdk-typescript/compare/aws-sdk-v0.2.1...aws-sdk-v0.2.2)
6+
7+
### Chores
8+
9+
* **internal:** version bump ([eb97e85](https://github.com/anthropics/anthropic-sdk-typescript/commit/eb97e8577279fb150582297d2a0924a297185c3c))
10+
* **internal:** version bump ([8ebaf61](https://github.com/anthropics/anthropic-sdk-typescript/commit/8ebaf616d2e5c6aebc153f19a403dde41ab5a9f1))
11+
312
## 0.2.1 (2026-04-03)
413

514
Full Changelog: [aws-sdk-v0.2.0...aws-sdk-v0.2.1](https://github.com/anthropics/anthropic-sdk-typescript/compare/aws-sdk-v0.2.0...aws-sdk-v0.2.1)

packages/aws-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@anthropic-ai/aws-sdk",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"description": "The official TypeScript library for the Anthropic AWS API",
55
"author": "Anthropic <support@anthropic.com>",
66
"types": "dist/index.d.ts",

packages/vertex-sdk/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
"@anthropic-ai/sdk@file:../../dist":
1919
# x-release-please-start-version
20-
version "0.83.0"
20+
version "0.84.0"
2121
# x-release-please-end-version
2222
dependencies:
2323
json-schema-to-ts "^3.1.1"

src/helpers/beta/json-schema.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
2-
import { Promisable, BetaRunnableTool } from '../../lib/tools/BetaRunnableTool';
2+
import { Promisable, BetaRunnableTool, BetaToolRunContext } from '../../lib/tools/BetaRunnableTool';
33
import { BetaToolResultContentBlockParam } from '../../resources/beta';
44
import { AutoParseableBetaOutputFormat } from '../../lib/beta-parser';
55
import { AnthropicError } from '../..';
@@ -16,7 +16,10 @@ export function betaTool<const Schema extends Exclude<JSONSchema, boolean> & { t
1616
name: string;
1717
inputSchema: Schema;
1818
description: string;
19-
run: (args: NoInfer<FromSchema<Schema>>) => Promisable<string | Array<BetaToolResultContentBlockParam>>;
19+
run: (
20+
args: NoInfer<FromSchema<Schema>>,
21+
context?: BetaToolRunContext,
22+
) => Promisable<string | Array<BetaToolResultContentBlockParam>>;
2023
}): BetaRunnableTool<NoInfer<FromSchema<Schema>>> {
2124
if (options.inputSchema.type !== 'object') {
2225
throw new Error(

src/helpers/beta/zod.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { infer as zodInfer, ZodType } from 'zod';
33
import * as z from 'zod/v4';
44
import { AnthropicError } from '../../core/error';
55
import { AutoParseableBetaOutputFormat } from '../../lib/beta-parser';
6-
import { BetaRunnableTool, Promisable } from '../../lib/tools/BetaRunnableTool';
6+
import { BetaRunnableTool, BetaToolRunContext, Promisable } from '../../lib/tools/BetaRunnableTool';
77
import { BetaToolResultContentBlockParam } from '../../resources/beta';
88
/**
99
* Creates a JSON schema output format object from the given Zod schema.
@@ -50,7 +50,10 @@ export function betaZodTool<InputSchema extends ZodType>(options: {
5050
name: string;
5151
inputSchema: InputSchema;
5252
description: string;
53-
run: (args: zodInfer<InputSchema>) => Promisable<string | Array<BetaToolResultContentBlockParam>>;
53+
run: (
54+
args: zodInfer<InputSchema>,
55+
context?: BetaToolRunContext,
56+
) => Promisable<string | Array<BetaToolResultContentBlockParam>>;
5457
}): BetaRunnableTool<zodInfer<InputSchema>> {
5558
const jsonSchema = z.toJSONSchema(options.inputSchema, { reused: 'ref' });
5659

0 commit comments

Comments
 (0)