Skip to content

[BUG] OpenRouter xAI Grok 4.1 Fast doesn't comply with response format in agent block #2917

@PlaneInABottle

Description

@PlaneInABottle

Issue Description

When using OpenRouter model xAI: Grok 4.1 Fast with a response format configured in an agent block, the model fails to comply with the specified response format and generates its own response instead.

Error Messages

  1. "file_key" doesn't exist on block "agent". Available fields: model, tokens, content, toolCalls, responseFormat

    • Note: file_key is a field defined in the custom response format specification
  2. "_responseFormatWarning": "LLM did not adhere to the specified structured response format. Expected valid JSON but received malformed content. Falling back to standard format."

Expected Behavior

The model should:

  • Adhere to the specified structured response format provided in the agent block configuration
  • Generate output that includes the file_key field as defined in the response format
  • Return valid JSON matching the schema

Actual Behavior

  • The model generates its own response format instead of following the specified structure
  • The file_key field specified in the response format is not present in the output
  • A fallback to standard format occurs due to malformed/non-compliant content
  • Error indicates the custom field doesn't exist in the block output

Environment

  • Model: xAI: Grok 4.1 Fast (via OpenRouter)
  • Block Type: Agent
  • Response Format: Custom format with file_key field defined

Reproduction

  1. Create an agent block with xAI: Grok 4.1 Fast model via OpenRouter
  2. Configure a custom response format that includes a file_key field
  3. Execute the workflow
  4. Observe the response format non-compliance warning and missing field error

Additional Context

This appears to be a model-specific issue where Grok 4.1 Fast through OpenRouter may not properly support structured output/response formats, resulting in the model ignoring the schema and generating its own response structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions