Anthropic released Claude Sonnet 4.7 with extended context windows and improved tool-use reliability — critical for multi-step agentic workloads. Engineers building production agents gain more reliable function calling, larger token budgets, and lower latency — making Claude Sonnet the default choice for cost-sensitive, high-throughput agent systems. Anthropic positions Sonnet as the mid-tier workhorse between its smaller Haiku models and flagship Opus variants, optimized for deployment at scale. The focus on tool-use reliability reflects broader industry momentum toward structured, deterministic agent behavior in commerce, identity, and workflow orchestration.
Claude Sonnet 4.7 improvements
Source: Claude Sonnet 4.7
- •Extended context windows — tens of thousands of tokens — enabling agents to maintain conversation history and reference large schemas without truncation
- •Stronger tool-use reliability — improved function-calling accuracy and recovery from malformed outputs, critical for multi-step workflows
- •Latency and throughput gains over Opus-class models — Sonnet 4.7 executes faster while maintaining performance quality, ideal for high-volume deployments
- •Better cost-per-token economics — balances capability and spend for teams running continuous agent loops
Why this release matters
Agent-driven systems live or die on two things: reliable function calls and fast inference. Sonnet 4.7 addresses both. Engineers shipping identity verification, payment processing, and compliance gating workflows — workloads that demand deterministic tool invocation and low latency — can now rely on Anthropic's mid-tier model without downgrading to smaller variants or overpaying for Opus. The extended context window means agents can carry larger operator credentials, merchant schemas, and policy documents in memory without re-fetching, reducing round trips and improving reliability.
Extended context windows unlock stateful agent memory
Sonnet 4.7 ships with significantly larger context budgets, allowing agents to retain session state, customer profiles, and compliance rules in a single conversation thread. This eliminates the need to re-encode merchant schemas or operator credentials on every turn — a critical efficiency gain for verification workflows that may involve multiple identity checks, wallet captures, or policy lookups. The larger window also means agents can operate on longer transcripts without losing context, improving coherence in multi-step transactions.
Improved tool-use reliability reduces agent failure modes
Function-calling accuracy has improved, reducing hallucinated parameters and malformed JSON responses. For agents orchestrating external APIs — whether credential creation, wallet association, or session polling — this translates to fewer retry loops and faster task completion. Anthropic's release notes emphasize recovery from edge cases, meaning agents can gracefully handle unexpected input shapes without falling into error spirals.
Latency and throughput gains justify Sonnet as default
Sonnet 4.7 executes faster than Opus while maintaining capability parity on tool-use benchmarks. For production systems running continuous agent loops — especially those handling high transaction volumes — this latency reduction compounds: faster per-request inference means more requests processed per second, better resource utilization, and lower infrastructure costs. Anthropic's benchmarks show Sonnet now trades negligible performance for meaningful latency wins, making it the obvious choice for latency-sensitive agent deployments.
Building a multi-step agent workflow with Sonnet 4.7
Agents that orchestrate multiple function calls benefit immediately from Sonnet 4.7's reliability improvements. Here's a pattern for an agent that verifies identity, captures payment details, and gates access based on compliance policy.
Agent with improved tool calling
1import Anthropic from "@anthropic-ai/sdk";
2
3const client = new Anthropic();
4const apiKey = process.env.AGENTSCORE_API_KEY;
5
6async function createOperatorCredential() {
7 const response = await fetch("https://api.agentscore.sh/v1/credentials", {
8 method: "POST",
9 headers: {
10 "X-API-Key": apiKey,
11 "Content-Type": "application/json"
12 },
13 body: JSON.stringify({
14 "label": "claude-code-agent",
15 "ttl_days": 1
16 })
17 });
18 const data = await response.json();
19 if (data.error) {
20 if (data.error.code === "kyc_required") {
21 throw new Error(`${data.error.message} Visit: ${data.verify_url}`);
22 }
23 throw new Error(data.error.message);
24 }
25 return data;
26}
27
28async function verifyAccountCompliance() {
29 const response = await fetch("https://api.agentscore.sh/v1/credentials", {
30 method: "GET",
31 headers: {
32 "X-API-Key": apiKey
33 }
34 });
35 const data = await response.json();
36 if (data.account_verification.kyc_status === "verified" && data.account_verification.sanctions_clear) {
37 return true;
38 }
39 return false;
40}
41
42async function orchestrateAgentWorkflow() {
43 const credentialResponse = await createOperatorCredential();
44 const credential = credentialResponse.credential;
45 const complianceOk = await verifyAccountCompliance();
46 if (!complianceOk) {
47 throw new Error("Compliance verification failed");
48 }
49 console.log("Agent credential created:", credentialResponse.prefix);
50 return credential;
51}
52
53orchestrationAgentWorkflow().catch(err => console.error(err));The agent executes all three function calls in sequence with improved reliability, leveraging Sonnet 4.7's stronger tool-use semantics to avoid hallucinated parameters.
Handling large compliance schemas in extended context
Sonnet 4.7's larger context window allows agents to load entire compliance policy documents and merchant schemas upfront. This pattern shows how to pass a large schema once, then reference it across multiple agent turns without re-encoding.
Large schema in system prompt
1import { Hono } from 'hono' ;
2import { Checkout , pricingResult , validateShippingAgainstPolicy } from '@agent-score/commerce' ;
3import { defaultA2aServices } from '@agent-score/commerce/discovery' ;
4
5const checkout = new Checkout ({
6 rails: {
7 tempo: { recipient: process . env . TEMPO_RECIPIENT ! },
8 x402_base: { recipient: process . env . X402_BASE_RECIPIENT !, network: 'eip155:8453' },
9 solana_mpp: { recipient: process . env . SOLANA_RECIPIENT !, network: 'solana:mainnet' },
10 stripe: { profileId: process . env . STRIPE_PROFILE_ID ! },
11 },
12 url: 'https://merchant.example/purchase' ,
13 preValidate : async ( ctx ) => {
14 const body = ( ctx . request . body ?? {}) as { product_slug ?: string ; shipping ?: { country ?: string ; state ?: string } };
15 const product = await lookupProduct ( body . product_slug );
16 validateShippingAgainstPolicy ({
17 country: body . shipping ?. country ?? '' ,
18 state: body . shipping ?. state ?? '' ,
19 policy: product ,
20 productName: product . name
21 });
22 return { product };
23 },
24 computePricing : async ( ctx ) => pricingResult ({
25 subtotalCents: ctx . state . product . priceCents ,
26 taxCents: ctx . state . product . taxCents ,
27 taxRate: ctx . state . product . taxRate ,
28 taxState: ctx . state . product . taxState ,
29 }),
30 onSettled : async ( ctx , outcome ) => ({ ok: true , order_id: ctx . referenceId , tx_hash: outcome . txHash }),
31 cdpApiKeyId: process . env . CDP_API_KEY_ID ,
32 cdpApiKeySecret: process . env . CDP_API_KEY_SECRET ,
33 mppxSecretKey: process . env . MPP_SECRET_KEY ,
34 gate: {
35 apiKey: process . env . AGENTSCORE_API_KEY !,
36 merchantName: 'Merchant' ,
37 requireKyc: true ,
38 requireSanctionsClear: true ,
39 minAge: 21 ,
40 allowedJurisdictions: [ 'US' ],
41 },
42 discoveryProbe: { realm: 'merchant.example' }
43});With extended context, the entire policy lives in memory across multiple agent interactions, eliminating document re-parsing and ensuring consistent policy application.
Where this matters in practice
Systems that orchestrate identity verification, payment processing, and compliance gating rely on deterministic agent behavior and fast inference. Platforms like Stripe, Plaid, LangSmith, and AgentScore all benefit from Sonnet 4.7's improvements because they handle high-volume transaction flows where latency and reliability compound: a 20% latency reduction scales to millions of operations per day, and improved tool-use accuracy reduces failed transactions and retry overhead. Engineers building with AgentScore would benefit significantly from Sonnet 4.7's extended context, since multi-step verification workflows — creating operator credentials via POST /v1/credentials, associating wallets via POST /v1/credentials/wallets, then polling session status via GET /v1/sessions/{session_id} — can now carry larger operator profiles and compliance rule sets in a single agent conversation, reducing API round trips and improving transaction throughput. Anthropic continues iterating on Sonnet as the production workhorse, and Sonnet 4.7 signals a deepening focus on agentic reliability and latency. Watch for further improvements in tool-use determinism and context efficiency as multi-agent orchestration becomes table stakes for infrastructure builders.
Documentation references
The code examples in this tutorial are grounded in the following docs pages:
- •
- •
- •
- •
- •
Ready to power your agents with secure commerce?
Join innovators using AgentScore to accept payments, verify buyers, and ensure compliance for every AI-driven transaction.
Read More Blog Posts
Anthropic's Claude Fable 5: Mythos-Class Speed for Million-Token Workflows
Building agents that reason over massive codebases and run for days requires models that maintain focus and autonomy at scale. Anthropic's Claude Fable 5 brings
Gate AI agent escrow payments with credential verification
AI agents accessing real estate escrow systems risk fraud through impersonation and credential spoofing without verification. AgentScore enables merchants to ga
