Architecture & Patterns: Tool Calling + Structured Outputs¶
Production Patterns¶
Architecture View¶
graph LR
A[User request] --> B[Tool selection]
B --> C[Schema validation]
C --> D[Tool execution]
D --> E[Structured response]
Common Failure Modes¶
Common Failure Modes¶
- Executing tools before validating arguments.
- Unbounded repair loops that never terminate.
- Blending human-readable and machine-readable outputs unsafely.
Interview Q&A¶
Q: Interview Q: What belongs in a tool response envelope?
Include tool name, normalized inputs, result payload, status, and error metadata. This keeps tracing and retries deterministic.
Q: Interview Q: When should you stop repair attempts?
Stop after a small fixed retry count or when error type repeats. Return safe fallback to avoid infinite correction loops.