Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

Claude
  • Claude.ai Interface Tour: Every Control You Need on One Screen
  • The AI Fluency Model: Delegation, Description, Discernment and Diligence
  • Working With Claude: Pick the Surface, Match the Model, Keep the Context Clear
  • Claude's Four Entry Points: Choose Chat, Projects, Artifacts or Research Before You Type
  • What Claude Can Do: Extended Thinking, Web Search, Artifacts and File Analysis
  • Getting More From a Claude Chat: Steer the Conversation Instead of Starting Over
  • Claude Research Mode End to End: From One Prompt to a Cited Briefing
  • Claude's Capability Layer: When to Use Skills, Code Execution or Memory
  • Code Execution and File Creation in Claude: Calculated Numbers and a Real Excel File
  • Adding and Using Skills in Claude: Let Claude Pick the Skill, Then Teach It Your Format
  • Claude Memory, Curation and Incognito: Keep What Helps, Remove What Has Gone Stale
  • Claude Styles, Preferences and Project Instructions: Three Dials, Three Scopes
  • Claude Projects: Knowledge, Instructions and a Real Workspace You Set Up Once
  • Keeping a Claude Project Current and Connected: Refresh, Prune and Grant the Least
  • Claude Scheduled Tasks: Let Claude Work on a Schedule and Email You the Result
  • Claude Code and Claude for Chrome: What They Are and Who They Are For
  • Anatomy of a Good Prompt: Role, Context, Task, Format and Examples
  • Shaping Claude's Output: Format, Tone and Length in a Few Words
  • Iterating and Refining a Prompt: Read, Diagnose, Adjust, Repeat
  • Five Prompting Patterns for Work: Summarise, Extract, Rewrite, Classify and Draft
  • Why Evaluating AI Output Matters Most: Trust, Then Verify
  • Spotting AI Hallucinations and Fabrications: Four Tells and Where Risk Spikes
  • Fact-Checking Claude's Answers: Four Techniques and a Line-by-Line Claim Log
  • Judging AI Output Quality: Four Questions That Score Any Answer
  • Adapting AI Output for Your Audience: One Answer, Three Readers
  • When a Human Must Review AI Output Before It Ships
  • A Personal Validation Checklist for AI Output: Six Lines, Any Draft
  • Fitting Claude Into Real Work: Where It Helps and Where It Never Should
  • Breaking Big Tasks Into Steps With Claude: Small Asks, Checked Hand-offs
  • Designing a Repeatable Claude Workflow: A Reusable Weekly Report Template
  • Measuring If Claude Is Actually Working: One Number, Before and After
  • Communicating AI Value and Limitations to Stakeholders: The Honest Pitch
  • Data Privacy With Claude: What Never Goes in a Prompt, and How to Redact a Document Before You Paste It
  • Responsible AI Use and Transparency: Helpful, Honest, Harmless, and One Honest Line
  • Troubleshooting a Weak Claude Answer: Name the Cause, Fix One Thing, Then Make It Cheaper
  • CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
  • Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
  • One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
  • Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
  • Hooks That Block Destructive Actions: a PreToolUse Gate That Allows, Asks or Denies
  • Choosing a Claude Code Extension: Skill, Hook, Rules File, Subagent, Slash Command or Plugin
  • Rolling Out Claude Code to a Team: Settings Precedence, dontAsk in CI, a Hook for Every-Time Rules and a Plugin for Five Repos
  • A Claude Code Review Bot in CI: Headless -p, JSON Findings, Team Rules in Git and a Person on the Merge
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Configuring MCP Servers in Claude Code: A Command or a URL, Three Scopes, and Three Moves When One Breaks
  • Claude Code's Built-in Tools: Read, Write, Edit, Bash, Grep and Glob, and When Each One Is the Right Pick
  • The CLAUDE.md Hierarchy: User, Project and Directory Files, How They Stack, and the Team Rule Stuck on One Laptop
  • Split a 600-Line CLAUDE.md: @import Lines, .claude/rules Files and Which One to Pick
  • Path-Specific Rules in Claude Code: paths Globs, When a Rule Loads and the Glob That Matches Nothing
  • Claude Code Slash Commands and Skills: Project vs User Scope, $ARGUMENTS, context: fork and allowed-tools
  • Iterative Refinement with Claude Code: Input/Output Examples, Tests First and the Interview Pattern
  • Claude Code Sessions: Resume by Name, Fork From a Baseline, or Start Fresh With a Summary Card
  • CI Reviews That Don't Repeat Themselves: Prior Findings, Existing Tests and Test Standards in CLAUDE.md
  • The Claude Messages API: Your First Call, Field by Field
  • Claude Tool Use: How tool_use and tool_result Work in the Messages API
  • Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
  • Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
  • Claude Streaming Events: The Event Order, message_stop, Tool Arguments, Stop Reasons and a WebSocket Relay
  • Images, PDFs and Thinking Blocks in the Claude Messages API: Typed Blocks In, Typed Blocks Out
  • Getting Data Into Claude: PDF Documents, the Files API, Search Results and Citations
  • Opus, Sonnet or Haiku: Pick the Claude Model per Job, and Test the Request When a New Release Arrives
  • Adaptive Thinking and Effort in Claude: Two Dials, Set per Workload, and the Thinking Block You Must Pass Back
  • Claude Cost Tracking From usage: Count Before, Cap During, Read After, Then Find the Line That Drives the Bill
  • Claude Cache Breakpoints: Where to Put cache_control, How to Move It With the Chat, and Why the Reads Stay at Zero
  • Claude Message Batches or Real Time: Choose by Who Is Waiting, Match by custom_id, Resend Only the Failures
  • Calling Claude Through Amazon Bedrock, Google Cloud and Microsoft Foundry: Same Call, Different Door
  • The Life Cycle of a Claude App: Six Phases, a Model That Retires, and a Release Gate for Every Change
  • Pinning Claude Model IDs and Upgrading Safely: One Change at a Time, a Golden-Set Replay and a Staged Rollout
  • Content Boundaries and Schema Design for Claude: Fence the Input in a Tag, Let the Output Say I Don't Know
  • The Agentic Loop and stop_reason: Keep Turning on tool_use, Stop on end_turn, Cap the Turns
  • The Claude Agent SDK: query(), ClaudeAgentOptions and @tool, in Python and TypeScript
  • Fix the Agent: Four Broken Claude Agent SDK Configs, From the Symptom to the One Wrong Line
  • Claude Managed Agents: Cloud Sandbox, Self-Hosted Sandbox or Self-Hosted Service
  • Agent SDK Hooks for Deterministic Actions: PreToolUse, PostToolUse, and Four Hooks That Fail Silently
  • Memory and Context-Window Patterns for Claude Agents: Context Editing, Compaction and the Memory Tool
  • Reading an Agent Trace: Five Signatures, Five Missing Patterns, and How Long a Fact Must Live
  • Tool Descriptions for Claude: How Claude Picks a Tool, and How to Stop It Picking the Wrong One
  • Tool Input Schemas and Error Responses for Claude: Required Fields, Enums, is_error and a Retry Flag
  • Tool Response Shaping and a Lean Tool Set: Give Claude a Sticky Note, Not the Filing Cabinet
  • Fix the Tool Schema: Read the Trace, Fix the Card, Re-Run (Four Real Schema Bugs)
  • Client Tools, Server Tools and Approval Gates: Who Runs the Tool, and Who Says Yes First
  • Built-in Tool, Custom Tool, Skill or MCP Server? Pick the Lightest One That Fits
  • System Prompt or User Turn: Where Each Instruction Goes, and Output Limits Your Code Enforces
  • Refine the Prompt One Line at a Time, Then Clean and Fence the Customer's Text
  • Prompt Revision Driven by Evals: Name the Cause, Change One Thing, Rerun the Whole Suite
  • Long-Running Sessions: Compact, Prune, Isolate or Start Fresh, Decided by Naming the Failure
  • Context Isolation Through Subagents: Read the Logs Elsewhere, Keep One Line
  • Defensive Parsing of Claude Replies: Check the Stop Reason, Read the Block or the Text, Then Validate the Values
  • Full Context or Retrieval: Choose by Corpus Size, Cost and Freshness
  • Skepticism Toward Confident Output: Check the Quote, the Record and the Sum Before You Send
  • Debugging a Claude App: Three Error Types, the Recovery Each One Earns, and the First Failing Row
  • Six Ways a 200 Can Still Be Wrong: Hallucination, Refusal, Under-Acting, Context Loss, Format Drift and Inconsistency
  • Fix the Cause, Not the Symptom: Four Recovery Drills for an LLM App, Each Checked on a New Input
  • Integration Layer or Model Output? Three Taps and Three Questions to Find Where a Wrong Answer Lives
  • Which Test Layer Owns the Failure? Unit, Functional, Integration and End-to-End Tests for a Claude App
  • Designing an Overnight Document Pipeline on Claude: Batch Lane, Live Lane, a Cached Prefix and a custom_id Reconcile
  • Proving a Model Upgrade Is Ready: A Frozen Golden Set, a Calibrated Judge, the Right Layer and a Release Gate
  • From Requirement to Design for a Claude App: Eight Requirements, Five Elements and a Trace With No Gaps
  • Build a Claude Refund App: the Messages API, Two Tools, an MCP Server and a Hook in One Loop
  • Ship a Claude App: an Eval Gate, Two Guardrail Layers, a Cost Check From usage and a Pinned Model
  • Lab: a 30-Case Golden Set, a Calibrated Judge and a Per-Slice CI Gate on a Claude Refund App
  • Lab: Cut a Claude App's Bill by 62 Percent With Usage Data, Layered Cache Breakpoints and a Batch Job
  • Lab: Three Planted Bugs in a Claude App, a Vague Prompt, a Mistyped Tool Schema and a Broken Stream Handler
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Lab: Harden a Claude App, an Uncalibrated Judge, a Retry Loop That Retries Everything and a Hook Matcher With a Gap
  • Lab: Turn a Claude App Into a Reusable Template, One Pinned Model Id, No Key in Code and Evals Built From Data
  • Building an MCP Server: Tools, Resources and Prompts in Python and TypeScript
  • MCP Transports: stdio or Streamable HTTP, and Who Starts the Server
  • Deploying and Authenticating an MCP Server: Environment Keys for stdio, Bearer Tokens and Scopes for HTTP
  • Validation-Retry Loops for Claude Extraction: Send Back the Exact Errors, and Stop When a Retry Cannot Help
  • Multi-Pass and Multi-Instance Code Review with Claude: A Fresh Reviewer, Per-File Passes and an Integration Pass
  • When a Claude Support Agent Should Escalate: Three Clear Triggers, Not Mood or a Confidence Score
  • Error Propagation Across Subagents: Retry Locally, Then Report the Failure, the Attempts and What You Found
  • Human Review and Confidence Calibration: Check Accuracy by Type and Field Before You Stop Looking
  • Provenance in Multi-Source Research: Keep Every Claim With Its Source and Date, and Show Conflicts Instead of Settling Them
  • Lab: An Extraction Pipeline With a Nullable Schema, Validation-Retry, a 100-Request Batch and Human Review
  • Lab: A Research Pipeline With Parallel Subagents, a Timeout That Keeps Its Partial Results, and a Report With Its Trail
  • Coordinator and Subagents: Decompose, Delegate, Check Coverage, and Call Only the Spokes You Need
  • Passing Context to Subagents: Nothing Is Inherited, So Put Findings, Goal and Criteria in the Prompt
  • Parallel Subagents: Several Task Calls in One Response, Every Result Back in One User Turn
  • Task Decomposition: a Fixed Prompt Chain With an Integration Pass, or a Dynamic Plan That Adapts
  • Prompt Guidance vs Programmatic Gates: Block the Refund Until the Customer Is Verified, Then Hand Off a Card That Stands Alone
  • Scoped Tools per Agent and tool_choice: Three to Five Tools per Role, a Shared One, and auto, any or a Forced Tool
  1. Blog
  2. /
  3. Claude
  4. /
  5. Building with the Claude API

Human Review and Confidence Calibration: Check Accuracy by Type and Field Before You Stop Looking

An invoice extractor is 93% accurate, so the team wants to stop human review. Split by type and field, handwritten invoices are at 70% and handwritten due dates at 1 of 4. Two small Python files find the weak spot, pick a confidence cut-off from labelled data and keep a stratified sample under review.

Chaand Sheikh

·27 November 2026Building with the Claude API

What you will learn

  • Split one overall accuracy number by document type and by field to find the weak spot
  • Calibrate field confidence on a labelled set and let the data pick the cut-off
  • Route low-confidence or conflicting fields to a person and accept the rest
  • Draw a stratified random sample from every document type, including the confident ones

Before you start

  • Validation-retry loops for Claude extraction
  • Basic Python and CSV files

Your invoice extractor reads three fields from every invoice, and 93% of them are right. Fifty-six out of sixty. Someone on the team says: good enough, let's stop human review.

But 93% of what? Look inside and handwritten invoices are right only 7 times out of 10. Handwritten due dates are right 1 time out of 4. A single average can hide a document type, or a field, that is failing. This article shows four habits that find it before you automate: check by type, check by field, calibrate the confidence, and keep sampling.

One school, three classes

A school reports an average grade of 93%. A great school, it seems. Now look class by class. Class A is at 100%, class B at 93%, class C at 70%. One class is failing, and the average never shows it. Before you say the school is fine, you look at each class.

An extractor is the same. The "classes" are document types (printed, scanned, handwritten) and fields (invoice number, total, due date).

The data

The project has a file results.csv with 60 extractions that a person has checked. Each row says which document type it came from, which field, how confident the extractor was, and whether the value was right. A few rows:

doc_type,field,confidence,correct
printed,invoice_number,0.99,yes
scanned,due_date,0.62,no
handwritten,due_date,0.92,no
handwritten,due_date,0.83,yes

All the numbers are made-up example numbers, and both files are plain Python: no model call and no API key. The checks are what matter here, and they work the same on real labelled data.

accuracy.py: split the average

"""Overall accuracy can hide a weak spot. Example numbers."""
import csv
from collections import defaultdict


def load(path="results.csv"):
    with open(path, newline="") as f:
        return list(csv.DictReader(f))


def score(rows):
    hits = sum(r["correct"] == "yes" for r in rows)
    return hits, len(rows)


def group(rows, *keys):
    groups = defaultdict(list)
    for r in rows:
        groups[tuple(r[k] for k in keys)].append(r)
    return groups


if __name__ == "__main__":
    rows = load()
    hits, n = score(rows)
    print(f"overall: {hits}/{n} = {hits / n:.0%} correct")
    print("by document type:")
    for (doc,), g in sorted(group(rows, "doc_type").items()):
        h, m = score(g)
        print(f"  {doc:12} {h:>2}/{m:<2} = {h / m:.0%}")
    print("by document type and field:")
    for (doc, field), g in sorted(group(rows, "doc_type", "field").items()):
        h, m = score(g)
        flag = "  <-- weak" if h / m < 0.8 else ""
        print(f"  {doc:12} {field:15} {h}/{m} = {h / m:.0%}{flag}")

score counts the right answers. group sorts rows by any keys you give it, so the same function cuts by document type, then by document type and field. Any segment under 80% gets a weak flag.

Running python accuracy.py:

overall: 56/60 = 93% correct
by document type:
  handwritten   7/10 = 70%
  printed      36/36 = 100%
  scanned      13/14 = 93%
by document type and field:
  handwritten  due_date        1/4 = 25%  <-- weak
  handwritten  invoice_number  3/3 = 100%
  handwritten  total           3/3 = 100%
  printed      due_date        12/12 = 100%
  printed      invoice_number  12/12 = 100%
  printed      total           12/12 = 100%
  scanned      due_date        3/4 = 75%  <-- weak
  scanned      invoice_number  5/5 = 100%
  scanned      total           5/5 = 100%
One average, split by type and field overall 56/60 93% printed 36/36 100% scanned 13/14 93% handwritten 7/10 70% handwritten due date 1/4 25%
The same 60 checked fields: 93% overall, 70% for handwritten invoices, 25% for handwritten due dates.

The overall line says it is safe to stop review. The type lines say handwritten is at 70%. The field lines point at the exact cell: handwritten due dates, 1 of 4. Scanned due dates are weak too, 3 of 4. These groups are small, four rows each, but they are exactly where a person still needs to look.

This is the same idea as testing a RAG bot slice by slice before release (see a release gate per slice): a pass rate only means something for the slice it was measured on.

Is the confidence honest?

The extractor gives every field a confidence score. It's tempting to say "accept anything above 0.9" and move on. But a score is just another output of the model. Until you check it against labelled data, you don't know what 0.9 means. As with any confident output, you check it against something you can look up; here, that something is the labelled set.

Calibration asks: when the model says 0.9 and up, how often is it right? When it says 0.8 to 0.89? Below 0.8? And then the cut-off comes from those answers, not from a guess.

route.py: let the data pick the cut-off

"""Send doubt to people first, and spot-check the rest. Example data."""
import random
from accuracy import load, score

GOAL = 0.97  # share of auto-accepted fields that must be right


def pick_cutoff(rows):
    """Lowest confidence cut-off that meets the goal on the labelled set."""
    for cut in (0.5, 0.6, 0.7, 0.8, 0.9):
        kept = [r for r in rows if float(r["confidence"]) >= cut]
        hits, n = score(kept)
        if n and hits / n >= GOAL:
            return cut, hits, n
    return 1.0, 0, 0


def calibration(rows):
    """How often is the model right when it says 0.9, 0.8, and so on?"""
    for name, lo, hi in (("0.90 and up", 0.9, 1.01),
                         ("0.80 to 0.89", 0.8, 0.9),
                         ("below 0.80", 0.0, 0.8)):
        part = [r for r in rows if lo <= float(r["confidence"]) < hi]
        hits, n = score(part)
        print(f"  says {name:12} right {hits}/{n} = {hits / n:.0%}")

pick_cutoff starts low and moves up. At each cut-off it keeps only the rows at or above it and asks: are at least 97% of these right? The first cut-off that meets the goal wins. The 97% goal is the project's own number; yours comes from what a wrong field costs you.

Then ten new invoice fields arrive. Each has an id, a document type, a field, a confidence and a conflict_detected flag:

NEW = [  # id, doc_type, field, confidence, conflict_detected
    ("inv-01", "printed", "total", 0.98, False),
    ("inv-02", "printed", "due_date", 0.95, False),
    ("inv-03", "handwritten", "due_date", 0.91, False),
    ("inv-04", "scanned", "total", 0.93, False),
    ("inv-05", "handwritten", "total", 0.84, False),
    ("inv-06", "printed", "invoice_number", 0.97, False),
    ("inv-07", "scanned", "due_date", 0.64, False),
    ("inv-08", "printed", "total", 0.96, True),
    ("inv-09", "scanned", "invoice_number", 0.92, False),
    ("inv-10", "handwritten", "due_date", 0.66, False),
]


def route(new, cut):
    human = [x for x in new if x[3] < cut or x[4]]
    auto = [x for x in new if x not in human]
    return human, auto


def sample(auto, rng):
    """Stratified: one random auto-accepted row from every doc type."""
    picked = []
    for doc in sorted({x[1] for x in auto}):
        picked.append(rng.choice([x for x in auto if x[1] == doc]))
    return picked

route has one rule with two parts: low confidence or a detected conflict goes to a person. A conflict means the extraction itself found the document disagreeing with itself, as in validation-retry loops. High confidence doesn't cancel that. sample draws one random accepted row from every document type.

Running python route.py:

calibration on the labelled set:
  says 0.90 and up  right 44/45 = 98%
  says 0.80 to 0.89 right 10/10 = 100%
  says below 0.80   right 2/5 = 40%
cut-off 0.8: 54/55 = 98% right (goal 97%)
to a person (3):
  inv-07 scanned      due_date       0.64  low confidence
  inv-08 printed      total          0.96  conflict
  inv-10 handwritten  due_date       0.66  low confidence
auto-accepted (7), spot-checked (3):
  inv-03 handwritten  due_date       0.91  sampled
  inv-01 printed      total          0.98  sampled
  inv-04 scanned      total          0.93  sampled
  • Calibration: below 0.80, the model is right only 2 times in 5. At 0.80 and above it holds up.
  • Cut-off: the data picks 0.8. Fields at or above it are right 54 times out of 55, which is 98% and meets the 97% goal.
  • To a person: two fields with low confidence, and inv-08, a printed total at 0.96 with a detected conflict.
  • Accepted: the other seven, with one from each type spot-checked. One of them is a handwritten due date at 0.91.
Route the doubt, sample the rest 10 new fields confidence below 0.80 or conflict detected? yes to a person: 3 2 low confidence 1 conflict at 0.96 no auto-accepted: 7 spot-check 1 per type handwritten, printed, scanned A person sees all doubtful fields and a sample of the rest.
The cut-off decides who looks first; the stratified sample keeps checking what was accepted.

Why sample the confident ones?

Because high confidence is not proof. Look back at the labelled set: one handwritten due date was wrong at 0.92. That row sits in the "0.90 and up" band, the band everyone wants to trust.

So the accepted fields are grouped by document type, and one is drawn at random from each group for a person to check. That does two jobs:

  • It measures the real error rate of what you accepted, segment by segment, as the documents change over time.
  • A wrong value is a clue to a new error pattern. When the sample finds one, you fix the rule for that segment.

Stratified means every type gets drawn, including printed invoices that have been at 100%. A purely random sample from all accepted fields would mostly pick printed invoices, because they are most of the volume, and the small handwritten group could go unchecked for weeks.

Common mistakes

  • Automating on the average. 93% overall hid a field at 25%. Always split by document type and by field first.
  • Trusting the raw score. A confidence of 0.9 means nothing until the labelled set says how often 0.9 is right.
  • Guessing the cut-off. Pick it from the labelled set against a goal you chose on purpose.
  • Letting confidence override a conflict. inv-08 was at 0.96 and still went to a person, because the document disagreed with itself.
  • Sampling only the weak spots. Errors can appear in any segment, so sample every type, the good-looking ones too.

Recap

HabitIn this projectWhat it caught
Accuracy by typegroup(rows, "doc_type")Handwritten at 7/10 = 70%
Accuracy by fieldgroup(rows, "doc_type", "field")Handwritten due date at 1/4
Calibratecalibration(), pick_cutoff()Below 0.80 only 2/5 right; cut-off 0.8 gives 54/55
Route doubtroute()2 low-confidence fields and 1 conflict to a person
Stratified samplesample()One accepted field per type, including a 0.91 handwritten due date

On the exam, before automating high-confidence extractions, pick the answer that validates accuracy by document type and field and keeps a stratified sample under review; an overall average is not enough.

Try it yourself

Lower GOAL in route.py to 0.95 and run it again. Which cut-off does the data pick now, and do the same three fields still go to a person? Then raise it to 0.99. No cut-off meets that goal, pick_cutoff returns 1.0, 0, 0, and the print line has nothing to divide by. Add a guard that says "no cut-off meets the goal: review everything", because that is the honest answer when the labelled set can't support automation.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in Claude · 114 of 123

Previous
Error Propagation Across Subagents: Retry Locally, Then Report the Failure, the Attempts and What You Found
Next post
Provenance in Multi-Source Research: Keep Every Claim With Its Source and Date, and Show Conflicts Instead of Settling Them

Related course on Udemy

Claude Certified Architect - Foundations (CCAR-F) Exam Prep

Agentic loops, tools, MCP, Claude Code, prompts, structured output and context.View on Udemy ↗: Claude Certified Architect - Foundations (CCAR-F) Exam Prep (paid course, opens in a new tab)

Related posts

The Claude Messages API: Your First Call, Field by Field

One request in, one Message out. The four fields of a Messages API call (model, max_tokens, system, messages), how to read content blocks, stop_reason and usage, and why every turn resends the history.

Claude Tool Use: How tool_use and tool_result Work in the Messages API

Follow one order question through Claude's tool round trip: define a tool, read the tool_use block, run your own function and send a matching tool_result back, including parallel calls and is_error.

Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared

Every Claude client SDK wraps the same REST request: a POST to /v1/messages with a JSON body. See it built by hand, through the Python and TypeScript SDKs, as typed errors, and as async calls that wait together.

Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move

Configure the Anthropic SDK client (timeout, max_retries, with_options, async, pagination), see which errors it retries by itself, then repair a retry wrapper so a 429, a 529, a 400 and a timeout each get the move the docs support.

On this page

  • One school, three classes
  • The data
  • accuracy.py: split the average
  • Is the confidence honest?
  • route.py: let the data pick the cut-off
  • Why sample the confident ones?
  • Common mistakes
  • Recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

Claude Certified Architect - Foundations (CCAR-F) Exam Prep

Agentic loops, tools, MCP, Claude Code, prompts, structured output and context.View on Udemy ↗: Claude Certified Architect - Foundations (CCAR-F) Exam Prep (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.