Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.narrative.io/llms.txt

Use this file to discover all available pages before exploring further.

Surface: GET /agents/runs/{id}, error.type = "AgentLoopSchemaDecodeFailed"

When this error occurs

When the model produces a final answer (no tool calls, just a content message), the workflow parses the content against effective_config.output_format_schema and extracts the text field. This error means the parse failed:
  • The model returned plain prose instead of the structured object the schema expected.
  • The object was structurally valid but missed a required field.
  • The model returned multiple text blocks; only the first is considered.

How to fix

  • Tighten the system prompt — explicitly tell the model “respond with a JSON object matching this schema; do not include any other text.” Models often add prose when the schema isn’t reinforced in instructions.
  • Simplify the schema — if the schema requires nested structure, consider asking the model for a single text field and post-processing.
  • Increase max_tokens — sometimes the model is truncated mid-JSON.
  • Inspect the last assistant turn in the message stream to see exactly what the model produced.