Skip to content

[Bug] Claude Sonnet-4.6 incompatibility with Agno agents (assistant prefill breaking change)Β #7015

Description

@parthiv-middleware

Description

πŸ› Issue: Claude Sonnet 4.6 Breaking Change – Assistant Prefill Not Supported

Overview

While migrating from claude-sonnet-4-5 to claude-sonnet-4-6, Agno agents and teams fail with a 400 error related to assistant message prefilling.

This issue appears to stem from a breaking change introduced in Claude Sonnet 4.6, where assistant message prefilling is no longer supported.


πŸ”— Reference (Official Migration Guide)

According to the official Anthropic migration guide:
https://platform.claude.com/docs/en/about-claude/models/migration-guide

"Prefilling assistant messages returns a 400 error on Sonnet 4.6. Use structured outputs, system prompt instructions, or output_config.format instead."


πŸ” Steps to Reproduce

  1. Create an Agno agent or team
  2. Configure the model as claude-sonnet-4-6
  3. Execute the agent or team workflow
  4. Observe failure with a 400 invalid_request_error

πŸ” Analysis

Agno appears to construct conversations where the final message role is assistant (e.g., agent outputs or internal chaining).

This pattern was valid in Claude Sonnet 4.5 but is now rejected in 4.6.

Claude Sonnet 4.6 Constraints:

  • Conversation must end with a user message
  • Assistant prefill is no longer supported

πŸ”„ Regression

This behavior worked correctly with:

  • claude-sonnet-4-5

Steps to Reproduce

  1. Create an Agno agent or team
  2. Configure the model as claude-sonnet-4-6
  3. Execute the agent or team workflow
  4. Observe failure with a 400 invalid_request_error

Agent Configuration (if applicable)

No response

Expected Behavior

Agno agents and teams should work seamlessly with Claude Sonnet 4.6 without requiring manual restructuring of message roles.

Actual Behavior

Execution fails with:

  • invalid_request_error
  • Message:
    "This model does not support assistant message prefill. The conversation must end with a user message."

Screenshots or Logs (if applicable)

ERROR Claude API error (status 400): Error code: 400 - {
'type': 'error',
'error': {
'type': 'invalid_request_error',
'message': 'This model does not support assistant message prefill. The conversation must end with a user message.'
}
}

ERROR Non-retryable model provider error: Error code: 400 - {
'type': 'error',
'error': {
'type': 'invalid_request_error',
'message': 'This model does not support assistant message prefill. The conversation must end with a user message.'
}
}

ERROR Error in Team run: Error code: 400 - {
'type': 'error',
'error': {
'type': 'invalid_request_error',
'message': 'This model does not support assistant message prefill. The conversation must end with a user message.'
}
}

Environment

- **Framework:** Agno  
- **Model:** claude-sonnet-4-6  
- **Provider:** Anthropic API  
- **OS:** Linux

Possible Solutions (optional)

  • Adapt Agno’s message construction to ensure the final role is user
  • OR provide built-in compatibility handling for Claude 4.6 models

Additional Context

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions