Each pattern starts with a job that goes wrong. Then one idea fixes it, and code counts the change. For example, one big prompt can lose a detail that short steps keep.
You need uv and a model key.
uv sync
cp env.example .env
uv run lab
uv run lab prompt-chaining naive
uv run lab prompt-chainingPaste your key into the new file before the last two lines. uv sync builds a private
environment in this folder, so it cannot clash with your other projects.
Add --case 2 to try another input. To check your own edits, run uv run check. It needs no key.
To measure every pattern again with a real model, run uv run verify. That one costs money.
| Pattern | Job | Run |
|---|---|---|
| Chain prompts | Turn a client brief into a quote draft. | uv run lab prompt-chaining |
| Route requests | Send each gym member message to the right desk. | uv run lab routing |
| Run calls in parallel | Write the copy for a new menu item. | uv run lab parallelization |
| Review your own draft | Write a job ad that follows house rules. | uv run lab reflection |
| Call tools | Answer parcel questions from a courier system. | uv run lab tool-calling |
| Plan before you act | Plan the opening week of a bakery. | uv run lab planning |
| Validate model output | Read booking emails into records. | uv run lab pydantic-validation |
| Orchestrate a workflow | Onboard a new tenant. | uv run lab workflow-orchestration |
| Control flow with states | Move a car repair to pickup. | uv run lab state-machines |
| Pattern | Job | Run |
|---|---|---|
| Set checkable goals | Draft a study plan around nurse shifts. | uv run lab goal-setting |
| Reason step by step | Price a theme park group visit. | uv run lab chain-of-thought |
| Correct mistakes from errors | Clean a supplier price list. | uv run lab self-correction |
| Break down a problem | Cost a wedding catering order. | uv run lab problem-decomposition |
| Explore before you answer | Find why cafe profit fell. | uv run lab exploration-discovery |
| Recurse into sub-tasks | Total the parts for a garden shed. | uv run lab recursive-agents |
| Split planning from doing | Prepare a conference room. | uv run lab plan-executor |
| Reason with observations | Trace a missing pharmacy delivery. | uv run lab react |
| Verify every step | Move a gym plan to a new branch. | uv run lab pev |
| Search many reasoning paths | Seat wedding guests apart. | uv run lab tree-of-thoughts |
| Simulate before acting | Reorder stock for a florist. | uv run lab mental-loop |
| Vote across answers | Grade damage on a rental return. | uv run lab ensemble |
| Pattern | Job | Run |
|---|---|---|
| Manage conversation memory | Track a diner's allergies. | uv run lab memory-management |
| Learn from corrections | File expenses the house way. | uv run lab learning-adaptation |
| Answer from documents | Answer from a holiday policy. | uv run lab knowledge-retrieval |
| Search until the answer is found | Answer warranty questions. | uv run lab agentic-rag |
| Rewrite vague questions | Search a library from a chat. | uv run lab query-rewriter |
| Check retrieved text | Answer parents from school notices. | uv run lab relevancy-check |
| Compute answers with code | Report market stall sales. | uv run lab data-processing |
| Separate events from facts | Remember a pet owner. | uv run lab episodic-semantic-memory |
| Link facts in a graph | Find who approves charity spend. | uv run lab graph-memory |
| Pattern | Job | Run |
|---|---|---|
| Connect tools over MCP | Check seats at a community theatre. | uv run lab mcp |
| Run model code safely | Split a shared house's bills. | uv run lab code-execution |
| Load skills on demand | Write letters for a dental clinic. | uv run lab agent-skills |
| Attach tools to skills | Handle desk tasks at a sports club. | uv run lab skills-with-mcp |
| Build an MCP server | Share a bike shop's service records. | uv run lab mcp-server |
| Search a large tool set | Serve a city help line. | uv run lab tool-search |
| Write code that calls tools | Chase invoices for a print shop. | uv run lab code-mode |
| Use a computer by its screen | Move bookings at a barber shop. | uv run lab computer-use |
| Generate screens from typed blocks | Show free campsite pitches. | uv run lab generative-ui |
| Pattern | Job | Run |
|---|---|---|
| Split work across agents | Produce a walking tour leaflet. | uv run lab multi-agent |
| Pass typed messages | Hand over a flower order. | uv run lab inter-agent-communication |
| Nest one workflow inside another | Check a credit union loan. | uv run lab subgraphs |
| Share a blackboard | Diagnose a faulty greenhouse. | uv run lab blackboard |
| Choose the next agent | Prepare an estate agent listing. | uv run lab meta-controller |
| Coordinate through neighbours | Route warehouse pickers. | uv run lab cellular-automata |
| Talk across agents with A2A | Get a freight partner price. | uv run lab a2a-protocol |
| Pattern | Job | Run |
|---|---|---|
| Ask a person first | Refund guests at a holiday park. | uv run lab human-in-loop |
| Guard input and output | Answer savings club members. | uv run lab guardrails |
| Evaluate with a gold set | Tag laundrette reviews. | uv run lab evaluation |
| Hide personal data | Summarise tenant complaints. | uv run lab anonymization |
| Preview before you change | Clean a club mailing list. | uv run lab dry-run |
| Improve from scored feedback | Write optician reminders. | uv run lab rlhf |
| Know what you do not know | Advise at a garden shop. | uv run lab reflexive-metacognitive |
| Gate every tool call | Run a school's accounts. | uv run lab permission-gateway |
| Isolate untrusted text | Read supplier emails. | uv run lab untrusted-input |
| Pattern | Job | Run |
|---|---|---|
| Compact a long history | Support a broadband fault call. | uv run lab context-compaction |
| Isolate work in subagents | Compare quotes from movers. | uv run lab subagent-isolation |
| Keep memory in files | Track a home renovation. | uv run lab file-memory |
| Resume long runs | Catalogue donated museum photos. | uv run lab long-running-harness |
| Pattern | Job | Run |
|---|---|---|
| Queue events in an inbox | Handle storage door alerts. | uv run lab event-inbox |
| Set your own timers | Follow up on unpaid class fees. | uv run lab self-timers |
| Send through an outbox | Warn farmers about weather. | uv run lab outbox |
| Run an always-on teammate | Keep a nursery day on track. | uv run lab always-on-teammate |
| Pattern | Job | Run |
|---|---|---|
| Recover from failures | Book taxis on a flaky system. | uv run lab exception-handling |
| Cut model cost | Triage insurance broker post. | uv run lab resource-optimization |
| Trace every call | Watch a phone shop's chat helper. | uv run lab monitoring |
| Rank work by rules | Order a plumber's jobs. | uv run lab prioritization |