Topics / 🧭 Agentic AI Patterns (LLM stream) / 📚 Level 59: Agentic AI: Pattern Playbook

Python exercise · about 5 minutes · free

Pattern Playbook: From Needs to Patterns

You now know the catalogue. The craft is choosing: which two or three patterns does this particular product need, and which do you skip?

Patterns are not a checklist to apply all at once. Each one adds cost (latency, tokens, complexity), so add a pattern only when a need calls for it.

  • Known steps in order: prompt chaining. Many kinds of request: routing. Independent subtasks: parallelization. Output must be checked: reflection.
  • Needs outside data or actions: tool use. Path not known up front: planning. Distinct specialist roles: multi-agent collaboration.
  • Must remember people: memory. Costly mistakes: human-in-the-loop. Private documents: RAG. Budget limits: resource-aware optimisation. Safety rules: guardrails. Quality must be measured: evaluation and monitoring.

Some needs imply others: high stakes also calls for guardrails; specialist roles need a coordinator that routes between them. Build a small advisor.

Prices, versions and service names last checked 2026-11-19. They change, so confirm on the official pages before you rely on them.

Table. needs: need; high stakes; private docs; remember users. Operation: map + implied needs. Result patterns: pattern; memory management; human-in-the-loop; knowledge retrieval (RAG); guardrailsneedsneedhigh stakesprivate docsremember userspatternspatternmemory managementhuman-in-the-loopknowledge retrieval (RAG)guardrailsmap + implied needs
Your quest: Write suggest_patterns(needs). needs is a list of need names from NEEDS; raise ValueError for an unknown name. Add the implied needs from IMPLIES, then return the pattern names for all wanted needs, without duplicates, in the order of NEEDS.
Try it now Runs in your browser. No sign-in needed. Ctrl+Enter to run.
HintCopy the needs into a set, then add <code>IMPLIES.get(n, [])</code> for each. Finally <code>[NEEDS[k] for k in NEEDS if k in wanted]</code> gives canonical order for free.
Output appears here.

Open it in the full course → Free with Google: saves your progress and unlocks 627 lessons.

In this level you'll learn:
More in Level 59: Agentic AI: Pattern Playbook

Share on LinkedIn