Estimated time: ~4 hours for someone who has finished the five independent exercises of L01-L05 (an estimate, not yet measured with real learners). Main tools:
lab.classify,lab.tools,lab.loop,lab.planning,lab.trace,lab.archmapincode-labs/l3-m01. Every system, tool, policy, task, cost (cu, a pseudo cost unit) and result in the lab is simulated (deterministic functions written by the lab author): no model calls, no API key needed, and tools run only inside a temporary sandbox directory.
Main hands-on assignment
Business context
The HocVui team (fictional) is about to give HocVui Assistant a tool that sends a student's note to a teacher, so the new version is called HocVui Assistant v2. The previous owner left one line in the ticket: "this agent is safe, it has a step limit". That line does not say whether the agent is a workflow or an agent in which sense, which limit stops what, how the two planning patterns differ, whether the trace is enough to answer "what did it do", and how the new tool changes the risk map. You need to build an agent architecture map with risk annotations for v2 and the accompanying verification products: a workflow-or-agent label with reasons, a stop-condition test suite, a comparison of three patterns on the same tasks, a linted trace with secrets redacted, and one person's decision; then answer: what does this map tell you, and what does it not yet prove?
Problem to solve
A label can be wrong about what it says; a step limit does not catch semantic repetition and can leave a half-finished state; two patterns compared on nine tasks chosen by the question setter are not evidence about a real model; a trace that is clean under lint can still contain a tool that stored a raw secret; a map that passes the validator can still drift away from the code. Your job is to measure each part separately under the fixed configuration below, state what each part does not prove, and leave the final decision to one named person. Lints and validators only flag; the loop guard and the limits lint stop the run (fail closed); nothing approves.
Input data
The data is in code-labs/l3-m01/data/ (systems.json, tasks.json, kb.json, arch_example.json) and is fictional; do not edit lab/, data/ or exercises/. The v2 map starts from arch_example.json (HocVui Assistant) and adds one tool and one node.
The fixed configuration (so every submission is reproducible and comparable):
| Item | Value |
|---|---|
| Classification (Task 1) | The 12 systems in systems.json (lab.classify); the two unclear cases are read with your own function |
| Ten tool calls (Task 1) | Run in order, on ONE temporary sandbox (Sandbox) with call_tool: (1) calc {"expression": "(15+25)*3"}; (2) calc {"expression": "2**3"}; (3) calc {"expression": "1/0"}; (4) lookup {"key": " Số Chẵn "} (Vietnamese for "Even Number"); (5) notes_add {"name": "ban_nhap_2", "text": "ok"}; (6) notes_add {"name": "Ban-nhap", "text": "ok"}; (7) notes_read {"name": "chua_co"}; (8) tool name Notes_read with {"name": "ban_nhap_2"}; (9) calc {"expression": true}; (10) calc with raw parameters {"expression": "5", "expression": "6"} |
| Stop scenarios (Task 2) | Ten scenarios with the Scripted policy (or a class that raises an error), each step costing 2 cu for the model call and 1 cu for calc or an unknown tool: (1) two calc then final, max_steps 9; (2) three calc then final, max_steps 4; (3) four calc then final, max_steps 4; (4) calc forever, budget 13, max_steps 9; (5) like (4), budget 14; (6) three unknown tools then final, error_limit 3; (7) two unknown tools, one calc, two unknown tools, final, error_limit 3; (8) five identical calc calls, loop_threshold 3; (9) action {"kind": "dance"}; (10) a policy that raises RuntimeError. The full_steps table for budgets 12, 13, 14, 15 and 40 (calc forever, max_steps 9). Loop guard checks with threshold 2: two calls {"expression": "2+3"} that differ in spaces, two calls 2+3 and 3+2, two parameter sets {"n": 1} and {"n": 1.0}, and four identical calls with state fingerprints f0, f1, f0, f1 |
| Pattern comparison (Task 3) | PL.run_task for the three patterns on the nine tasks in tasks.json, ten seeds p0 to p9; slip probability 0 and 1/5 with the default limits (8 steps, 40 cu); plus one run with probability 0 and max_steps 3 |
| Trace (Task 4) | react on t05 with Tracer("as-trace") (one transient error then success); a Scripted policy calling notes_add with the name lien_he and the text gọi cô Hoa hs07@lop5a.example, khóa sk-QWERTYUIO987, header Bearer z9x8c7v6b5 ("call Ms Hoa", "key") then final, with Tracer("as-secret"); four trace corruptions (see Task 4); three inputs for the blind spots of redact: name at example dot com, {"pass": "abc12345"}, gọi 0903 111 222 ("call") |
| Map (Task 5) | arch_map.json = arch_example.json plus the node share_note (tool, permission network, approval human, side_effect true, observed_by trace_store), the node teacher_inbox (environment, untrusted), three edges (orchestrator->share_note, share_note->orchestrator, share_note->teacher_inbox) and at least two new risks (one for share_note, one for the edge share_note->teacher_inbox, both scoring 6 or more); stop_conditions 8 steps and 40 cu |
Tasks
- Classification and the tool layer (L01). Write the function
agent_properties_missing(spec)inmine.py: for a spec in which the model decides the next step, the sorted list of agent properties the spec lacks among (tools_chosen_by,repeats,feedback_to_model);[]means complete;ValueErrorwhen the spec is invalid (check_spec), does not use an LLM, or the code decides the next step. Reportclassify.md: the labels of the 12 systems with reasons and the count per label; for the twounclearcases, the missing list; a table of the ten calls (tool, raw parameters,ok, error code, content), the total cost, the number of write effects and the notebooks left in the sandbox; what this step does not prove. - A stop-condition test suite (L02). Write the function
full_steps(budget, tool_cost, max_steps, model_cost=2)inmine.py: the number of full steps (one model call and one tool call) that fit the budget andmax_steps;ValueErrorwhen a parameter is not a real integer from 1 up (True, floats and 0 are rejected). Reportstop_suite.md: a table of the ten scenarios (stop reason, steps, cost, tool calls, errors); thefull_stepstable next to the number of tool calls that actually ran; the loop guard check table (theallowresult of each call and how to read it); threelint_limitslines; what this step does not prove. - Comparing three patterns (L03). Write the function
cost_per_success(runs)inmine.py:runsis a list of{"success": bool, "used": int}; return aFraction(total cost of all runs divided by the number of successes),Nonewhen no run succeeds,ValueErrorwhen the list is empty. Reportpatterns.md: three tables (no slips; slip 1/5; no slips withmax_steps3) with the number of runs, success rate, model calls, average cost and cost per success (a fraction plus a decimal rounded half up using integers, no floats); each pattern's failing tasks with no slips and withmax_steps3; what this step does not prove. - Traces and sensitive data (L04). Write the function
report_mismatches(records, claimed_steps, claimed_reason)inmine.py: the sorted list ofSTEPS(the number ofstepspans differs from the claimed steps) andREASON(thestop_reasonattribute of therunspan differs from the claimed reason);ValueErrorwhen the trace does not have exactly one rootrunspan. Reporttrace.md: the span tree,trace_id,summarizeand the two lints of thereactrun ont05; thereport_mismatchesresult for three claims (correct; one step overcounted; wrong stop reason); for the notebook write with a secret: theargumentsattribute of the tool span, the raw notebook content in the sandbox and the conclusion; a table of four trace corruptions (a parent that does not exist on the third span, an end before the start on the third span, the second span never ended,passwordstill in the attributes of the fourth span) with thelint_tracecodes; a table of the three blind spots ofredact; what this step does not prove. - Architecture map and risks (L05). Write the function
untested_risk_ids(m)inmine.py: the sorted ids of the risks whosetestis empty or starts withuntested(whitespace stripped, case-insensitive). Writearch_map.jsonper the configuration table andreview.json(reviewed_by,decision,accepted_untested,reasonfrom one person, notci,botorgate). Reportmap.md: the map size,validate_mapand the declared-test coverage; the risk table by score; the list of risks with no test; the edges across the trust boundary with the risks pointing at them; the table of tool nodes againstTOOL_SPECS; six map corruptions, one rule at a time (removeobserved_byfromcalc, removemax_steps,share_notelosesapproval, the edgekb_content->lookuplosesmitigation, remove the risk of the edgeshare_note->teacher_inbox, the risk ofshare_noteloses all controls) with thevalidate_mapcodes; the person's decision; what this step does not prove. - Reproduction. Write
build_agent_map.pythat generates the five reports inreports/(every number comes fromlabandmine, none typed by hand) andtest_build_agent_map.pythat checks the constraints AC1-AC5 on the text of the reports you generate. Writenotes/decisions.mdwith exactly five entries:Classification and tools,Stop conditions,Pattern comparison,Traces and sensitive data,What the map does not check. The last entry answers: how far the map, the validator and these lints can be trusted, and what they cannot yet be used for.
Deliverables
agent_map/
__init__.py (file rỗng)
mine.py (Nhiệm vụ 1 đến 5: agent_properties_missing, full_steps, cost_per_success, report_mismatches, untested_risk_ids)
arch_map.json (Nhiệm vụ 5)
review.json (Nhiệm vụ 5)
build_agent_map.py (Nhiệm vụ 6; chạy: python -m agent_map.build_agent_map)
test_build_agent_map.py (Nhiệm vụ 6; chạy: python -m pytest agent_map)
notes/
decisions.md (năm mục: Phân loại và tool, Điều kiện dừng, So sánh mẫu, Trace và dữ liệu nhạy cảm, Điều bản đồ không kiểm)
reports/ (sinh bởi build_agent_map.py)
classify.md (Nhiệm vụ 1)
stop_suite.md (Nhiệm vụ 2)
patterns.md (Nhiệm vụ 3)
trace.md (Nhiệm vụ 4)
map.md (Nhiệm vụ 5)
Put the agent_map/ folder in code-labs/l3-m01 so that import lab works. Run from the lab folder. Use relative imports inside the package (from . import mine) so the tests run wherever the package is placed. Do not create or edit any file under .github/; run every tool only inside the temporary sandbox directory.
Acceptance criteria (required)
| # | Criterion | How to check |
|---|---|---|
| AC1 | agent_properties_missing is correct at the edges (on the data/systems.json systems where the model decides the next step, the result is [] if and only if lab.classify gives agent; three properties missing at once; ValueError for code that decides, no LLM, an invalid spec and the value 1 in place of True); classify.md has 12 label lines (by the rule rewritten in plain code), the line "Số theo nhãn: agent 3, not_llm_system 1, single_call 1, unclear 2, workflow 5." (Vietnamese for "Count per label"; keep this line exactly as written), two unclear lines (s09 missing feedback_to_model, repeats, tools_chosen_by; s10 missing repeats), ten call lines with the error codes -, -, DIV_ZERO, -, -, BAD_NAME, NOT_FOUND, UNKNOWN_TOOL, BAD_ARGUMENTS, BAD_JSON, a total cost of 12 cu, one write effect, the notebooks left ['ban_nhap_2'], and the what-it-does-not-prove part says the spec is self-declared |
python -m pytest agent_map; rewrite the classification rule in plain code (6 lines) and compare it with the 12 labels; derive each call's error code by hand in the check order of L01 §5.1, then compare with the report |
| AC2 | full_steps is correct at the edges (12, 14 and 15 cu with calc give 4, 4, 5 steps; 40 cu is blocked by max_steps 9; budget 2 gives 0; a 2 cu tool and a 3 cu model change the result; ValueError for True, 0, floats, negative numbers); stop_suite.md has ten correct scenario lines (final 3 steps 8 cu; final 4 steps 11 cu; max_steps 4 steps 12 cu; budget 4 steps 12 cu; budget 5 steps 14 cu with only 4 tool calls; error_limit 3 steps 9 cu; final 6 steps 17 cu; loop_detected 3 steps 8 cu; two policy_error lines 1 step 2 cu), five full_steps table lines, four loop guard check lines (caught at the second call for the same parameters with different spaces; missed for 2+3 then 3+2 and for 1 then 1.0; [True, True, False, False] for a changing state), three lint lines, and the what-it-does-not-prove part says final does not mean the answer is correct |
python -m pytest agent_map; compute each scenario by hand from the price per step (3 cu per calc step) and the rule that the budget is checked before spending; compare the full_steps column with the tool calls that ran |
| AC3 | cost_per_success is correct at the edges (no success gives None; the total cost of the failed runs too divided by the number of successes; an empty list gives ValueError); patterns.md has the configuration line (9 tasks, 10 seeds p0 to p9, limits 8 steps and 40 cu, slip probability 0 or 1/5, max_steps 3), three tables with exactly the simulation's numbers (no slips: direct 1/3, plan_execute 7/9, react 1; average cost 2, 73/9, 64/9; cost per success 6, 73/7, 64/9), each pattern's failing tasks (direct: t02, t03, t04, t07, t08, t09; plan_execute: t05, t06; react: none; at max_steps 3: direct as before, plan_execute: t03, t04, t05, t06, react: t04, t06), and the what-it-does-not-prove part says the difference is a consequence of how the simulated policies are written and that success and cost must be reported together |
python -m pytest agent_map; derive by hand each task's cost for the no-slip column (react: 5, 5, 8, 12, 8, 11, 5, 5, 5; plan_execute: 7, 7, 10, 14, 7, 7, 7, 7, 7); recount the slip columns and max_steps 3 with PL.run_task |
| AC4 | report_mismatches is correct at the edges (correct; only the step count wrong; only the reason wrong; both; two run spans or none gives ValueError); trace.md has exactly the 9-line span tree of react on t05 (run [1-21] ok through model [17-19] ok final; the thought event is written before the model span closes), summarize (3 steps, 2 tool spans, 1 error, 20 ticks, final), two empty lints, three claims giving [], ['STEPS'], ['REASON'], the arguments attribute redacted in all three places, the raw notebook content, the sentence saying the tool stored sensitive data, the codes of the four trace corruptions (ORPHAN_SPAN:sp-003; CLOCK_BACKWARDS:sp-003 together with EVENT_OUTSIDE_SPAN:sp-003; UNENDED_SPAN:sp-002; SENSITIVE_LEFT:sp-004.attributes.password), the three blind spots of redact all unchanged, and the what-it-does-not-prove part says a structural lint does not know the content and the clock is a logical counter |
python -m pytest agent_map; count the spans and ticks of the tree by hand (each start or end of a span, an event or a log adds one tick); rewrite the redaction pattern with re and check the three blind spots |
| AC5 | untested_risk_ids is correct at the edges (untested: in capitals and with leading whitespace, an empty test, a missing test key; combined with the number of risks it gives the right lab.archmap coverage); arch_map.json passes validate_map, has share_note and teacher_inbox as in the configuration table, at least 10 risks with unique ids, one risk pointing at edge:share_note->teacher_inbox, at least two risks scoring 6 or more with a control, every untested: entry has a reason of three words or more, every declared test has a real function in tests/, the tool nodes other than share_note match TOOL_SPECS, declared-test coverage not below 1/2; map.md has a risk table in the right order (score descending, then id), the list of untested risks, three boundary edges with their risks, four "matches" lines and a share_note line "not comparable" (Vietnamese "không so được"), six validate_map codes for the six corruptions, the sentence that the accepted list matches, and the what-it-does-not-prove part; review.json has reviewed_by as one person, a decision, a reason of ten words or more and accepted_untested equal to exactly untested_risk_ids |
python -m pytest agent_map; run validate_map, risk_table, test_coverage; recompute the scores (severity times likelihood) and the list of edges across the trust boundary with code of your own; the grader reads the decision against the rubric |
| AC6 | Rerunning python -m agent_map.build_agent_map produces exactly the five reports (byte for byte, for example with diff), with no timestamp, Python version or CR character; every report has a Cấu hình: line (Vietnamese for "Configuration:"; keep this label exactly as written) and says it is a simulation; python -m pytest agent_map passes; notes/decisions.md has all five entries in the right order, every fraction in it appears in the reports, and the last entry names what the map does not check |
run twice and compare; the grader reads decisions.md against the rubric |
Grading rubric (100 points)
| Dimension | 0 | 1 | 2 | 3 | Weight |
|---|---|---|---|---|---|
| Classification and tools (AC1) | Does not meet AC1 | Has labels but no reasons or no missing list for the two unclear cases |
Meets AC1; reads s10 correctly as missing only a real loop and s09 as missing all three properties |
As level 2, and states that the label says only who decides the next step and not the risk level, that the spec is self-declared, that Notes_read is rejected at the name check before the parameters, and that only one of the ten calls writes to the sandbox |
15 |
| Stop conditions (AC2) | Does not meet AC2 | Has the scenario table but no hand calculation or no edges | Meets AC2; reads correctly that final at the last step differs from max_steps right after it, and that budget 14 differs from 15 |
As level 2, and explains why budget 14 gives 5 steps started but only 4 tool calls run (the fifth step has only a model call), the loop guard check missing 2+3 then 3+2, and that stopping midway leaves a half-finished state |
20 |
| Pattern comparison (AC3) | Does not meet AC3 | The table has only one number (success or cost) | Meets AC3; reports success and cost together, with the numerator and denominator | As level 2, and states that ten seeds are not 90 pieces of evidence, that the difference is a consequence of how the policies are written, that max_steps 3 changes both patterns (plan_execute 5/9, react 7/9) and that it recommends no pattern |
15 |
| Traces and sensitive data (AC4) | Does not meet AC4 | Has a trace but no lint or the claims are not checked | Meets AC4; the trace is lint-clean and report_mismatches catches the wrong claims |
As level 2, and states that the tool stored the raw copy even though the trace is clean, the three blind spots of redact, that the lint does not know the content, and that the difference of two ticks is not real time |
15 |
| Risk map (AC5) | Does not meet AC5 | The map does not pass the validator or the decision says ci |
Meets AC5; the decision has a name, a reason and an accepted-risk list that matches | As level 2, and states that coverage 1/2 counts only declared tests, that share_note is not in the lab so its permission is only a claim, that the eight risk categories have no "data leaving the sandbox" category, and that risks with no test are work for later modules |
20 |
| Reproduction and notes (AC6) | Does not meet AC6 | Reports typed by hand or not saying they are simulated | A script generates every report, a rerun gives identical files, and tests run on the text of the reports | As level 2, and the tests catch deliberate faults (change the seed prefix, change 1/5 to 1/4, swap two of the calls, remove approval from share_note, remove the risk of the edge share_note->teacher_inbox, change the reviewer to ci), and decisions.md is honest that every number is simulated |
15 |
Each dimension's score = (level reached / 3) × weight. Mapping to the module: practical = Classification and tools + Stop conditions + Reproduction and notes (50); applied QA analysis = Pattern comparison + Traces and sensitive data + Risk map (50).
Hints
Hint 1: classification and tools
Use `check_spec` to validate the spec before reading the three fields; a spec is an `agent` exactly when all three properties are present, so `[]` and the label `agent` go together. For the ten calls, follow the check order of L01 §5.1: exact name match, strict JSON (a duplicate key is `BAD_JSON`), correct keys and correct types (`true` is not a string), and only then the tool body. `Notes_read` never reaches the parameter step. Call `call_tool` on the same `Sandbox` so the write effects and the remaining notebooks belong to all ten calls.Hint 2: stop scenarios
Each step checks the budget **before** spending: a step starts when `used + 2` still fits, a tool call runs when `used + tool price` still fits. With budget 14: four steps use 12, the fifth step starts (12 + 2 = 14) but `calc` would push the total to 15 so it does not run. A `final` at exactly the `max_steps` step is still `final` because the final answer is considered before `max_steps`. The loop guard counts over the whole run per (call key, state fingerprint): use **one** `LoopGuard` for the whole sequence of calls, do not create a new one for each call.Hint 3: pattern comparison
`cost_per_success` divides the total cost of all runs (the failed ones too) by the number of successes; use `Fraction` and return `None` when there is no success. To round a decimal using integers, compute `(x * 100 * 2 + 1) // 2` and then divide by 100. Keep the seeds, limits and tasks fixed for every pattern; changing `max_steps` is a different comparison, recorded separately. The no-slip table can be checked by hand: each step is a 2 cu model call plus a tool of 1 or 2 cu.Hint 4: trace
`report_mismatches` counts spans named `step`, not tools; the `stop_reason` attribute is on the `run` span. For the secret, read `sb.notes_dir` to see the raw copy and read the `arguments` attribute of the tool span to see the redacted one. Do each trace corruption on a **deep copy** so the corruptions do not accumulate. Do not put the Python version or a timestamp in the report.Hint 5: map
Start with `copy.deepcopy` of `arch_example.json`. Run `validate_map` after each addition: `share_note` needs `approval`, a risk pointing at it (`SIDE_EFFECT_TOOL_NO_RISK`) and a risk pointing at the edge `edge:share_note->teacher_inbox` (an edge between a trusted and an untrusted node). A score of 6 or more needs at least one control. An `untested:` entry needs a concrete reason, and weigh the coverage of 1/2 before declaring more untested risks. The `accepted_untested` list is signed by the person who decides; for it to match `untested_risk_ids` you must compute that list, not type it by hand.Hint 6: check your own tests
Once the tests are green, try changing the seed prefix `p`, changing 1/5 to 1/4, swapping two calls among the ten, removing `approval` from `share_note`, deleting the risk of the edge `share_note->teacher_inbox`, setting `reviewed_by` to `ci`, or letting `build_agent_map.py` write a timestamp: if the tests stay green, they are only comparing the report with itself. A good test compares against a number **derived independently** (a hand calculation, a rule rewritten in plain code), not against the output of the function under test.Independent challenge (practical challenge)
Less guidance. No lab data is needed for tasks 1 and 5 beyond the lab's functions (lab.classify, lab.tools, lab.archmap) or hand calculation from the tables below; task 3 uses lab.planning with data/tasks.json; task 2 uses lab.loop with the Scripted policy; task 4 uses lab.trace and your report_mismatches function. Submit one file challenge.md.
Context: SachMo (fictional) is a class library assistant: it finds books by topic and records borrowed books on a slip. A team of two wants an architecture map of SachMo before writing tests, after they already have the HocVui toolkit. The rule for every comparison: every rate and average cost is computed as a fraction (no floats); a value exactly at the edge is handled by the lab's rule (a budget used up exactly is valid, a loop guard threshold is the count at which it rejects, final at the last step is still final). The systems, tasks and names below are fictional data and do not describe a real system or person.
Tasks:
Classification. Six systems (fields in the order
uses_llm,next_step_chosen_by,branch_by_model,tools_chosen_by,repeats,feedback_to_model): Z1 (true, code, true, code, no, false) "the model picks one of three request types and then code runs a fixed path"; Z2 (true, model, false, model, until_model_signal, true) "the model picks a book-search tool, reads the result and reports when done"; Z3 (true, code, false, none, no, false) "one model call fills in the slip"; Z4 (true, model, false, code, until_model_signal, true) "the model decides the next step but code always chooses the tool"; Z5 (false, code, false, code, no, false) "a weekly report by script"; Z6 (true, model, false, model, until_code_condition, false) "the model picks tools and loops until code stops it, but tool results are only written to the log, not fed back to the model". (a) The label of each system and, for theunclearcases, theagent_properties_missinglist. (b) The smallest one-field change that turns Z4 and Z6 intoagent. (c) Nine calls in order on one sandbox:calc{"expression": "7*(8+2)"};lookup{"key": "SỐ chẵn"};notes_addwithnamemuon_sach_1and atextof 201xcharacters;notes_read{"name": ""};calc{"expression": "10**9"};calc{"expression": "12*3"}(full-width digits);lookup{"key": "số"};notes_add{"name": "a", "text": "x", "extra": 1};notes_add{"name": "muon_sach_1", "text": "Nam mượn 2 sách"}("Nam borrowed two books"): the error code orokof each call, the total number of write effects and the notebooks left.Stop conditions. Six
Scriptedscenarios (each step is a 2 cu model call,calc1 cu,notes_add2 cu, an unknown tool 1 cu): (a) threecalcthenfinal,max_steps3; (b) eight differentcalc, budget 20,max_steps9; (c)notes_addwith three different namesn1,n2,n3thenfinal, budget 11,max_steps9; (d) two unknown tools, onecalc, two unknown tools,final,error_limit2; (e) six identicalcalccalls{"expression": "4*4"},loop_threshold4; (f) actionplanthen onecalcthenfinal,max_steps2. For each scenario: (stop reason, steps, cost) and the notebooks left. Then:lint_limitsfor (5, 1), (0, 0) and (4, 10, 3, 1); andLoopGuard(3)with the following sevencalccalls (key, fingerprint):{"expression": "2+2"}f0;{"expression": "3+3"}f0;{"expression":"2+2"}f0;{"expression": "2+2"}f1;{"expression": "3+3"}f0;{"expression":"2+2"}f0;{"expression": "2+2"}f0: the index (from 1) of the first call that is rejected and why the fourth call is not.Plans and patterns. (a) The
lint_plancodes of six plans (each step liststooland JSON parameters): K1lookup{"key": "diện tích hình vuông"}("area of a square"),calc{"expression": "7*7"},notes_add{"name": "dt", "text": "{calc} và {lookup}"}("and"); K2calc{"expression": "2+2"}twice thennotes_add{"name": "kq", "text": "{calc}"}; K3 toolbrowser{"url": "x"}thencalc{"expression": "1+1"}; K4 sevencalcsteps{"expression": "1+1"},2+2, ...7+7; K5notes_add{"name": "a", "text": "{lookup}"}thenlookup{"key": "số chẵn"}("even number"); K6calc{"expression": "1+1"}thennotes_add{"name": "a", "text": "{sum}"}; plus the code of a one-step plan whose parameters are{"expression": "1+1"(missing}). (b)compare_patternson three taskst01,t05,t08, six seedsc0toc5, slip probability 0 and 1/3, default limits, then probability 0 withmax_steps2: each pattern's success rate and average cost (fractions), success by task. (c) Each pattern's cost per success in the first comparison (no slips) and in themax_steps2 comparison, withNoneif there is no success; whydirectis cheapest on this task set and why that does not make it the choice; and two sentences for the SachMo product owner (someone who just wants to hear "which pattern to use") stating what is known and what is not.Trace. The following six records are a simulated trace of a two-step run (corrupted in three places):
{"type": "span", "trace_id": "tr-508e5f0e", "span_id": "sp-001", "parent_id": null, "name": "run", "kind": "run", "start": 1, "end": 12, "status": "ok", "attributes": {"task": "c", "max_steps": 8, "budget": 40, "stop_reason": "final", "steps": 2, "used": 5}, "events": []} {"type": "span", "trace_id": "tr-508e5f0e", "span_id": "sp-002", "parent_id": "sp-001", "name": "step", "kind": "step", "start": 2, "end": 7, "status": "ok", "attributes": {"step": 1}, "events": []} {"type": "span", "trace_id": "tr-508e5f0e", "span_id": "sp-003", "parent_id": "sp-002", "name": "model", "kind": "model", "start": 3, "end": 4, "status": "ok", "attributes": {"cost": 2, "action": "tool_call"}, "events": []} {"type": "span", "trace_id": "tr-508e5f0e", "span_id": "sp-004", "parent_id": "sp-009", "name": "tool", "kind": "tool", "start": 5, "end": 6, "status": "ok", "attributes": {"tool.name": "calc", "arguments": "{\"expression\": \"9+9\"}", "cost": 1, "api_key": "k-1234"}, "events": []} {"type": "span", "trace_id": "tr-508e5f0e", "span_id": "sp-005", "parent_id": "sp-001", "name": "step", "kind": "step", "start": 8, "end": 11, "status": "ok", "attributes": {"step": 2}, "events": []} {"type": "span", "trace_id": "tr-508e5f0e", "span_id": "sp-006", "parent_id": "sp-005", "name": "model", "kind": "model", "start": 10, "end": 9, "status": "ok", "attributes": {"cost": 2, "action": "final"}, "events": []}(a) The
lint_tracecodes. (b) The smallest fix for each code that keeps the ids, names and number of records, thenlint_traceafter the fix. (c)report_mismatchesfor three claims: (2,final), (3,final), (2,max_steps). (d) Point out what a clean lint after the fix still does not say about this trace (two things) and whyk-1234being redacted does not mean the secret was never stored somewhere else.Map. The SachMo map (8 nodes, 10 edges, 3 risks,
stop_conditionswith onlymax_steps10). Nodes:reader(human, untrusted);orchestrator(orchestrator, trusted);model(model, trusted,observed_bylog_store);find_book(tool, trusted,read,observed_bylog_store);loan_add(tool, trusted,write,side_effecttrue,approvalnone_sandbox_only, nosandboxed,observed_bylog_store);catalog(external_content, untrusted);loan_sheet(environment, trusted);log_store(observability, trusted). Edges (none has amitigation):reader->orchestrator,orchestrator->model,model->orchestrator,orchestrator->find_book,find_book->orchestrator,orchestrator->loan_add,loan_add->orchestrator,loan_add->loan_sheet,catalog->find_book,orchestrator->log_store. Risks: K1 (targetloan_add,excessive_agency, severity 2, likelihood 3, one control, testtests/test_loan.py::test_rows_stay_in_the_sheet); K2 (targetmodel,silent_failure, 3 and 3, no control, testuntested: no end-state oracle yet); K3 (targetedge:reader->orchestrator,direct_prompt_injection, 2 and 2, one control, emptytest). (a) Thevalidate_mapcodes and the declared-test coverage. (b) The list of smallest changes that makevalidate_mapreturn empty (one change per line). (c) The declared-test coverage after your changes if K1 keeps its real test, K3 and every new risk isuntested:with a reason; which risk should get a test first and why. (d) Three sentences for the SachMo product owner: what the map tells you, what it does not yet prove, what to do before adding a real write tool; and which person decides to accept a risk with no test.
Challenge rubric (100 points, pass at ≥ 70):
| Dimension | 0 | 1 | 2 | 3 | Weight |
|---|---|---|---|---|---|
| Classification (task 1) | Missing | One of (a) to (c) correct | All three correct, including the missing list of the two unclear cases and the error codes of the nine calls |
As level 2, and states clearly that Z4 and Z6 each lack exactly one property, that the lookup call số returns a "did you mean" hint and not a name error, and that only one call writes to the sandbox |
15 |
| Stop conditions (task 2) | Missing | Two scenarios or fewer correct | All six scenarios, three lint lines and the index of the rejected call correct | As level 2, and states clearly why final at step 4 of scenario (a) does not happen (step three already reached max_steps), that plan costs one step with no tool (scenario (f)), and that the fourth loop guard call is not blocked because the fingerprint changes |
25 |
| Plans and patterns (task 3) | Missing | One of (a) to (c) correct | All three correct, including None for plan_execute at max_steps 2 |
As level 2, and states clearly that direct is cheapest because the three small tasks were chosen in advance, that 18 runs are not 18 pieces of evidence, and that the two sentences for the product owner promise nothing the simulation does not prove |
20 |
| Trace (task 4) | Missing | Two of (a) to (d) correct | All four correct | As level 2, and states clearly that a clean lint does not know the content of the tool or whether the tool really ran, and that the secret may still be in the tool, the notebook or elsewhere | 20 |
| Map (task 5) | Missing | Two of (a) to (d) correct | All four correct, including coverage 1/3 before and 1/4 after | As level 2, and states that K2 with score 9 should get a test first, that coverage counts only declared tests, and that a person and not the validator accepts the risk | 20 |
Rules
- Do not use real data or real APIs in your submission. The systems, tools, tasks, costs and every number in the lab are simulated; do not infer the behaviour of a real model, vendor, framework or product.
- Do not edit
lab/,data/orexercises/. Propose changes innotes/decisions.md. - Every tool runs only in the lab's temporary sandbox directory; do not run shell commands, network access or files outside it. Every real-world effect needs a person to approve it.
- Do not change the seeds, limits, budgets, edges or task lists after seeing the results in order to reach a wanted conclusion; if you change them, record the reason and the results from before the change.
- Every number in a report comes from a script; state the configuration (tasks, seeds, limits, slip probability). Do not let a lint, validator or loop guard stand in for reading the reports and the trace.
- Lints and validators only flag; the loop guard and the limits lint stop the run; a person reviews and decides the thresholds and every real-world effect. Do not create or edit any automatically running workflow.