techlist.io

Anthropic/Prompt Engineering

8 posts

Anthropic2026-03-245 min readCurated summary

Harness design for long-running apps

# Anthropic's Three-Agent Harness for Long-Running Autonomous Coding and Frontend Design Prithvi Rajasekaran of Anthropic's Labs team describes a multi-agent approach that improves Claude's output on two hard problems: subjective frontend design and long autonomous full-stack coding. The core idea is to separate the agent doing the work from an evaluator agent that judges it, borrowing the generator-discriminator structure of GANs. A standalone evaluator, tuned to be skeptical, gives the generator concrete feedback to iterate against, which self-evaluation alone cannot provide. The post also shows that harness components should be continually stress-tested as models improve, since some scaffolding becomes unnecessary over time. ## Why Naive Implementations Fall Short - Models lose coherence on long tasks as the context window fills, and some (notably Claude Sonnet 4.5) show "context anxiety," wrapping up work early as they near what they believe is their limit. - Context resets, which clear the window and hand off state through a structured artifact, address this more fully than compaction, which summarizes history in place and leaves the anxiety intact. Resets add orchestration complexity, token overhead, and latency. - Agents reliably overpraise their own work, especially on subjective tasks like design where no binary test exists. - A separate evaluator is still an LLM and tends to be lenient, but tuning a standalone evaluator to be skeptical is far more tractable than making a generator self-critical. ## Making Subjective Design Quality Gradable - The team wrote four grading criteria given to both generator and evaluator: design quality, originality, craft, and functionality. Design quality and originality were weighted more heavily, since Claude already handled craft and functionality well by default. The originality criterion explicitly penalized "AI slop" patterns such as purple gradients over white cards. - The evaluator was calibrated with few-shot examples and detailed score breakdowns to align with the author's taste and reduce score drift. - The loop ran on the Claude Agent SDK. The evaluator used the Playwright MCP to navigate the live page, screenshot it, score each criterion, and write a critique. The generator chose each iteration to either refine its direction or pivot aesthetically. - Runs took 5 to 15 iterations and up to four hours. Scores generally improved before plateauing, and the criteria wording itself steered the output: even the first iteration beat a no-prompt baseline. - In one run, a Dutch museum site moved on iteration ten from a polished dark landing page to a spatial 3D gallery built with CSS perspective and doorway-based navigation. ## Scaling to Full-Stack Coding - **Architecture:** Three agents. A planner expands a 1–4 sentence prompt into a product spec, staying high-level to avoid cascading errors from wrong technical details. A generator works in sprints on a React, Vite, FastAPI, and SQLite (later PostgreSQL) stack and uses git. An evaluator tests the running app with Playwright. - **Sprint contracts:** Before each sprint, generator and evaluator negotiate what "done" means and how it will be tested. Communication happens through files. - **Evaluation:** Each criterion has a hard threshold. Failing any one fails the sprint and returns detailed feedback. Sprint 3 alone had 27 criteria for the level editor. - **Tuning the QA agent:** Out of the box, Claude was a poor QA agent. It found real issues, then talked itself into approving them, and tested superficially. The team tuned the evaluator's prompt over several rounds by comparing its judgments to their own. - **Cost comparison (retro game maker, Opus 4.5):** A solo run took 20 minutes and $9 but produced an app where the central feature did not work. The full harness took 6 hours and $200, producing a richer app with a functional play mode, though with physics and level-design rough edges. ## Simplifying the Harness - Every harness component encodes an assumption about what the model cannot do alone, and those assumptions go stale as models improve. The author follows the principle from "Building Effective Agents": use the simplest solution, adding complexity only when needed. - A first attempt to cut the harness radically failed to match the original performance and made it unclear which pieces were load-bearing. The team then removed one component at a time to measure its impact. - **Sprint construct removed:** Opus 4.6 could sustain longer coherent work, so the sprint decomposition was dropped. The planner stayed, since without it the generator under-scoped. The evaluator moved to a single pass at the end. - **Evaluator as a conditional:** The evaluator is worth its cost only for tasks beyond what the current model reliably does alone. On 4.6 that boundary moved outward, so the evaluator was unnecessary for some parts of a build but still helped at the edges. - The team also added prompting so the generator built proper tool-driven agents inside the apps, since this knowledge was thinly covered in training data. ## Results and Limits - A Digital Audio Workstation built with the simplified V2 harness took about 4 hours and $124.70. The build ran coherently for over two hours without sprints. - The QA agent still caught real gaps across rounds: clips could not be dragged, instrument and effect UIs were display-only, audio recording was a stub, and the EQ was numeric rather than graphical. - The final app had a working arrangement view, mixer, and transport, and the agent could compose a short snippet end to end through tools. The author acknowledges it is far from professional-grade, and that Claude cannot hear, which limits musical judgment in QA. ## Takeaways The author argues that as models improve, some scaffolding becomes obsolete, but the space of useful harness designs does not shrink; it shifts toward new combinations. Practical advice includes testing against the target model, reading its traces on realistic problems, decomposing complex tasks into specialized agents where useful, and re-examining the harness whenever a new model ships by removing components that no longer carry weight and adding new ones that unlock capabilities.

Anthropic2026-01-099 min readCurated summary

Demystifying evals for AI agents

Evals, meaning automated tests that run an input through an agent and grade the output, let teams ship AI agents with confidence. Without them, teams get stuck in reactive loops, catching problems only in production, where fixing one failure often creates another. Because agents act autonomously over many turns, they are harder to evaluate than single-turn models. The authors share practices from internal work and customer deployments, arguing that evals should be a core part of agent development and that their value compounds over the agent's lifecycle. ## Anatomy of an Evaluation - An eval gives an AI system an input and applies grading logic to its output. The post focuses on automated evals that run during development without real users. - Core terms: - **Task:** a single test with defined inputs and success criteria. - **Trial:** one attempt at a task. Multiple trials account for output variability. - **Grader:** logic that scores one aspect of performance. A task can have several graders, each with multiple assertions. - **Transcript:** the full record of a trial, including tool calls, reasoning, and intermediate results. - **Outcome:** the final environment state. A flight-booking agent may say "Your flight has been booked," but the real outcome is whether a reservation exists in the database. - **Harness:** the infrastructure that runs evals end to end. The agent harness is the system that lets a model act as an agent, and evaluating an agent means evaluating the harness and model together. - Frontier models can exceed the limits of static evals. Opus 4.5 solved a τ2-bench flight-booking task by finding a policy loophole that produced a better outcome for the user, though it "failed" the eval as written. ## Why Build Evals Early - Teams can get far with manual testing and intuition, but the breaking point comes when users say the agent feels worse and the team has no way to verify changes beyond guess-and-check. - Without evals, teams can't separate real regressions from noise, test changes against hundreds of scenarios before shipping, or measure improvements. - Claude Code began with fast iteration on feedback, then added evals for concision, file edits, and over-engineering. Combined with monitoring and A/B tests, these evals guided improvements. - Descript evolved from manual grading to LLM graders calibrated by humans, and now runs separate quality and regression suites. The Bolt team built an eval system within three months of launch, using static analysis, browser agents, and LLM judges. - Evals resolve ambiguity in specs, since two engineers can read the same spec and interpret edge cases differently. - Evals speed up adoption of new models. Teams with evals can test a new model in days rather than weeks. - Evals provide baselines and regression tests for latency, token usage, cost per task, and error rates, and they give product and research teams a shared set of metrics. ## Grading Agents **Grader types** - **Code-based** (string matching, binary tests, static analysis, tool-call and transcript checks): fast, cheap, objective, and reproducible, but brittle and limited for nuanced or subjective tasks. - **Model-based** (rubric scoring, natural-language assertions, pairwise comparison, reference-based evaluation, multi-judge consensus): flexible, scalable, and good for open-ended output, but non-deterministic, more expensive, and in need of human calibration. - **Human** (SME review, spot-checks, A/B testing, inter-annotator agreement): the gold standard and the calibration source for model graders, but expensive and slow. - Scoring can be weighted (combined scores must clear a threshold), binary (all graders must pass), or hybrid. **Capability vs. regression evals** - Capability evals start at low pass rates and give teams something to climb toward. - Regression evals should stay near 100% and protect against backsliding. - Once a capability eval reaches a high pass rate, it can "graduate" into a regression suite that runs continuously. **Coding agents** - Deterministic graders work well: does the code run, and do the tests pass? SWE-bench Verified and Terminal-Bench use this approach. LLM performance on SWE-bench Verified rose from about 40% to over 80% in a year. - Transcripts can be graded too, for code quality heuristics and tool-use behavior. - The post's example for an authentication-bypass fix combines unit tests, an LLM rubric for code quality, static analysis (ruff, mypy, bandit), state checks on security logs, required tool calls, and metrics such as turns, tool calls, tokens, and latency. **Conversational agents** - Success is multidimensional: ticket resolved (state check), finished in under 10 turns (transcript constraint), and appropriate tone (LLM rubric). - A second LLM often simulates the user. τ-Bench and τ2-Bench use this approach across retail and airline scenarios, and Anthropic uses it in alignment auditing. **Research agents** - Quality depends on context, so there is no simple pass/fail. Graders can check groundedness (claims supported by sources), coverage (key facts included), and source quality (authoritative sources, not just the first retrieved). - Exact match works for objective questions. LLM-based rubrics need frequent calibration against expert judgment. - BrowseComp tests whether agents can find hard-to-locate information on the open web. **Computer use agents** - These agents operate through screenshots, clicks, and keyboard input. WebArena and OSWorld check outcomes through URL and page state, backend database state, file system state, and app configs. - DOM-based interaction is fast but token-heavy, while screenshots are slower but more token-efficient. Summarizing Wikipedia works better with DOM extraction, while shopping for a product works better with screenshots. Claude for Chrome uses evals to check that the agent picks the right approach for each context. ## Handling Non-Determinism - Each task has its own success rate, and results vary across runs. - **pass@k** measures the chance of at least one success in k attempts. It suits tools where one good result is enough. pass@1 matters most for coding. - **pass^k** measures the chance that all k trials succeed. It suits customer-facing agents that need consistency. An agent with a 75% per-trial success rate passes three consecutive trials only about 42% of the time. ## A Roadmap to Trustworthy Evals **Collecting tasks** - Start early with 20–50 simple tasks drawn from real failures. Early changes have large effects, so small samples are enough. Waiting too long makes it harder to reconstruct success criteria. - Begin with manual pre-release checks and common user tasks. In production, convert bug reports and support tickets into test cases, prioritized by user impact. - Write unambiguous tasks. Two domain experts should reach the same pass/fail verdict. Each task should come with a reference solution that proves it is solvable. A 0% pass rate across many trials usually signals a broken task, not an incapable agent. - Build balanced problem sets. Testing only when the agent should act produces over-triggering. For Claude.ai web search, the team tested both when to search and when to answer from knowledge, and refined the balance over many rounds. **Designing the harness and graders** - Keep the eval agent close to the production agent. Start each trial from a clean, isolated environment. In one case, Claude gained an unfair advantage by reading git history from earlier trials, and shared resource limits can cause correlated failures. - Grade what the agent produced, not the exact steps it took. Rigid sequence checks punish valid creative solutions. - Give partial credit for multi-step tasks, since identifying a problem and verifying a customer is better than failing immediately. - Calibrate LLM judges against human experts. Give them an "Unknown" option to reduce hallucinations, and grade each dimension with a separate judge. - Watch for grading bugs. Opus 4.5 initially scored 42% on CORE-Bench because the grader rejected "96.12" against an expected "96.124991…" and the task specs were ambiguous. After fixes, it scored 95%. METR found time-horizon tasks that penalized models for following instructions. - Make graders resistant to hacks, so passing requires actually solving the problem. **Maintaining evals** - Read transcripts regularly. They reveal whether a failure reflects a real agent mistake or a grader that rejected a valid solution. - Watch for saturation. A suite at 100% only catches regressions. SWE-bench Verified approaching 80%+ means gains now show up as small score increases, which can be misleading. Qodo initially underrated Opus 4.5 because their evals missed longer, more complex tasks, so they built a new agentic framework. - Don't trust scores until someone has read the transcripts. Revise evals that grade unfairly, use ambiguous tasks, penalize valid solutions, or constrain the model. - Assign ownership. Dedicated eval teams can own the infrastructure, while domain experts and product teams contribute tasks. PMs and salespeople can contribute eval tasks via Claude Code PRs. - Practice eval-driven development. Define capabilities as evals before the agent can meet them, then iterate until it does. ## Combining Evals with Other Signals Automated evals complement production monitoring, A/B testing, user feedback, manual transcript review, and systematic human studies. Each has trade-offs. Automated evals are fast and reproducible but can create false confidence if they don't match real usage. Production monitoring reveals real behavior but is reactive. A/B testing measures real outcomes but is slow. User feedback is sparse and skewed toward severe issues. Manual review builds intuition but doesn't scale. Human studies provide gold-standard judgments but are expensive. Automated evals suit pre-launch and CI/CD, monitoring suits post-launch, A/B testing suits high-traffic changes, and human reviews calibrate model graders. ## Evaluation Frameworks Open-source and commercial options include Harbor for containerized agent trials, Braintrust for offline evals and production observability, LangSmith and Langfuse for tracing and evals, and Arize Phoenix and AX for LLM observability. The authors advise picking a framework quickly and spending the effort on high-quality test cases and graders. ## Conclusion Teams without evals get stuck fixing one failure after another, while teams that invest early find that failures become test cases, test cases prevent regressions, and metrics replace guesswork. The practical advice is to start early with realistic tasks drawn from real failures, define unambiguous success criteria, combine grader types, keep tasks challenging, iterate on the evals themselves, and always read the transcripts. The field is still young, and the authors expect to adapt these techniques as agents take on longer tasks, multi-agent systems, and more subjective work.

Anthropic2025-11-264 min readCurated summary

Effective harnesses for long-running agents

# Anthropic's Approach to Long-Running Agents Across Context Windows Long-running agents struggle because each new session starts with no memory of prior work, and compaction alone does not keep progress consistent across many context windows. Anthropic addresses this with a two-part harness: an initializer agent that sets up the environment on the first run, and a coding agent that makes incremental progress each session while leaving clean, documented artifacts for the next one. The approach was tested by building a claude.ai clone with the Claude Agent SDK, and it substantially reduced the failure modes that plague multi-session development. ## Why Long-Running Agents Fail - Compaction preserves some context, but it does not reliably pass clear instructions to the next agent. - Agents tend to try to do too much at once, often running out of context mid-implementation and leaving a feature half-built and undocumented. - Later agents may look at partial progress and declare the whole project finished too early. - Without a clean handoff, each new session must spend time guessing what happened and getting the basic app working again. ## The Two-Part Solution - **Initializer agent:** The first session uses a specialized prompt to create an `init.sh` script for starting the dev server, a `claude-progress.txt` log of agent activity, and an initial git commit showing the added files. - **Coding agent:** Every later session makes incremental progress on one feature, then leaves structured updates through git commits and progress notes. - The two agents differ only in their initial user prompt. The system prompt, tools, and harness are otherwise identical. ## Environment Scaffolding ### Feature List - The initializer expands the user's prompt into a comprehensive JSON feature list. The claude.ai clone example produced over 200 features, each with a category, description, verification steps, and a `passes` field. - All features start as failing, giving later agents a clear picture of full functionality. - Coding agents may only change the `passes` status. The prompt forbids removing or editing tests. - JSON was chosen over Markdown because the model is less likely to inappropriately overwrite it. ### Incremental Progress and Git - Coding agents work on one feature at a time, which curbs the tendency to one-shot the app. - Agents commit to git with descriptive messages and update the progress file, so bad changes can be reverted and working states recovered. - This removes the need for each new session to reconstruct what happened. ### Testing - Claude often marked features complete after unit tests or curl checks, without confirming they worked end-to-end. - Explicitly prompting it to use browser automation (Puppeteer MCP) and test as a human user would markedly improved results, exposing bugs not visible from the code alone. - Remaining limitations include weak vision and an inability to see browser-native alert modals, which made features relying on them buggier. ## Getting Up to Speed Each coding session starts with a consistent routine: - Run `pwd` to confirm the working directory. - Read the git log and progress file to see recent work. - Read the feature list and select the highest-priority unfinished feature. - Run `init.sh` to start the dev server and perform a basic end-to-end check, such as creating a chat and receiving a response. This catches any broken state left by the previous session before new work begins. ## Failure Modes and Mitigations - **Premature victory:** The initializer writes a feature list; the coding agent works on one feature and verifies it. - **Buggy or undocumented handoffs:** The initializer creates a git repo and progress notes; the coding agent reads them first and ends each session with a commit and update. - **Premature completion marks:** Agents self-verify every feature before marking it passing. - **Time spent figuring out how to run the app:** The initializer writes `init.sh`, which the coding agent runs at the start of each session. ## Open Questions and Future Work - It is unclear whether a single general-purpose coding agent performs best, or whether specialized agents for testing, QA, or code cleanup would do better. - The demo targets full-stack web development. Anthropic hopes to generalize these lessons to fields such as scientific research and financial modeling.

Anthropic2025-10-164 min readCurated summary

Equipping agents with Agent Skills

# Agent Skills: Packaging Procedural Knowledge for Agents Anthropic introduces Agent Skills, organized folders of instructions, scripts, and resources that agents can discover and load on demand to perform specialized tasks. The core argument is that as general-purpose agents gain access to full computing environments, they need a composable, scalable, and portable way to acquire domain expertise, rather than relying on fragmented, custom-built agents for each use case. Skills are published as an open standard and are supported across Claude.ai, Claude Code, the Claude Agent SDK, and the Claude Developer Platform. ## Anatomy of a Skill - At its simplest, a skill is a directory containing a `SKILL.md` file. - The file begins with YAML frontmatter that includes two required fields, `name` and `description`. - At startup, the agent preloads the name and description of every installed skill into its system prompt, so it knows when each skill applies without loading the full content. - If a skill seems relevant, Claude reads the full `SKILL.md` into context. - Complex skills can bundle additional files (for example, `reference.md` or `forms.md`) that `SKILL.md` references by name. Claude loads these only when needed. - The PDF skill used as the example keeps form-filling instructions in a separate file, so the core skill stays lean. ## Progressive Disclosure - Skills load information in levels: metadata first, then the core instructions, then linked files as needed. This works like a manual with a table of contents, chapters, and an appendix. - Agents with filesystem and code execution access don't need to load an entire skill into context, so the amount of material a skill can contain is effectively unbounded. ## Skills and the Context Window - The context starts with the system prompt, the metadata for installed skills, and the user's message. - When a request matches a skill, Claude uses a Bash tool to read that skill's `SKILL.md`. - Claude then decides whether to read any bundled files, such as `forms.md`, before completing the task. ## Executable Code in Skills - Skills can include scripts that Claude runs as tools. - Code suits operations that LLMs handle poorly or expensively, such as sorting or deterministic processing. Running a script is also consistent and repeatable. - The PDF skill includes a Python script that extracts form fields from a PDF. Claude can run it without loading the script or the PDF into context. ## Developing and Evaluating Skills - **Start with evaluation:** Run agents on representative tasks, find where they struggle, and build skills to close those gaps incrementally. - **Structure for scale:** Split large `SKILL.md` files into referenced files, keep rarely combined paths separate to save tokens, and make clear whether scripts should be executed or read. - **Think from Claude's perspective:** Observe how Claude uses skills in practice. The `name` and `description` fields matter most, since Claude uses them to decide whether to trigger a skill. - **Iterate with Claude:** Have Claude capture successful approaches and common mistakes into the skill, and ask it to self-reflect when it goes off track. ## Security Considerations - Malicious skills can introduce vulnerabilities or direct Claude to exfiltrate data or take unintended actions. - Install skills only from trusted sources. For less-trusted skills, audit bundled files, especially dependencies, scripts, and instructions that connect to external networks. ## Looking Ahead - Anthropic plans to add features covering the full skill lifecycle: creating, editing, discovering, sharing, and using skills. - Skills may complement Model Context Protocol (MCP) servers by teaching agents multi-step workflows that involve external tools. - The longer-term goal is for agents to create, edit, and evaluate their own skills, codifying their behavior into reusable capabilities. Skills are intentionally simple in concept and format, which makes it easier for organizations, developers, and end users to build customized agents. Developers can start with the Skills docs and cookbook.

Anthropic2025-09-295 min readCurated summary

Effective context engineering for AI agents

Anthropic argues that context engineering is the natural successor to prompt engineering. Instead of only writing better instructions, engineers must curate the full set of tokens an LLM sees during inference, because models have a finite "attention budget" that degrades as context grows. As agents run longer, they need strategies such as just-in-time retrieval, compaction, structured note-taking, and sub-agent architectures to keep that context small and high-signal. ## From Prompt Engineering to Context Engineering - Prompt engineering focuses on writing and organizing instructions, particularly system prompts. - Context engineering covers everything that lands in the context window during inference: system prompts, tools, external data, message history, and more. - Agents that run in loops generate new information every turn, so context must be continually curated and refined. ## Why Context Is a Finite Resource - **Context rot:** As the token count grows, a model's ability to accurately recall information from its context declines. This happens across all models, though degradation rates vary. - **Architectural limits:** Transformers let every token attend to every other token, creating n² pairwise relationships, which stretches attention thin as context grows. - **Training skew:** Models see shorter sequences more often in training, so they have less experience with long-range dependencies. - **Gradual degradation:** Techniques like position encoding interpolation extend context length with some loss in positional precision. The result is a performance gradient, not a hard cliff. ## Anatomy of Effective Context - **System prompts:** Aim for the "right altitude," between brittle hardcoded logic and vague high-level guidance. Organize sections with XML tags or Markdown headers, and start with a minimal prompt, then add instructions based on observed failures. - **Tools:** Keep tool sets minimal and non-overlapping, since a human who can't pick the right tool can't expect an agent to either. Tools should return token-efficient output and have clear, unambiguous parameters. - **Examples:** Curate a small set of diverse, canonical few-shot examples instead of listing every edge case in the prompt. ## Retrieval: From Pre-Loading to Just-in-Time Context - Anthropic defines an agent simply as "LLMs autonomously using tools in a loop." - Embedding-based retrieval before inference is common, but agents increasingly use "just-in-time" retrieval. They keep lightweight identifiers such as file paths, stored queries, or links, and load data on demand with tools. - Claude Code analyzes large databases by writing targeted queries and using commands like `head` and `tail`, without loading full datasets into context. - Metadata such as folder names, file names, and timestamps helps agents infer purpose and relevance. A `test_utils.py` in `tests/` means something different from one in `src/core_logic/`. - **Progressive disclosure:** Agents build understanding incrementally, with each step informing the next. - **Trade-offs:** Runtime exploration is slower and needs good tool design and heuristics, or agents can waste context on dead ends. - **Hybrid approach:** Claude Code drops `CLAUDE.md` files into context up front and uses `glob` and `grep` for on-demand retrieval. Less dynamic domains like legal or finance may suit this hybrid model well. ## Context Engineering for Long-Horizon Tasks Tasks like large migrations or extended research exceed the context window, so Anthropic recommends three techniques. Waiting for bigger windows isn't enough, since context pollution and relevance problems persist at every size. ### Compaction - Summarize a conversation nearing the context limit and start a new window with the summary. - Claude Code preserves architectural decisions, unresolved bugs, and implementation details, discards redundant tool outputs, and keeps the five most recently accessed files. - Tune the compaction prompt first for recall, then for precision. - **Tool result clearing** is a light-touch form of compaction: once a tool result is deep in history, the raw output is often no longer needed. ### Structured Note-Taking - The agent writes persistent notes outside the context window and reloads them later, such as a to-do list or a `NOTES.md` file. - Claude playing Pokémon tracked training progress over thousands of steps, mapped explored regions, and kept combat notes, then resumed multi-hour sequences after context resets. - The memory tool, released in public beta with Sonnet 4.5, supports file-based storage for knowledge that persists across sessions. ### Sub-agent Architectures - A lead agent coordinates a high-level plan while specialized sub-agents handle focused tasks in clean context windows. - Each sub-agent may use tens of thousands of tokens but returns a condensed summary, often 1,000–2,000 tokens. - This pattern substantially outperformed single-agent systems on complex research tasks. ### Choosing an Approach - **Compaction:** Extensive back-and-forth conversations. - **Note-taking:** Iterative development with clear milestones. - **Multi-agent architectures:** Complex research where parallel exploration pays off. ## Conclusion The guiding principle is to find the smallest set of high-signal tokens that makes the desired outcome most likely. Anthropic expects smarter models to need less prescriptive engineering, but treating context as a finite resource will stay central to building reliable agents. Its advice is to "do the simplest thing that works."

Anthropic2025-09-114 min readCurated summary

Writing effective tools for AI agents

# Designing Tools for AI Agents Tools for agents are a different kind of software: they form a contract between deterministic systems and non-deterministic agents, so they must be designed for how agents perceive and act, not simply wrapped around existing functions or APIs. The post argues that effective tools come from an evaluation-driven loop: build a quick prototype, measure it against realistic multi-step tasks, analyze agent transcripts, and iterate, often with agents like Claude Code doing the refactoring themselves. ## Building and Evaluating Tools - Prototype quickly by wrapping tools in a local MCP server or Desktop extension, connecting them to Claude Code (`claude mcp add`) or Claude Desktop, or passing them directly into API calls. - Provide LLM-friendly documentation (such as `llms.txt` files) to Claude when it helps write the tools. - Generate evaluation tasks grounded in realistic data and services, avoiding simplistic sandboxes. Strong tasks often require dozens of tool calls, while weak ones are single lookups. - Pair each task with a verifiable outcome, using exact matching or an LLM judge, and avoid verifiers that reject correct answers over formatting differences. - Run evaluations programmatically with simple agentic loops, one per task, and ask agents to output reasoning and feedback before their responses to encourage chain-of-thought behavior. - Track accuracy alongside runtime, total tool calls, token consumption, and tool errors. Frequent redundant calls can suggest consolidation opportunities. - Analyze transcripts for confusion, not just final answers, since agents often omit what matters most. Use held-out test sets to avoid overfitting. ## Choosing the Right Tools - Avoid tools that merely mirror API endpoints. Agents have limited context, so a `list_contacts` tool that dumps everything wastes it, while `search_contacts` returns only what's relevant. - Consolidate multi-step workflows into single tools, such as `schedule_event` instead of separate list and create calls, `search_logs` instead of `read_logs`, or `get_customer_context` instead of three separate lookups. - Give each tool a clear, distinct purpose, since overlapping tools distract agents from efficient strategies. ## Namespacing and Response Design - Group related tools under prefixes by service and resource (e.g., `asana_projects_search`) so agents can select the right tool. Prefix versus suffix choice affects results and should be tested per model. - Return high-signal fields like `name` or `file_type` rather than low-level identifiers like `uuid` or `mime_type`. Resolving UUIDs to human-readable identifiers reduced hallucinations in retrieval tasks. - Add a `response_format` enum (e.g., `concise` or `detailed`) so agents can choose between readable names and technical IDs needed for downstream calls. The post's example shows a 206-token detailed response versus a 72-token concise one. - Response structure (XML, JSON, Markdown) also affects performance, and the best choice varies by task and model. ## Token Efficiency and Error Handling - Use pagination, range selection, filtering, and truncation with sensible defaults. Claude Code caps tool responses at 25,000 tokens by default. - When truncating, guide agents toward efficient strategies, such as many small targeted searches instead of one broad search. - Write error messages that state specific, actionable fixes rather than opaque codes or tracebacks. ## Prompt-Engineering Tool Descriptions - Write descriptions as if onboarding a new hire, making implicit context explicit: query formats, niche terminology, and resource relationships. - Use unambiguous parameter names (`user_id` rather than `user`) and enforce inputs and outputs with strict data models. - Small description refinements can yield large gains. The post reports that precise description changes helped Claude Sonnet 3.5 reach state-of-the-art on SWE-bench Verified. - Tool annotations can disclose whether a tool needs open-world access or makes destructive changes. ## Conclusion Effective agent tools are clearly defined, use context judiciously, combine well across workflows, and let agents solve real tasks intuitively. Because the mechanisms agents use will keep evolving, a systematic, evaluation-driven process is the most reliable way to keep tools improving alongside the models that use them.

Anthropic2025-06-135 min readCurated summary

How we built our multi-agent research system

Anthropic's engineering team describes how they built the multi-agent Research feature for Claude, where a lead agent plans a query and spawns parallel subagents that search simultaneously. Their internal evaluation found the multi-agent setup (Claude Opus 4 lead, Sonnet 4 subagents) outperformed a single Opus 4 agent by 90.2%, mainly because it spends more tokens on hard, parallelizable problems. The post argues that this gain comes with roughly 15× the token cost of chat, so it only suits high-value, breadth-first tasks. Moving these systems to production, they add, is much harder than building a prototype. ## Why Multi-Agent Systems Help Research - Research is open-ended and path-dependent, so the steps can't be hardcoded in advance, and a linear pipeline can't handle it. - Subagents compress information by working in parallel, each with its own context window, and returning only the most important findings to the lead agent. - Token usage explained about 80% of performance variance on the BrowseComp evaluation, with tool calls and model choice explaining most of the rest, so distributing work across agents adds reasoning capacity. - Agents use about 4× the tokens of chat, and multi-agent systems about 15×, so they fit only tasks valuable enough to justify the cost. - Coding tasks, which have fewer parallelizable subtasks and need shared context, are a poor fit today. ## Architecture: Orchestrator-Worker Pattern - The lead agent analyzes the query, develops a strategy, and spawns subagents that iteratively search and return condensed results. - Unlike static RAG, which fetches chunks similar to the query once, this design runs multi-step searches that adapt to new findings. ## Prompt Engineering Principles - **Simulate the agents:** Running the exact prompts and tools step by step revealed failure modes such as agents continuing after they already had enough results, using overly verbose queries, or picking the wrong tools. - **Delegate with detail:** Vague instructions caused duplicated work and gaps. Each subagent needs an objective, an output format, tool guidance, and clear task boundaries. - **Scale effort to complexity:** Simple fact-finding uses 1 agent with 3–10 tool calls, comparisons use 2–4 subagents with 10–15 calls each, and complex research uses more than 10 subagents. Without these rules, early versions overinvested in simple queries. - **Design tools deliberately:** Each tool needs a distinct purpose and clear description, and agents should examine available tools first and match tool choice to user intent. - **Let Claude improve its own tools:** A tool-testing agent that rewrote flawed MCP tool descriptions reduced task completion time by 40%. - **Start wide, then narrow:** Agents should begin with short, broad queries and refine from there, instead of starting with long, specific ones. - **Use extended thinking as a scratchpad:** The lead agent plans and sets subagent roles, and subagents evaluate tool results with interleaved thinking. - **Parallelize:** The lead agent spins up 3–5 subagents in parallel, and subagents use 3+ tools in parallel, cutting research time by up to 90% on complex queries. ## Evaluating Multi-Agent Systems - Agents can reach the same correct answer by different valid paths, so evaluations should judge outcomes and reasonable process rather than fixed steps. - Start with about 20 representative queries. Early changes have large effects, so small samples reveal them. - An LLM judge using a single prompt that outputs 0.0–1.0 scores and a pass/fail grade agreed best with human judgment. It scores factual accuracy, citation accuracy, completeness, source quality, and tool efficiency. - Human testing caught problems automation missed, such as early agents favoring SEO-optimized content farms over authoritative academic PDFs or personal blogs. Adding source-quality heuristics fixed this. ## Production Reliability Challenges - **Stateful errors compound:** Agents run for long periods, so the system checkpoints and resumes from the failure point rather than restarting, combining model adaptability with retry logic. - **Debugging is hard:** Because agents are non-deterministic, the team added full production tracing and monitors decision patterns, without reading individual conversation contents, to protect privacy. - **Deployment is delicate:** Agents may be mid-process during updates, so rainbow deployments gradually shift traffic between old and new versions while both run. - **Synchronous execution is a bottleneck:** Lead agents wait for each subagent batch to finish and can't steer subagents mid-task. Asynchronous execution would add parallelism but complicates result coordination, state consistency, and error propagation. ## Conclusion The authors conclude that multi-agent research systems can run reliably at scale, but only with careful engineering, extensive testing, detailed prompt and tool design, and close collaboration across research, product, and engineering. Users reported finding business opportunities, navigating healthcare options, fixing technical bugs, and saving days of research work. ## Appendix Tips - **End-state evaluation:** For agents that change persistent state, judge whether the final state is correct, using checkpoints for complex workflows. - **Long-horizon memory:** Agents summarize completed phases, store essential information externally, and hand off to fresh subagents when context limits approach. - **Filesystem artifacts:** Subagents store outputs such as code, reports, or data visualizations in external systems and pass lightweight references to the coordinator, which avoids information loss and reduces token overhead.

Anthropic2025-03-203 min readCurated summary

The "think" tool for complex tool use

# The "Think" Tool for Claude Agents Anthropic found that giving Claude a dedicated "think" tool, a scratchpad it can write to mid-response, improves agentic tool use. The tool helps with following policies, making consistent decisions, and handling multi-step problems, and it requires little implementation effort. The post notes that extended thinking now covers most of these cases, so the dedicated tool is recommended mainly for specific scenarios. The benefits come from giving Claude room to reason about new information gathered from tool outputs, not from extended reasoning before it acts. ## How the "Think" Tool Differs from Extended Thinking - Extended thinking happens before Claude generates a response and plans its approach in advance. - The "think" tool happens during response generation, letting Claude pause after receiving tool results to check whether it has what it needs to continue. - The tool suits complex tool calls, long tool-call chains, policy-heavy environments, and sequential decisions where mistakes are costly. - Extended thinking suits simpler tool use, non-sequential calls, and tasks like coding, math, and physics that don't involve tools. - The tool is defined with a single `thought` string input. It doesn't obtain new information or change any state. It only logs the thought. ## Results on τ-Bench τ-bench simulates customer service conversations and measures pass^k, the probability that all k trials of a task succeed, which captures consistency. - **Airline domain (the hardest):** The "think" tool with an optimized prompt reached 0.570 pass^1, versus 0.370 for the baseline, a 54% relative improvement. The prompt included worked examples of how to reason about policies. The tool alone and extended thinking performed similarly, both better than baseline but well behind the combined approach. - **Retail domain (easier):** The "think" tool alone reached 0.812 pass^1, versus 0.783 for the baseline, with no extra prompting needed. - Gains held up across k=1 to k=5, which points to better handling of edge cases and more consistent policy adherence. ## Results on SWE-Bench - A "think" tool with a description tailored to software debugging was added to the SWE-bench setup for Claude 3.7 Sonnet, which contributed to a state-of-the-art score of 0.623. - The isolated effect was a 1.6% average improvement, statistically significant (Welch's t-test, p < .001). ## Implementation Guidance - **Use it for:** tool output analysis that may require backtracking, policy-heavy environments requiring compliance checks, and sequential decisions where each step depends on the last. - **Skip it for:** single or parallel tool calls, and simple instruction following where default behavior is already adequate. - **Prompting:** Domain-specific examples help the most on difficult tasks. Examples cover the expected level of detail, how to break instructions into steps, decision trees, and checks for missing information. - **Placement:** For long or complex guidance, put instructions in the system prompt rather than the tool description. - **Costs and risks:** The tool adds prompt length and output tokens. It doesn't change external behavior unless Claude calls it, so it's low-risk to add. The post concludes that the "think" tool is not a universal fix, but for the right workloads it offers meaningful reliability gains with minimal implementation work. The authors also note that the results generalize to Claude 3.5 Sonnet (New).