Skip to content

Support structured output for newer Anthropic models #340

Description

@aoki-ryusei

First of all, thank you for maintaining this awesome library!

I'm using the Anthropic provider with Active Agent.

Currently, structured output for the Anthropic provider appears to be implemented using the prompt engineering technique with prefilled responses.

However, starting with Claude Sonnet 4.5/4.6, prefilled responses are no longer supported, and requests using this approach now return a 400 error.

Reference:
https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#migrating-away-from-prefilled-responses

Problem

As a result, structured output does not work with the latest Claude models.

Proposal

It would be great to support Anthropic's current structured output approach instead of relying on prefilled responses.

I've already prepared a PR with a proposed implementation. If this direction looks good, I'd really appreciate your feedback.

PR: #339

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions