Agents practice problems
21 problems · 0 solved
An LLM agent is a program that lets a language model decide which tool to call, reads the result, and repeats until the task is done. The model does the thinking, but plain code does the plumbing: parsing output, calling tools safely, and stopping at the right time. These problems focus on that plumbing. You will parse a ReAct action from model output, extract a JSON tool call from messy text, route a request to a tool by keyword score, detect a repeating tool-call loop, retry a flaky tool with exponential backoff, enforce token and dollar budgets, validate tool arguments against a schema, trim and compact chat history under a token budget, and schedule a task plan into parallel waves with cycle detection. Start with the Easy problems on parsing ReAct actions and trimming history. Then write the main tool-calling loop and the retry logic, and end with schema validation and plan scheduling. Teams building AI products spend most of their time on exactly this glue code, and interviews for applied LLM roles now ask you to write an agent loop that does not break or burn money.
Easy 8
- Parse a ReAct agent's action from model output
- Trim an agent's chat history to fit a token budget
- Detect a repeating tool-call loop
- Route a request to a tool by keyword score
- Compute full-jitter and equal-jitter retry delays
- Truncate a long tool result to a token budget keeping head and tail
- Measure agent reliability with pass^k
- Deduplicate repeated tool calls with a canonical cache key
Medium 6
- Write the loop that runs a tool-calling agentPro
- Retry a flaky tool with exponential backoffPro
- Extract a JSON tool call from messy model outputPro
- Enforce token and dollar budgets on an agent runPro
- Retrieve agent memories by similarity and recencyPro
- Redact emails, phone numbers and card numbers before text reaches a modelPro
Hard 7
- Validate tool arguments against a schema before callingPro
- Schedule an agent's task plan into parallel waves with cycle detectionPro
- Compact an agent's message history under a token budgetPro
- Repair a truncated JSON tool call from a streaming modelPro
- Parse a full multi-step ReAct trace into structured stepsPro
- Find the latency and critical path of an agent's task planPro
- Schedule tool calls under global and per-tool concurrency limitsPro