Skip to content
Effect Days 2026 Get your ticket

@effect/ai-amazon-bedrock

0.17.0

Patch Changes

  • Updated dependencies [fffdee0]:
    • effect@3.22.0
    • @effect/ai@0.37.0
    • @effect/ai-anthropic@0.27.0
    • @effect/experimental@0.61.0
    • @effect/platform@0.97.0

0.16.1

Patch Changes

  • #6272 1876254 Thanks @tsushanth! - Fix @effect/ai-amazon-bedrock streaming so the terminal "finish" part carries real token counts. The Bedrock Converse stream sends metadata (with the populated usage block) after messageStop, but the SDK was emitting "finish" synchronously on messageStop, capturing the still-empty usage defaults. Buffer the finish reason on messageStop and emit "finish" from the metadata case once inputTokens / outputTokens / totalTokens are filled in.

  • Updated dependencies [8222963, 7e00169]:

    • effect@3.21.4
    • @effect/platform@0.96.2

0.16.0

Patch Changes

  • Updated dependencies [02ae8fb, e2126bc, f7e836e]:
    • @effect/ai@0.36.0
    • effect@3.21.3
    • @effect/ai-anthropic@0.26.0

0.15.1

Patch Changes

  • #6206 13c8207 Thanks @Zelys-DFKH! - generateObject no longer fails when extended thinking is configured via withConfigOverride. Anthropic’s API rejects requests that set thinking in additionalModelRequestFields alongside a forced toolChoice — which generateObject always does. The fix strips thinking from additionalModelRequestFields in the json response format path before the request is sent.

  • Updated dependencies []:

    • @effect/ai-anthropic@0.25.0
    • @effect/experimental@0.60.0

0.15.0

Patch Changes

  • Updated dependencies [f7bb09b, bd7552a, ad1a7eb, 0d32048, 0d32048]:
    • effect@3.21.0
    • @effect/ai@0.35.0
    • @effect/ai-anthropic@0.25.0
    • @effect/experimental@0.60.0
    • @effect/platform@0.96.0

0.14.0

Patch Changes

  • Updated dependencies [fc82e81, 82996bc, 4d97a61, f6b0960, 8798a84]:
    • effect@3.20.0
    • @effect/ai@0.34.0
    • @effect/ai-anthropic@0.24.0
    • @effect/experimental@0.59.0
    • @effect/platform@0.95.0

0.13.0

Patch Changes

  • Updated dependencies [77eeb86, ff7053f, 287c32c]:
    • effect@3.19.13
    • @effect/platform@0.94.0
    • @effect/ai@0.33.0
    • @effect/ai-anthropic@0.23.0
    • @effect/experimental@0.58.0

0.12.1

Patch Changes

  • #5891 b1ffd22 Thanks @sbking! - fix cache point support for user and tool messages

  • Updated dependencies [65bff45]:

    • @effect/platform@0.93.7

0.12.0

Patch Changes

  • Updated dependencies [3c15d5f, 3863fa8, 2a03c76, 24a1685]:
    • effect@3.19.0
    • @effect/platform@0.93.0
    • @effect/ai@0.32.0
    • @effect/ai-anthropic@0.22.0
    • @effect/experimental@0.57.0

0.11.0

Minor Changes

  • #5621 4c3bdfb Thanks @IMax153! - Remove Either / EitherEncoded from tool call results.

    Specifically, the encoding of tool call results as an Either / EitherEncoded has been removed and is replaced by encoding the tool call success / failure directly into the result property.

    To allow type-safe discrimination between a tool call result which was a success vs. one that was a failure, an isFailure property has also been added to the "tool-result" part. If isFailure is true, then the tool call handler result was an error.

    import * as AnthropicClient from "@effect/ai-anthropic/AnthropicClient"
    import * as AnthropicLanguageModel from "@effect/ai-anthropic/AnthropicLanguageModel"
    import * as LanguageModel from "@effect/ai/LanguageModel"
    import * as Tool from "@effect/ai/Tool"
    import * as Toolkit from "@effect/ai/Toolkit"
    import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient"
    import { Config, Effect, Layer, Schema, Stream } from "effect"
    const Claude = AnthropicLanguageModel.model("claude-4-sonnet-20250514")
    const MyTool = Tool.make("MyTool", {
    description: "An example of a tool with success and failure types",
    failureMode: "return", // Return errors in the response
    parameters: { bar: Schema.Number },
    success: Schema.Number,
    failure: Schema.Struct({ reason: Schema.Literal("reason-1", "reason-2") })
    })
    const MyToolkit = Toolkit.make(MyTool)
    const MyToolkitLayer = MyToolkit.toLayer({
    MyTool: () => Effect.succeed(42)
    })
    const program = LanguageModel.streamText({
    prompt: "Tell me about the meaning of life",
    toolkit: MyToolkit
    }).pipe(
    Stream.runForEach((part) => {
    if (part.type === "tool-result" && part.name === "MyTool") {
    // The `isFailure` property can be used to discriminate whether the result
    // of a tool call is a success or a failure
    if (part.isFailure) {
    part.result
    // ^? { readonly reason: "reason-1" | "reason-2"; }
    } else {
    part.result
    // ^? number
    }
    }
    return Effect.void
    }),
    Effect.provide(Claude)
    )
    const Anthropic = AnthropicClient.layerConfig({
    apiKey: Config.redacted("ANTHROPIC_API_KEY")
    }).pipe(Layer.provide(NodeHttpClient.layerUndici))
    program.pipe(Effect.provide([Anthropic, MyToolkitLayer]), Effect.runPromise)

Patch Changes

  • Updated dependencies [4c3bdfb]:
    • @effect/ai-anthropic@0.21.0
    • @effect/ai@0.31.0

0.10.0

Minor Changes

  • #5614 c63e658 Thanks @IMax153! - Previously, tool call handler errors were always raised as an expected error in the Effect E channel at the point of execution of the tool call handler (i.e. when a generate* method is invoked on a LanguageModel).

    With this PR, the end user now has control over whether tool call handler errors should be raised as an Effect error, or returned by the SDK to allow, for example, sending that error information to another application.

    Tool Call Specification

    The Tool.make and Tool.providerDefined constructors now take an extra optional parameter called failureMode, which can be set to either "error" or "return".

    import { Tool } from "@effect/ai"
    import { Schema } from "effect"
    const MyTool = Tool.make("MyTool", {
    description: "My special tool",
    failureMode: "return" // "error" (default) or "return"
    parameters: {
    myParam: Schema.String
    },
    success: Schema.Struct({
    mySuccess: Schema.String
    }),
    failure: Schema.Struct({
    myFailure: Schema.String
    })
    })

    The semantics of failureMode are as follows:

    • If set to "error" (the default), errors that occur during tool call handler execution will be returned in the error channel of the calling effect
    • If set to "return", errors that occur during tool call handler execution will be captured and returned as part of the tool call result

    Response - Tool Result Parts

    The result field of a "tool-result" part of a large language model provider response is now represented as an Either.

    • If the result is a Left, the result will be the failure specified in the tool call specification
    • If the result is a Right, the result will be the success specified in the tool call specification

    This is only relevant if the end user sets failureMode to "return". If set to "error" (the default), then the result property will always be a Right with the successful result of the tool call handler.

    Similarly the encodedResult field of a "tool-result" part will be represented as an EitherEncoded, where:

    • { _tag: "Left", left: <failure> } represents a tool call handler failure
    • { _tag: "Right", right: <success> } represents a tool call handler success

    Prompt - Tool Result Parts

    The result field of a "tool-result" part of a prompt will now only accept an EitherEncoded as specified above.

Patch Changes

  • Updated dependencies [1d2e92d, 6ae2f5d, c63e658]:
    • @effect/ai-anthropic@0.20.0
    • effect@3.18.4
    • @effect/ai@0.30.0

0.9.0

Patch Changes

  • Updated dependencies [1c6ab74, 70fe803, c296e32, a098ddf, f8b93ac]:
    • effect@3.18.0
    • @effect/ai@0.29.0
    • @effect/platform@0.92.0
    • @effect/ai-anthropic@0.19.0
    • @effect/experimental@0.56.0

0.8.1

Patch Changes

  • #5571 122aa53 Thanks @IMax153! - Ensure that AI provider clients filter response status for stream requests

  • Updated dependencies [122aa53]:

    • @effect/ai-anthropic@0.18.2

0.8.0

Patch Changes

  • Updated dependencies [d4d86a8]:
    • @effect/platform@0.91.0
    • @effect/ai@0.28.0
    • @effect/ai-anthropic@0.18.0
    • @effect/experimental@0.55.0

0.7.1

Patch Changes

  • #5521 fa49bc8 Thanks @IMax153! - Fix provider metadata and parse tool call parameters safely

  • Updated dependencies [fa49bc8]:

    • @effect/ai-anthropic@0.17.1
    • @effect/ai@0.27.1

0.7.0

Minor Changes

  • #5469 42b914a Thanks @IMax153! - Refactor the Effect AI SDK and associated provider packages

    This pull request contains a complete refactor of the base Effect AI SDK package as well as the associated provider integration packages to improve flexibility and enhance ergonomics. Major changes are outlined below.

    Modules

    All modules in the base Effect AI SDK have had the leading Ai prefix dropped from their name (except for the AiError module).

    For example, the AiLanguageModel module is now the LanguageModel module.

    In addition, the AiInput module has been renamed to the Prompt module.

    Prompts

    The Prompt module has been completely redesigned with flexibility in mind.

    The Prompt module now supports building a prompt using either the constructors exposed from the Prompt module, or using raw prompt content parts / messages, which should be familiar to those coming from other AI SDKs.

    In addition, the system option has been removed from all LanguageModel methods and must now be provided as part of the prompt.

    Prompt Constructors

    import { LanguageModel, Prompt } from "@effect/ai"
    const textPart = Prompt.makePart("text", {
    text: "What is machine learning?"
    })
    const userMessage = Prompt.makeMessage("user", {
    content: [textPart]
    })
    const systemMessage = Prompt.makeMessage("system", {
    content: "You are an expert in machine learning"
    })
    const program = LanguageModel.generateText({
    prompt: Prompt.fromMessages([systemMessage, userMessage])
    })

    Raw Prompt Input

    import { LanguageModel } from "@effect/ai"
    const program = LanguageModel.generateText({
    prompt: [
    { role: "system", content: "You are an expert in machine learning" },
    {
    role: "user",
    content: [{ type: "text", text: "What is machine learning?" }]
    }
    ]
    })

    NOTE: Providing a plain string as a prompt is still supported, and will be converted internally into a user message with a single text content part.

    Provider-Specific Options

    To support specification of provider-specific options when interacting with large language model providers, support has been added for adding provider-specific options to the parts of a Prompt.

    import { LanguageModel } from "@effect/ai"
    import { AnthropicLanguageModel } from "@effect/ai-anthropic"
    const Claude = AnthropicLanguageModel.model("claude-sonnet-4-20250514")
    const program = LanguageModel.generateText({
    prompt: [
    {
    role: "user",
    content: [{ type: "text", text: "What is machine learning?" }],
    options: {
    anthropic: { cacheControl: { type: "ephemeral", ttl: "1h" } }
    }
    }
    ]
    }).pipe(Effect.provide(Claude))

    Responses

    The Response module has also been completely redesigned to support a wider variety of response parts, particularly when streaming.

    Streaming Responses

    When streaming text via the LanguageModel.streamText method, you will now receive a stream of content parts instead of a stream of responses, which should make it much simpler to filter down the stream to the parts you are interested in.

    In addition, additional content parts will be present in the stream to allow you to track, for example, when a text content part starts / ends.

    Tool Calls / Tool Call Results

    The decoded parts of a Response (as returned by the methods of LanguageModel) are now fully type-safe on tool calls / tool call results. Filtering the content parts of a response to tool calls will narrow the type of the tool call params based on the tool name. Similarly, filtering the response to tool call results will narrow the type of the tool call result based on the tool name.

    import { LanguageModel, Tool, Toolkit } from "@effect/ai"
    import { Effect, Schema } from "effect"
    const DadJokeTool = Tool.make("DadJokeTool", {
    parameters: { topic: Schema.String },
    success: Schema.Struct({ joke: Schema.String })
    })
    const FooTool = Tool.make("FooTool", {
    parameters: { foo: Schema.Number },
    success: Schema.Struct({ bar: Schema.Boolean })
    })
    const MyToolkit = Toolkit.make(DadJokeTool, FooTool)
    const program = Effect.gen(function* () {
    const response = yield* LanguageModel.generateText({
    prompt: "Tell me a dad joke",
    toolkit: MyToolkit
    })
    for (const toolCall of response.toolCalls) {
    if (toolCall.name === "DadJokeTool") {
    // ^? "DadJokeTool" | "FooTool"
    toolCall.params
    // ^? { readonly topic: string }
    }
    }
    for (const toolResult of response.toolResults) {
    if (toolResult.name === "DadJokeTool") {
    // ^? "DadJokeTool" | "FooTool"
    toolResult.result
    // ^? { readonly joke: string }
    }
    }
    })

    Provider Metadata

    As with provider-specific options, provider-specific metadata is now returned as part of the response from the large language model provider.

    import { LanguageModel } from "@effect/ai"
    import { AnthropicLanguageModel } from "@effect/ai-anthropic"
    import { Effect } from "effect"
    const Claude = AnthropicLanguageModel.model("claude-4-sonnet-20250514")
    const program = Effect.gen(function* () {
    const response = yield* LanguageModel.generateText({
    prompt: "What is the meaning of life?"
    })
    for (const part of response.content) {
    // When metadata **is not** defined for a content part, accessing the
    // provider's key on the part's metadata will return an untyped record
    if (part.type === "text") {
    const metadata = part.metadata.anthropic
    // ^? { readonly [x: string]: unknown } | undefined
    }
    // When metadata **is** defined for a content part, accessing the
    // provider's key on the part's metadata will return typed metadata
    if (part.type === "reasoning") {
    const metadata = part.metadata.anthropic
    // ^? AnthropicReasoningInfo | undefined
    }
    }
    }).pipe(Effect.provide(Claude))

    Tool Calls

    The Tool module has been enhanced to support provider-defined tools (e.g. web search, computer use, etc.). Large language model providers which support calling their own tools now have a separate module present in their provider integration packages which contain definitions for their tools.

    These provider-defined tools can be included alongside user-defined tools in existing Toolkits. Provider-defined tools that require a user-space handler will be raise a type error in the associated Toolkit layer if no such handler is defined.

    import { LanguageModel, Tool, Toolkit } from "@effect/ai"
    import { AnthropicTool } from "@effect/ai-anthropic"
    import { Schema } from "effect"
    const DadJokeTool = Tool.make("DadJokeTool", {
    parameters: { topic: Schema.String },
    success: Schema.Struct({ joke: Schema.String })
    })
    const MyToolkit = Toolkit.make(
    DadJokeTool,
    AnthropicTool.WebSearch_20250305({ max_uses: 1 })
    )
    const program = LanguageModel.generateText({
    prompt: "Search the web for a dad joke",
    toolkit: MyToolkit
    })

    AiError

    The AiError type has been refactored into a union of different error types which can be raised by the Effect AI SDK. The goal of defining separate error types is to allow providing the end-user with more granular information about the error that occurred.

    For now, the following errors have been defined. More error types may be added over time based upon necessity / use case.

    type AiError =
    | HttpRequestError,
    | HttpResponseError,
    | MalformedInput,
    | MalformedOutput,
    | UnknownError

Patch Changes

  • Updated dependencies [42b914a]:
    • @effect/ai-anthropic@0.17.0
    • @effect/ai@0.27.0

0.6.2

Patch Changes

  • #5438 0065a12 Thanks @IMax153! - Fix the InferenceConfiguration schema in the Amazon Bedrock AI provider package

  • Updated dependencies [3b26094, a33e491]:

    • effect@3.17.10

0.6.1

Patch Changes

  • #5424 3a8ba9b Thanks @IMax153! - Fix system content block structure for Amazon Bedrock AiLanguageModel

  • Updated dependencies [0271f14]:

    • effect@3.17.9

0.6.0

Patch Changes

  • Updated dependencies []:
    • @effect/ai@0.26.0
    • @effect/experimental@0.54.6

0.5.0

Patch Changes

  • Updated dependencies [5a0f4f1]:
    • effect@3.17.1
    • @effect/ai@0.25.0
    • @effect/experimental@0.54.0

0.4.0

Patch Changes

  • Updated dependencies [7813640]:
    • @effect/platform@0.90.0
    • @effect/ai@0.24.0
    • @effect/experimental@0.54.0

0.3.0

Patch Changes

0.2.1

Patch Changes

  • Updated dependencies [f5dfabf, 17a5ea8, d25f22b]:
    • effect@3.16.14
    • @effect/platform@0.88.1
    • @effect/experimental@0.52.1
    • @effect/ai@0.22.1

0.2.0

Patch Changes

  • Updated dependencies [27206d7, dbabf5e]:
    • @effect/platform@0.88.0
    • @effect/ai@0.22.0
    • @effect/experimental@0.52.0

0.1.14

Patch Changes

  • Updated dependencies [c1c05a8, 81fe4a2]:
    • effect@3.16.13
    • @effect/ai@0.21.17
    • @effect/experimental@0.51.14
    • @effect/platform@0.87.13

0.1.13

Patch Changes

  • #5186 e5692ab Thanks @IMax153! - Do not use Config.Wrap for AI provider layerConfig

  • Updated dependencies [32ba77a, d5e25b2]:

    • @effect/platform@0.87.12
    • @effect/ai@0.21.16
    • @effect/experimental@0.51.13

0.1.12

Patch Changes

  • Updated dependencies [001392b, 7bfb099]:
    • @effect/platform@0.87.11
    • @effect/ai@0.21.15
    • @effect/experimental@0.51.12

0.1.11

Patch Changes

  • Updated dependencies [678318d, 678318d]:
    • @effect/platform@0.87.10
    • @effect/ai@0.21.14
    • @effect/experimental@0.51.11

0.1.10

Patch Changes

  • Updated dependencies [54514a2]:
    • @effect/platform@0.87.9
    • @effect/ai@0.21.13
    • @effect/experimental@0.51.10

0.1.9

Patch Changes

  • Updated dependencies [4ce4f82]:
    • @effect/platform@0.87.8
    • @effect/experimental@0.51.9
    • @effect/ai@0.21.12

0.1.8

Patch Changes

0.1.7

Patch Changes

  • Updated dependencies [a9b617f, 7e26e86]:
    • @effect/platform@0.87.7
    • @effect/ai@0.21.10
    • @effect/experimental@0.51.8

0.1.6

Patch Changes

  • Updated dependencies [030ac21, 905da99, aaae9b1]:
    • @effect/ai@0.21.9
    • effect@3.16.12
    • @effect/experimental@0.51.7
    • @effect/platform@0.87.6

0.1.5

Patch Changes

  • Updated dependencies [96c1292]:
    • @effect/experimental@0.51.6
    • @effect/ai@0.21.8

0.1.4

Patch Changes

  • Updated dependencies [2fd8676]:
    • @effect/platform@0.87.5
    • @effect/ai@0.21.7
    • @effect/experimental@0.51.5

0.1.3

Patch Changes

  • Updated dependencies [e82a4fd]:
    • @effect/platform@0.87.4
    • @effect/ai@0.21.6
    • @effect/experimental@0.51.4

0.1.2

Patch Changes

  • Updated dependencies [1b6e396]:
    • @effect/platform@0.87.3
    • @effect/ai@0.21.5
    • @effect/experimental@0.51.3

0.1.1

Patch Changes

  • Updated dependencies [4fea68c, b927954, 99590a6, 6c3e24c]:
    • @effect/platform@0.87.2
    • effect@3.16.11
    • @effect/ai@0.21.4
    • @effect/experimental@0.51.2

0.1.0

Minor Changes

  • #5020 530aa65 Thanks @IMax153! - add Amazon Bedrock AI provider package