Skip to content

References: Schemas that refuse to lie

This lesson’s platform facts (the tool choice modes, strict mode and its token-level mechanism, the structured outputs feature, and the edge cases where shape can still break) come from Anthropic’s public platform documentation, current as of this lesson’s last review. The invoice extraction example, the required-plus-nullable argument, the enum escape-hatch pattern, and the retry judgment are Clawdemy’s own synthesis.

  • Strict tool use, Claude Developer Platform documentation. The guarantee at the center of this lesson. The page states that strict mode achieves schema conformance “by constraining the model’s token sampling to schema-valid outputs (a technique called grammar-constrained sampling)”, and documents what is guaranteed: tool input strictly follows the input schema, and the tool name is always valid.
  • Structured outputs, Claude Developer Platform documentation. The whole-response counterpart, configured through the output configuration field (output_config), plus the supported JSON Schema subset and the honesty this lesson leans on about the guarantee’s edges: “While structured outputs guarantee schema compliance in most cases, there are scenarios where the output may not match your schema”, specifically safety refusals and responses cut off by the token limit.
  • Tool use with Claude, Claude Developer Platform documentation. The overview this lesson’s mechanics rest on: tool definitions with an input schema, when the model calls tools under the default auto mode, and the pointer to forcing tool use with the tool choice parameter.
  • Building with the Claude API, Anthropic Academy. Free, self-paced official course covering the full span of working with Anthropic models through the API, including tools and structured output, a structured companion to this track.
  • Define tools, Claude Developer Platform documentation. Schema authoring, description writing, and controlling when Claude calls your tools, which is exactly where this lesson hands off to lesson 4.
  • Tool use, the foundation (Track 22). The mechanics this lesson presumes: defining a tool, the four-step loop, the tool choice options, and the tool-use versus structured-outputs distinction.
  • Thinking like an architect (this track, lesson 1). The decide-versus-enforce spine this lesson applies to output shape.
  • The next lesson in this track is the other half of the tool contract: designing the tools themselves, where descriptions, boundaries, and error messages determine whether an agent uses your tools the way you meant.
  • If the retry-and-escalation boundary interested you most, lesson 6 on reliability is where the human queue this lesson gestures at gets designed properly.