Log inBook a Demo

AI Labs Library

Coding labs you work through with an AI coding agent, each in its own private cloud workspace. Open a lab to see what it asks of you and what it measures.

Practice a skill

Graded on what you ship and on how you work with the agent.
71 labs
BuildSenior
35 min

Build a pipeline that hands state between agents

Fix run_pipeline, which runs a list of agents in order with one shared state. Right now later agents miss what earlier ones wrote, a done flag changes nothing, and one failing agent ends the run.
python
BuildMid
35 min

Cap an agent's steps and retry flaky tools

run_agent in agent.py drives a tool-using agent. It never stops if the model doesn't answer, and the first tool error crashes the run. Add a step budget, capped retries, and a way to finish when a tool stays broken.
python
BuildSenior
50 min

Build a tool-using agent with Claude Code

Build a small autonomous agent that uses Claude Code with tools — file I/O, web fetch, shell — to complete a multi-step task end-to-end.
python
BuildSenior
40 min

Fix a transfer that loses or invents money

A double-entry ledger is losing track of money: balances drift by fractions of a cent, accounts go negative and the totals stop adding up. Fix transfers so amounts are exact, overdrafts are refused and a refused transfer changes nothing.
python
BuildJunior
30 min

Write base64 encode and decode from scratch

Write RFC 4648 base64 encode and decode from scratch, without Python's base64 or binascii modules. The current version gives non-standard output for some inputs, and some bytes change on the way back.
python
DebugJunior
20 min

Fix a search that returns the wrong index

find_first() and find_last() should return the first and last index of a value in a sorted list with duplicates, or -1 if it's missing. Callers get wrong indices, calls that hang, and an index where -1 was expected. Fix both and keep them binary searches.
python
BuildMid
35 min

Patch a filter that forgets items you added

BloomFilter(size_bits, num_hashes) reports items you just added as absent. Fix it so nothing you add is ever missed and the false-positive rate stays low.
python
BuildSenior
45 min

Build a token-bucket limiter that returns 429

Build a token-bucket rate limiter to a written spec. It allows a burst up to capacity, answers 429 after that, refills over time, and holds up when many requests arrive at once.
python
BuildSenior
45 min

Cut off a failing dependency and probe recovery

Build a circuit breaker around a flaky downstream service: stop calling it after repeated failures, fail fast while it cools down, then let one trial call decide whether to close again.
python
BuildSenior
45 min

Fix a pool that leaks database connections

A service's connection pool keeps opening new database connections and never gives them back. Make ConnectionPool cap how many it creates, reuse released ones and raise PoolExhausted when it's full.
python
BuildSenior
45 min

Stop a hash ring from reshuffling every key

Make HashRing in ring.py a real consistent hash ring. Right now a node joining or leaving moves almost every key, and two processes don't always agree on which node owns a key.
python
SecureJunior
20 min

Stop a CSV export from injecting spreadsheet formulas

A Download report button exports user data to CSV, and some cells run as formulas when the file is opened in Excel or Sheets. Fix the export so no cell can execute and no data is lost.
python
DebugJunior
20 min

Reconcile a bank ledger against a payments export

Finance has a bank ledger and a payments export that should agree but don't. Write a script that cleans up both files and reports which transactions match, which differ in amount, which are missing and which are duplicated.
python
BuildMid
30 min

Fix a CSV importer that mistypes columns

A CSV importer gets column types wrong. Mixed integer and decimal columns come out as integer, blank cells never make a column nullable, codes like "01" become numbers, and an empty column crashes it. Rewrite infer_schema to follow the type rules.
python
BuildMid
30 min

Fix debounce and throttle that mistime event bursts

Implement debounce and throttle. Debounce runs once after a burst of calls goes quiet. Throttle runs straight away, then at most once per interval. Time comes from an injected clock, so there are no real timers.
python
BuildSenior
125 min

Software Engineer: Delete a user’s data everywhere, as GDPR requires

With your coding agent, ship GDPR data export and account deletion in a gym-booking product whose member data is spread across many stores, under rules set by product, finance, the data protection officer and the SRE. Scored on test members searched for in every table, file, log and restored backup, on your tests, on the proof you leave on the live data, and on how you worked with the agent.
pythonsqlite
BuildSenior
45 min

Order a graph so dependencies come before dependents

Write resolve_order(graph) so it lists every node after the nodes it depends on, and raises CycleError when the graph has a cycle. The current version crashes on cycles and drops or repeats nodes.
python
BuildSenior
45 min

Fix a lock that lets two workers in

Fix the lease-based lock for a nightly billing job that two workers just ran at once. A lease has to expire after its TTL, and only the current holder's token can release it.
python
SecureSenior
60 min

Software Engineer: Ship a security-critical access change

Use your coding agent to ship an access-control change in an internal document service, where a chat thread partly overruled the original requirements. Scored on hidden cases, your tests, your written decisions and how you worked with the agent.
python
DebugJunior
55 min

Software Engineer: Find out why seats were sold twice

A theatre ticketing service sold 23 seats twice on a sold-out night. With your coding agent, reproduce it from the event log, fix the cause without leaving a paying customer empty-handed, settle the case two colleagues disagree on, and prove the fix.
python
BuildSenior
110 min

Full-Stack Engineer: Build a live drone fleet map with expiring commands and replay

With your coding agent, build the operations map for about 100 crop-survey drones: live positions, commands that wait for an offline drone and expire on time, and a replay of any past moment.
reactvite
BuildSenior
35 min

Score a model's answers into a pass rate

Fix run_eval(dataset, model, scorer), a small eval harness that runs a model over a labelled dataset and reports a pass rate. Its numbers don't match the scorer, and one model error crashes the whole run.
python
BuildSenior
45 min

Evaluate arithmetic with correct precedence and parentheses

Make evaluate(expr) handle basic arithmetic. Today it returns 20 for 2 + 3 * 4, crashes on parentheses and returns a number for input like 2 +. Write the parser yourself: eval and similar shortcuts are not allowed.
python
BuildMid
30 min

Make a percentage rollout stable per user

Fix evaluate(flag, user) in a feature-flag service so the master switch, targeting rules and percentage rollout behave as the contract says, with each user getting a stable answer.
python
RefactorSenior
30 min

Make a prototype feedback board production-ready

Pulse is a working customer feedback board written in plain JavaScript. With your coding agent, add tests, move the UI to React and make the board usable on a phone.
javascriptreact
DebugMid
25 min

Fix a test that fails randomly in CI

A leaderboard test suite fails at random in CI and sometimes goes green when the job is re-run. Find what makes it non-deterministic and fix the code, without skipping a test, loosening an assertion or adding a retry.
python
BuildJunior
30 min

Fix signup validators that accept the wrong inputs

A signup form's validators pass the obvious cases but get real input wrong: trailing spaces, None, international phone numbers, leap days. Fix all five to match the spec.
python
BuildSenior
45 min

Catch duplicate customer records that aren't exact matches

A customer-records deduper keeps 'Jon Smith' and 'jon smith' as two customers, merges unrelated companies and puts one record in two groups. Make dedup(records, threshold) group near-duplicates, with every record in exactly one group.
python
BuildMid
40 min

Fix a glob matcher that flags wrong files

Fix match(pattern, name), the glob helper a build tool's CI uses to pick files. It flags files it should ignore and misses ones it should flag. Write the matching yourself, without fnmatch or glob.
python
OptimizeMid
85 min

Cloud Architect: Cut a doubled cloud bill without losing data

Use your coding agent to cut a doubled cloud bill on a simulated cloud driven from Terraform-style code. You apply staging yourself after reading each plan, with constraints from the DBA, compliance and the CFO. Scored on what the cloud recorded, your policy rule and its tests, whether your numbers are true, and how you worked with the agent.
python
BuildMid
30 min

Honor an Idempotency-Key so retries don't double-charge

A payment handler charges the customer again whenever a request is retried with the same Idempotency-Key. Make handle() charge once per key and return the original receipt on every retry.
python
BuildMid
30 min

Stop a redelivered message from being handled twice

Your queue delivers at least once, and redelivered messages are charging customers twice. Make consume() handle each message id once, while a delivery that failed can still be retried.
python
BuildMid
30 min

Make a JSON Pointer resolver follow RFC 6901

Make resolve() follow RFC 6901 JSON Pointer. Today it crashes on the RFC's array example, decodes some escaped tokens wrongly, and lets a missing path escape as a raw KeyError or TypeError where callers expect a ResolveError.
python
SecureMid
35 min

Fix a login that accepts forged JWTs

A login service accepts forged JWTs, so anyone can sign in as any user with any role. Fix verify_jwt so it only accepts genuine, unexpired HS256 tokens.
python
BuildMid
35 min

Fix a cache that evicts recently used keys

An LRUCache(capacity) keeps throwing out the keys services are reading and holding on to cold ones. Fix it so eviction is true least-recently-used.
python
DebugJunior
25 min

Fix invoice totals that drift by a cent

Finance says the billing module is a cent out, on half-cent lines and on whole invoice totals. Fix it so every amount is correct to the penny and rounds half-up.
python
DebugSenior
35 min

Reproduce and fix a wallet that overspends under load

An Express wallet API works fine one transfer at a time, but under real traffic too many transfers succeed and money appears from nowhere. Reproduce it under load and fix it.
nodejavascript
BuildJunior
50 min

Software Engineer: Add a discount without changing any other price

Use your coding agent to add a residents' discount to a 2016 ferry fare engine and its booking page without changing any other price by a cent, with requirements added by two colleagues. Scored on unseen bookings, on your tests against broken engines, on a sign-off checked against your engine, and on how you worked with the agent.
javascriptnode
OptimizeMid
30 min

Kill the per-post queries in a /feed endpoint

A /feed request for 500 posts makes about 1,001 queries, and the number grows with every new post. Get it down to at most 3 queries per request without changing a byte of the response.
python
BuildMid
105 min

Software Engineer: Build the on-call handover tool

Work with your coding agent to build a CLI that turns a night of production logs into the on-call handover your team has asked for. Scored on unseen nights, your tests, what you leave in the repo for the next session, and how you worked with the agent.
python
BuildMid
30 min

Fix pagination that loses records between pages

Clients paging through /records end up with fewer records than the dataset holds, and which ones go missing depends on the page size. Fix page() so a full walk returns every record exactly once, in order.
python
BuildSenior
35 min

Fan out to agents and merge what succeeded

Fix fan_out(items, worker, reduce_fn), which runs a sub-agent on each item and reduces the results in input order. Some sub-agents will raise, and one failure must not take down the batch.
python
SecureMid
35 min

Replace unsalted password hashes with salted PBKDF2

A user store keeps passwords as bare SHA-1 hashes and checks them with a plain equality test. Move it to salted PBKDF2 with a constant-time check, without changing the two functions the app calls.
python
SecureMid
25 min

Keep user paths from escaping the base directory

A file-serving helper should only return paths inside one fixed base directory, but crafted requests still get a path outside it. Fix safe_join so every escape raises PathTraversalError and normal paths keep resolving.
python
BuildSenior
125 min

Cloud Architect: Make the standby region take over, safely

Use your coding agent to make a payments app's standby region take over a regional outage safely, within the constraints the CTO, the database lead, finance and compliance have set. Scored on failure drills you have not seen, on your own drills against broken controllers and infrastructure, on your runbook run step by step, and on how you worked with the agent.
python
DebugMid
30 min

Find and fix an orders service throwing 500s

Checkout on the orders service started failing with 500s right after a config change. Work from the logs and metrics to the cause, patch the service and get the error rate back to zero.
python
SecureSenior
40 min

Stop retrieved text from hijacking an LLM prompt

Retrieved documents and tool output go straight into an LLM prompt, and some of them carry injection attempts. Write sanitize_context(text) so the injected instructions lose their effect and normal lines come through unchanged.
python
BuildMid
35 min

Build a prompt renderer that resists template injection

Build render(template, vars) for LLM prompts, with placeholders, an if block and a loop. Values come from users and tools, so they must appear exactly as given and never be read as template syntax.
python
BuildMid
35 min

Parse and rebuild URL query strings by hand

Write a URL query-string parser and its inverse by hand, without urllib.parse. Get decoding, repeated keys and empty values right, and make stringify output parse back to the same dict.
python
BuildJunior
60 min

DevOps Engineer: Stop planned maintenance from paging on-call

A logistics company's alerting service paged the on-call rotation 49 times on the night of an announced database maintenance. Use your coding agent to add maintenance silences. The SRE lead has set a rule and left you one decision, and QA a sign-off replay for you to run. Scored on replays of nights you have not seen, on your tests, on the decision you record, on the replays you run yourself and on how you work with the agent.
pythonsqlite
BuildMid
30 min

Chunk a document into overlapping retrieval passages

Make chunk(text, max_chars, overlap) split a document into overlapping chunks for a retrieval index, without going over the size cap, cutting words in half or losing text. Plain Python, no model or embeddings API.
python
BuildSenior
40 min

Build a ReAct loop that reasons then acts

Write the ReAct loop by hand. run_react(task, model, tools) asks a model for its next step, runs the tool it names, feeds the result back and stops at a final answer. The current version never gets there.
python
DebugMid
20 min

Fix a React counter that increments unpredictably

A React counter doesn't count properly. Auto-increment stops climbing after the first tick and +1 doesn't reliably add one. Find out why and fix it in place.
reactjavascript
SecureJunior
55 min

DevOps Engineer: Make the release pipeline a real gate

With your coding agent, turn a start-up's release pipeline into a real gate: find every way a broken or wrong build, or the deploy token, can still get out, close each one, prove it with pipeline tests, and decide how a flaky test is treated. Runs on a local CI runner. Scored on commits and events you have not seen, on your pipeline tests, on the CI's records as you leave them, and on how you worked with the agent.
pythonbash
BuildMid
30 min

Add backoff to a client that hammers upstream

A client for a flaky LLM API hammers it while it throttles, resends requests that will never succeed and never gives up. Fix retry() so it backs off exponentially, stops after max_attempts and retries only RetryableError.
python
BuildJunior
25 min

Fix a converter that writes 4 as IIII

A Roman-numeral converter writes 4 as IIII and reads IX back as 11. Fix int_to_roman() and roman_to_int() so both directions are correct for 1 to 3999 and bad input raises an error.
python
SecureMid
30 min

Redact live credentials from exported support logs

Fix redact(text) so the support bundle stops leaking credentials into tickets. Every secret has to go completely, and the rest of the log has to come through untouched.
python
BuildMid
35 min

Fix a rate limiter that leaks across windows

Fix a rate limiter that lets a caller through twice its limit by bursting on both sides of a window boundary. Make the limit hold over every rolling window.
python
OptimizeMid
30 min

Speed up a slow /report endpoint

The /report endpoint returns the right per-session page-view totals, but it's the hot path in every profile and gets much slower as the log grows. Make its work linear in the number of events, with the same output.
python
BuildMid
40 min

Add order search and stop half-saved orders

An orders service needs a search endpoint with filters, paging and a stable sort. It also has a bug: when one line of an order fails, part of the order is saved anyway. Build the search and make placing an order all or nothing.
javaspring-boot
BuildJunior
35 min

Add lookup and create endpoints to a book API

A Spring Boot book catalogue API can only list its books. Add an endpoint that returns one book and an endpoint that adds a book, with input validation and clear JSON errors.
javaspring-boot
DebugMid
35 min

Reproduce a pricing bug with a test, then fix it

A customer of a pricing service was charged the wrong total for their basket. Write a JUnit test that reproduces their case and fails, then fix the code so your test and the existing tests pass.
javaspring-boot
SecureMid
25 min

Fix a login where user input becomes SQL

A pentest found two holes in a login and user-search module: the username alice' -- logs in with no password, and searching for ' OR '1'='1 lists every user. Close both without changing what normal input returns.
pythonsqlite
SecureSenior
35 min

Stop a URL fetcher from reaching internal addresses

A security review got straight past the SSRF guard on a URL-fetch feature: the cloud metadata IP, a private 10.x host and a hex-encoded loopback address were all allowed. Fix is_safe_url without blocking public URLs.
python
BuildMid
30 min

Extract valid JSON from messy LLM replies

Write extract_json(text) so it recovers the intended JSON object from messy LLM replies: prose around it, code fences, trailing commas, single quotes. A reply with no object should raise ParseError.
python
BuildMid
30 min

Validate and coerce an LLM's tool call arguments

Write validate(args, schema), the check between an LLM's tool call and your code. Coerce the strings models send, like "5" and "true", to the declared types, and raise ValidationError naming the field when a value can't fit.
python
BuildMid
35 min

Split a dataset reproducibly with balanced classes

Fix split() in splitter.py so the same seed always gives the same train/test split, every row lands in exactly one set, and each class keeps its share.
python
BuildMid
35 min

Fix an undo history that replays stale commands

Fix the undo/redo history behind an editor. Redo can bring back a change the user has already replaced, and undo or redo past either end of the history isn't safe.
python
BuildMid
35 min

Build a URL matcher with params and wildcards

Rewrite match(method, path, routes), the route matcher of a small web framework. Some requests currently land on the wrong handler. Make it follow the documented rules for params, wildcards, methods and precedence.
python
BuildMid
30 min

Rank documents by cosine similarity for RAG retrieval

Fix search(query_vec, corpus, k) so it returns the k documents closest to a query by cosine similarity, best first. On some corpora it gets both the documents and their order wrong.
python
BuildMid
30 min

Stop a virtual list clipping its last row

Rows in a virtualized list go missing or land in the wrong place at the edges of the screen, and short lists crash with an IndexError. Rewrite visible_window() so it returns exactly the right range of rows.
python