Skip to content
Forward Deployed

Forward Deployed
Additional System Designs

Agent That Adapts to New Tasks

By Sourav Banerjee · Last updated 13 Oct 2026 · Report an issue

Case studyAdvanced4 documents, 47 min in total
For
Engineers preparing for Forward Deployed, solutions or applied-AI engineering interviews
Assumes
Comfort with retrieval, agents and basic cloud architecture — the related reviews below cover each
Objectives
  • Explain a complete design and the trade-offs behind it
  • Reuse its structure on an unfamiliar design question
How to use it
Read the tabs left to right; a single-document case is complete on its own. Where a Practice Worksheet exists, attempt it before the Model Answer.
Reading order
Sources
The references for every tab are in Interview Guide 3 → References.

Condensed from the sources credited on the How It Works page

Interview Guide 1 · 13 min — The complete case in one document — no companion tabs are needed.

Self-Adapting Agent

An agent that adapts to new tasks without supervision needs the freedom to change its own behaviour, and every change it makes is a regression nobody reviewed.

"Autonomously adapt" does not mean "retrain itself". Most adaptation belongs in cheap, reversible places, such as context, memory and procedures. Each change passes the same evaluation gate a human change would. This page is the standalone day-before pack for this case.

Case What it contributes here
#80 Anthropic MLE: design an agentic AI system that can autonomously adapt to new tasks Sections 1 to 14: the whole design on one running example
Cost self-drill Section 15

Much of this page is own construction, but its backbone is sourced. No worked answer exists for this prompt. The prompt comes from the decomposition question bank, Tier 1 prompt 15. The spine comes from the Cracking book's learning chapter. Its four learning surfaces, skill promotion gate and data flywheel answer most of this prompt directly. The memory write policy comes from its memory chapter, and the release gate from its validation chapter. Sections and tables marked (own construction) were built for this page. Every number marked (assumption) is a whiteboard illustration, not a sourced figure.

The running example is the Cracking book's own: an internal operations agent. It handles requests such as "restart service X" and "roll back flag Y". New request types appear every week as teams ship new systems.


1. Pin Down What "Adapt" Means Before Drawing Anything

A system cannot be designed toward a verb nobody defined. "Adapt to new tasks" hides at least five different mechanisms. They differ by an order of magnitude in cost and by how easily a change can be undone.

The Cracking book names four places an agent's improvement can live: context, memory, procedure and parameters. Each is roughly ten times slower and costlier to iterate on than the one before. This page adds prompt optimisation as a separate rung between procedure and parameters (own construction). It changes behaviour broadly, like training, but stays reversible, like a prompt.

Rung What changes Example in the ops agent Iteration time Undo
1. Context Which instructions, examples and skills are loaded for this request Load the "feature flags" skill and three similar past runs Minutes Instantly
2. Memory Stored facts, preferences, corrections "Service X restarts need a drain first" Immediate Supersede the fact
3. Procedure Validated tool sequences saved as named skills A promoted "safe restart" workflow Hours Pin the previous version
4. Prompt optimisation (own construction) Instructions and examples searched against a scored dev set A rewritten planner prompt that raises tool-choice accuracy Hours to a day Revert the prompt version
5. Parameters Model weights A tuned small router for the top task types Days to weeks Redeploy the old model

The book's rule is to work down this table, not up. In the book's view, most teams that reach for fine-tuning have not yet fixed their tool schemas, retrieval or example selection. Fine-tuning then bakes those defects into weights that take weeks to change.

Ask these questions before committing (own construction).

Question Why it changes the design
What counts as a "new task": a new request type, a new tool, or a new domain? A new request type is a context problem; a new tool needs an onboarding path; a new domain needs knowledge and evaluation data
Is there an external signal of success, such as a test, a validator or a ticket closed without reopening? Without one, the agent cannot learn safely, because it has nothing trustworthy to learn from
Which actions are reversible? Reversible actions can be tried and learned from; irreversible ones need a human before and after
Who owns each capability? An owner reviews promotions and is paged when a skill regresses
How fast must a new task become reliable: hours, days or a quarter? Hours forces the cheap rungs; a quarter permits training
Is the adaptation per user, per tenant or global? Per-tenant learning needs isolation in every store

A safe default, stated aloud if the interviewer does not answer, is this. New request types arrive weekly. Most have a checkable outcome. Writes to production systems are partly reversible. Adaptation is global, but each skill has a team owner.

"Before I design anything I want 'adapt' pinned down. There are five places learning can live, from the context of one request up to the model's weights. Each rung costs roughly ten times more than the last and is harder to undo. I'll design from the cheap end and only climb when a measured gap forces it."

2. State Requirements as Testable Constraints

A requirement that cannot fail a test is a wish. "Gets better over time" is a wish. "Success on a new task type reaches the baseline within 14 days without a regression on any existing type" is a constraint (own construction throughout this section; thresholds are assumptions unless marked sourced).

The functional must-haves are six. Recognise when a request does not match any known capability. Attempt it safely with a general fallback, escalating when confidence is low. Record every run with its outcome, so learning has evidence. Turn repeated successes into candidate skills, memories or prompt changes. Evaluate each candidate before it affects real traffic. Remove learned behaviour automatically when it starts to fail.

The should-haves come later. Per-tenant specialisation. A tuned small model for high-volume task types. A dashboard that shows owners what the agent learned this week.

Non-functional constraint Stated so it can be tested
No regression No existing task stratum drops more than 3 points after any promotion (the per-stratum floor is sourced from ch12's segment-collapse fix)
Promotion bar Candidate beats baseline by 5 points offline, then survives at least 200 live shadow attempts (sourced: the book's reference gate values)
Demotion A skill falling 4 points below baseline is removed automatically (sourced)
Time to competence New task type reaches baseline success within 14 days of first sighting (assumption)
Safety Zero promotions that widen tool permissions; every irreversible action approved by a person
Traceability Every behaviour change has a version, a source trace set, an evaluation report and an owner
Latency Runtime adaptation adds at most 150 ms at p95 before the first model call (assumption)
Cost Learning-plane spend capped as a share of serving spend; cap breach blocks new candidates (assumption: 10%)

Each must-have needs an owner in the architecture.

Requirement Primary component
Recognise the unknown Capability router with a novelty score
Attempt safely Bounded agent loop behind the tool gateway, with escalation
Record evidence Trace and outcome store
Turn success into candidates Learning plane: skill extractor, memory writer, prompt optimiser, dataset builder
Evaluate before traffic Evaluation gate plus shadow runner
Remove failures Live monitor with automatic demotion

3. Size the Adaptation Before Choosing a Rung

Arithmetic decides which rungs are even affordable (own construction; every input is an assumption, arithmetic is exact).

Quantity Assumed value Consequence
Requests per day 20,000 across 40 known task types Average 500 per type, heavily skewed
New task types per week 3 About 150 a year; the catalogue must evict as well as grow
Traffic for a new type 30 requests a day 200 shadow attempts take about 7 days at full shadow
Cost per agent run $0.03 Serving is about $600 a day
Offline eval suite per candidate 640 cases, paired with baseline 1,280 runs = $38.40 per candidate
Candidates generated per week 50 $1,920 a week, about 46% of the $4,200 weekly serving bill

Two lessons fall out of the table. First, rare task types cannot be promoted quickly. At 30 requests a day, the shadow minimum alone takes a week, and that sets the honest time to competence. Second, candidate volume drives learning cost, not training. Fifty candidates a week breaks a 10% learning budget almost five times over. So the extractor must deduplicate and pre-filter before anything reaches the paid evaluation.

The sample-size arithmetic sets what the gate can even detect. The validation chapter gives it as n ≈ 15.7 × p(1−p) / δ² per arm. At a baseline of 0.8, 200 cases detect only differences of about 11 points. A 5-point gain needs about 1,000 cases per arm. So the 200-attempt shadow proves "not much worse", not "5 points better". Say that aloud; it is a rare and strong signal.

4. Draw the Architecture as Two Loops With One Gate

The runtime loop serves requests. The learning loop proposes changes. They meet at exactly one place, the evaluation gate. Nothing learned reaches live traffic without passing it (own construction for every diagram in this section).

 ╔══════════════════════ CONTROL PLANE (every change is a version) ═════════════════════╗
 ║ capability registry: skills, memories, prompts, models — each with owner, version,     ║
 ║ status (candidate / shadow / live / demoted) · permission policy · budgets · kill switch ║
 ╚═════════════════════════════════════════╤══════════════════════════════════════════════╝
                                           │ reads only LIVE versions
 ╔════════════════════════════ RUNTIME LOOP ══════════════════════════════════════════════╗
 ║  request ─> capability router ──known──> load skill + examples + memories ─┐           ║
 ║                   │ (novelty score)                                        v           ║
 ║                   └──novel──> general fallback + tighter bounds ─> context assembler   ║
 ║                                                                            │           ║
 ║                        bounded agent loop (steps, tokens, time, spend caps)            ║
 ║                                   │                                                    ║
 ║                        tool gateway (authorise · validate · execute · classify)        ║
 ║                                   │                     └─ irreversible? ─> human      ║
 ║                        outcome signal: validator · test · ticket state · user feedback ║
 ║                                   │                                                    ║
 ║                        trace + outcome store ───────────────────────────────┐          ║
 ╚═════════════════════════════════════════════════════════════════════════════│══════════╝
 ╔════════════════════════════ LEARNING LOOP (offline, budgeted) ═══════════════v══════════╗
 ║  flywheel gates: dedupe ─> split by time and user ─> adjudicate low-agreement cases      ║
 ║        │                                                                                ║
 ║        ├─> skill extractor (generalise successful trajectories)                         ║
 ║        ├─> memory writer (durable? reusable? attributable? permitted?)                  ║
 ║        ├─> prompt optimiser (search instructions and examples on a dev set)             ║
 ║        └─> dataset builder (only when rungs 1–4 are exhausted)                          ║
 ║                                   │ candidates                                          ║
 ║  EVAL GATE: held-out, paired, per stratum · safety absolute · cost visible              ║
 ║        ├─ fail ─> discard, log reason                                                   ║
 ║        └─ pass ─> shadow on live traffic (≥200 attempts) ─> owner review ─> LIVE        ║
 ║  LIVE MONITOR: success per stratum ─> 4 points below baseline ─> auto-demote            ║
 ╚══════════════════════════════════════════════════════════════════════════════════════════╝

The same design for viewers that render Mermaid:

Diagram: Control plane; (Capability registry: versions, owners, status); Permission policy, budgets, kill switch; Runtime loop; Request; Capability router: novelty score; Load live skill, examples, memories; General fallback with tighter bounds; Context assembler; Bounded agent loop; Tool gateway; Human approval; Outcome signal; (Trace and outcome store); Learning loopDiagram: Control plane; (Capability registry: versions, owners, status); Permission policy, budgets, kill switch; Runtime loop; Request; Capability router: novelty score; Load live skill, examples, memories; General fallback with tighter bounds; Context assembler; Bounded agent loop; Tool gateway; Human approval; Outcome signal; (Trace and outcome store); Learning loop
Component Job Fails how
Capability registry Holds every learned artefact with version, owner, status and evidence Without it, nobody can say what the agent learned or undo it
Capability router Matches a request to live skills; scores novelty Misroutes silently; a novel request forced into a wrong skill
General fallback Attempts unknown tasks with tighter bounds and earlier escalation Given the same bounds as known tasks, it explores dangerously
Context assembler Loads skill instructions, examples and memories under per-section budgets Loads everything; context rots and costs climb
Bounded agent loop Plans and acts within step, token, time and spend caps Loops forever on a task it cannot do
Tool gateway Authorises, validates and executes every action; routes irreversible ones to a person Learned procedures call tools the agent was never allowed to call
Outcome signal Provides an external verdict: test, validator, ticket state Self-graded success teaches confident errors
Trace and outcome store Records trajectory, versions used and outcome for every run Learning has nothing trustworthy to learn from
Flywheel gates Dedupe, split by time and user, adjudicate Duplicates inflate every offline number
Skill extractor Generalises successful trajectories into parameterised skills Library fills with skills that worked once
Memory writer Admits only durable, reusable, attributable, permitted facts Memory fills with noise and contradictions
Prompt optimiser Searches prompt and example variants against a scored dev set Overfits the dev set; the prompt wins offline and loses live
Dataset builder Prepares training data for rung 5 Trains in the old system's errors
Eval gate Blocks candidates that regress any stratum or touch safety Gating on the mean hides a segment collapse
Shadow runner Runs the candidate beside live behaviour without acting Shadow on too little traffic proves nothing
Live monitor Tracks per-stratum success and auto-demotes Stale skills keep running after an API changes

5. Detect the Unknown Before Trying to Handle It

An agent cannot adapt to a task it has not noticed is new. The hardest failure is not "I do not know how". It is confidently forcing a new request into the nearest known skill (own construction throughout this section).

Score novelty on three signals. The router's retrieval score against the skill catalogue falls below a threshold. The request names a system, tool or entity absent from every live skill. The router's top two candidates are close, so its choice is a coin flip. Any one of them routes the request to the general fallback instead of a skill.

Treat the fallback as a different operating mode. Cut the step budget. Allow read-only tools freely and require approval for writes. Escalate earlier. The first dozen runs of a new task type are both the riskiest and the most valuable. They carry the evidence every later rung learns from.

The skill-loading pattern from the FDE (Forward Deployed Engineer) handbook supports this. The agent starts with a lightweight catalogue of skill names and triggers. It loads one skill's full instructions only when selected, then releases that context. Trigger descriptions need counterexamples as well as examples, or the wrong skill activates. Evaluate triggering separately from execution. A skill that runs perfectly after the wrong trigger is still a wrong answer.

6. Adapt Within One Request Before Changing Anything Permanent

The cheapest adaptation changes nothing that outlives the request. Rung 1 covers two mechanisms, both runtime-only.

Dynamic example selection. A fixed set of examples in the system prompt is chosen for the average request, so it is optimal for none. Retrieve past runs similar to this request instead. Then rank them by recorded outcome, not just similarity. A similar run that went badly teaches the model to go badly. Enforce diversity so three near-duplicates do not crowd out the useful one. The book's scoring formula is λ × relevance − (1−λ) × redundancy + 0.15 × outcome score.

One cost follows. Examples sit above the user's turn, so swapping them per request breaks the prompt prefix cache from that point on. Only what sits above them, such as tool definitions and the fixed system prompt, still hits the cache. Where traffic clusters, cache one example set per cluster rather than choosing per request.

Reflexion. A failed attempt becomes a written lesson placed in context for the next attempt. The model itself does not change. The book says it works reliably only with three conditions: an external failure signal, a lesson specific enough to change behaviour, and a hard cap on attempts. "Expected ISO 8601 UTC, I sent local time" is a lesson. "Be more careful" is not. A model grading its own attempt without an external signal tends to produce confidently wrong lessons. Those lessons then contaminate every retry after them.

A Reflexion implementation splits the pattern into actor, evaluator and self-reflection roles. For #80, one design rule sits on top: the evaluator must be external. A validator, a test or an API response counts. The same model's opinion does not.

Where next

Revise the concepts