Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Compare OpenAI function calling, Anthropic tool use (tool_use block), and ReAct free-form text parsing as mechanisms for an LLM agent to invoke tools. For each, describe its reliability profile and key tradeoff.
Native function calling emits trained-in structured JSON the provider validates; ReAct parses free-form text and is brittle; constrained decoding forces schema-valid output by construction.
Imagine asking an assistant to fill out a form so a machine can read it. One way: hand them a printed form with labeled boxes, so they almost always write neatly in the right slots. That is native function calling. Another way: let them scribble the request in a sentence, then you squint and try to pull out the name and numbers yourself. That is free-form text parsing, and it breaks the moment they phrase it oddly. A third way: use a special pen that physically cannot write outside the boxes, so the form is always valid. That is constrained decoding. The first and third are reliable because the structure is built in. The middle one is flexible but fragile, because you are guessing at someone's handwriting every single time.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define the three mechanisms, place each on the trained-in to runtime-parsed spectrum, give the reliability profile and tradeoff for each, then explain why the 2026 default is native calling plus a validation layer with constrained decoding for open weights.
| Mechanism | Where structure comes from | Reliability | Key tradeoff |
|---|---|---|---|
| Native function calling | Trained-in plus provider schema check | High | Provider lock-in; vendor-specific schema formats |
| ReAct free-form text | Runtime string parsing | Lower; drifts and hallucinates | Fragile; needs robust parser and retries |
| Constrained decoding | Token masking at the sampler | Highest on format validity | More complex serving stack; some latency overhead |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating all three as equally reliable. Free-form text parsing fails on phrasing drift, while native calling and constrained decoding give machine-parseable output by construction.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.