{"id":30863487,"url":"https://github.com/lokahq/agentic-patterns-101","last_synced_at":"2025-09-07T18:54:01.226Z","repository":{"id":311589525,"uuid":"1034610374","full_name":"LokaHQ/agentic-patterns-101","owner":"LokaHQ","description":"Agentic Patterns 101 with Loka \u0026 Strands-Agents (AWS)","archived":false,"fork":false,"pushed_at":"2025-09-01T10:27:26.000Z","size":980,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-01T12:39:10.901Z","etag":null,"topics":["agentic-ai","agentic-workflows","agents","ai","aws","bedrock","genai","machine-learning","multi-agent-systems","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LokaHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-08T17:11:49.000Z","updated_at":"2025-09-01T10:27:28.000Z","dependencies_parsed_at":"2025-08-25T12:17:53.742Z","dependency_job_id":"0689d5fa-0b85-428e-8d5b-5de9aeca8139","html_url":"https://github.com/LokaHQ/agentic-patterns-101","commit_stats":null,"previous_names":["lokahq/agentic-patterns-101"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LokaHQ/agentic-patterns-101","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LokaHQ%2Fagentic-patterns-101","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LokaHQ%2Fagentic-patterns-101/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LokaHQ%2Fagentic-patterns-101/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LokaHQ%2Fagentic-patterns-101/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LokaHQ","download_url":"https://codeload.github.com/LokaHQ/agentic-patterns-101/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LokaHQ%2Fagentic-patterns-101/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274081258,"owners_count":25219023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic-ai","agentic-workflows","agents","ai","aws","bedrock","genai","machine-learning","multi-agent-systems","python"],"created_at":"2025-09-07T18:53:59.644Z","updated_at":"2025-09-07T18:54:01.215Z","avatar_url":"https://github.com/LokaHQ.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\" style=\"display: flex; align-items: center; justify-content: center; gap: 30px;\"\u003e\n\n  \u003ca href=\"https://loka.com\"\u003e\n    \u003cimg src=\"https://media.licdn.com/dms/image/v2/D4D0BAQGjlTZNkGk34w/company-logo_200_200/company-logo_200_200/0/1719824852415/loka_logo?e=2147483647\u0026v=beta\u0026t=b02H4t2HnGT1QvNFfSctVcPqMgaDojSW1OcJPA-Lk18\"\n         alt=\"Loka\" height=\"100px\"\u003e\n  \u003c/a\u003e\n\n\u003cspan style=\"color: white; font-size: 40px; font-weight: bold; display: flex; align-items: center; justify-content: center;\"\u003e×\u003c/span\u003e\n\n  \u003ca href=\"https://strandsagents.com\"\u003e\n    \u003cimg src=\"https://strandsagents.com/latest/assets/logo-github.svg\"\n         alt=\"Strands Agents\" height=\"100px\"\u003e\n  \u003c/a\u003e\n\n\u003c/div\u003e\n\n\u003ch2 align=\"center\"\u003e\n  Agentic Patterns 101 with Loka \u0026 Strands-Agents (AWS)\n\u003c/h2\u003e\n\nWelcome to **Agentic Patterns 101** - a comprehensive collection of practical implementations demonstrating various agentic design patterns using [Strands-Agents](https://strandsagents.com).\n\nWhether you're building content generation pipelines, document processing systems, or complex multi-step AI workflows, these patterns provide tested foundations for your agentic applications.\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth colspan=\"5\" style=\"text-align: center; font-size: 1.5em; padding: 20px; background-color: #f8f9fa; border: 2px solid #dee2e6;\"\u003e\n        \u003cstrong\u003eAgentic Patterns\u003c/strong\u003e\n      \u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003ePattern\u003c/th\u003e\n      \u003cth\u003eDescription \u0026 Key Characteristics\u003c/th\u003e\n      \u003cth\u003eUse Cases \u0026 Industries\u003c/th\u003e\n      \u003cth\u003eWhen to Use / When Not to Use\u003c/th\u003e\n      \u003cth\u003eFile Paths\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eSequential Workflow\u003c/strong\u003e\u003cbr\u003e(Prompt Chaining)\u003c/td\u003e\n      \u003ctd\u003eTasks completed step-by-step where each agent's output becomes input for the next.\u003cbr\u003e\u003cbr\u003e• Linear sequence\u003cbr\u003e• Each step depends on previous\u003cbr\u003e• Minimal branching\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eDocument generation:\u003c/strong\u003e outline → content → validation\u003cbr\u003e\u003cstrong\u003eData processing:\u003c/strong\u003e extract → transform → summarize\u003cbr\u003e\u003cstrong\u003eResearch:\u003c/strong\u003e collect → synthesize → format\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eUse:\u003c/strong\u003e Discrete, ordered steps\u003cbr\u003e\u003cstrong\u003eAvoid:\u003c/strong\u003e Need flexibility or parallel processing\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"./agentic-patterns/sequential-workflow.py\"\u003e\u003ccode\u003esequential-workflow.py\u003c/code\u003e\u003c/a\u003e\u003cbr\u003e\u003ca href=\"./agentic-patterns/sequential-workflow-tool.py\"\u003e\u003ccode\u003esequential-workflow-tool.py\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eParallel Workflow\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003eMultiple agents execute tasks simultaneously, often from shared input or preceding step output.\u003cbr\u003e\u003cbr\u003e• Concurrent execution\u003cbr\u003e• Shared/partitioned inputs\u003cbr\u003e• Result coordination needed\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eContent enrichment:\u003c/strong\u003e draft + grammar check + fact-check in parallel\u003cbr\u003e\u003cstrong\u003eMulti-perspective analysis:\u003c/strong\u003e financial report + risk analysis + market sentiment\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eUse:\u003c/strong\u003e Independent subtasks\u003cbr\u003e\u003cstrong\u003eAvoid:\u003c/strong\u003e Highly dependent outputs\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"./agentic-patterns/parallel-workflow-tool.py\"\u003e\u003ccode\u003eparallel-workflow-tool.py\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eLLM Routing\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003eAutomatically directs queries to the most appropriate model based on complexity, domain expertise, or computational requirements.\u003cbr\u003e\u003cbr\u003e\n      • Dynamic model selection \u003cbr\u003e\n      • Centralized routing logic\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eSoftware development:\u003c/strong\u003e syntax questions → lightweight models, architecture → reasoning models\u003cbr\u003e\u003cstrong\u003eCustomer support:\u003c/strong\u003e FAQ → fast models, troubleshooting → specialized models\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eUse:\u003c/strong\u003e Query complexity varies significantly, cost optimization important\u003cbr\u003e\u003cstrong\u003eAvoid:\u003c/strong\u003e Similar complexity levels across queries, routing overhead exceeds benefits\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"./agentic-patterns/llm_routing.py\"\u003e\u003ccode\u003ellm_routing.py\u003c/code\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eReflection Pattern\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003eAgent generates initial output, receives feedback from judge agent, then refines work through iterative improvement cycles.\u003cbr\u003e\u003cbr\u003e\n      • Iterative improvement through feedback loops\u003c\u003cbr\u003e\n      • Quality enhancement through refinement\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eCreative content:\u003c/strong\u003e draft → critique → refinement for scripts, marketing copy\u003cbr\u003e\u003cstrong\u003eCode review:\u003c/strong\u003e generate → analyze → refactor based on feedback\u003cbr\u003e\u003cstrong\u003eResearch:\u003c/strong\u003e findings → critique → strengthen analysis\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eUse:\u003c/strong\u003e Output quality critical, iterative improvement adds value\u003cbr\u003e\u003cstrong\u003eAvoid:\u003c/strong\u003e Simple tasks, feedback overhead exceeds improvement value\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"./agentic-patterns/reflection_pattern.py\"\u003e\u003ccode\u003ereflection_pattern.py\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n     \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003ePure Tools\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        A single-agent pattern where tools handle specific domain logic while the agent orchestrates their usage through natural language interactions.\n        \u003cbr\u003e\u003cbr\u003e\n        • Simple agent-tool architecture\u003cbr\u003e\n        • Natural language tool orchestration\u003cbr\u003e\n        • Model-powered tool intelligence\u003cbr\u003e\n        • Clean separation of concerns\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eE-commerce:\u003c/strong\u003e Inventory management and order processing\u003cbr\u003e\n        \u003cstrong\u003eData Management:\u003c/strong\u003e create → read → update → delete → query\u003cbr\u003e\n        \u003cstrong\u003eHR systems:\u003c/strong\u003e Employee onboarding and performance tracking\u003cbr\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eUse:\u003c/strong\u003e Domain-specific applications with clear tool boundaries and shared state\u003cbr\u003e\u003cstrong\u003eAvoid:\u003c/strong\u003e Complex multi-step workflows requiring multiple specialized agents\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"./agentic-patterns/pure-tools.py\"\u003e\u003ccode\u003epure-tools.py\u003c/code\u003e\u003c/a\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eMCP Server Tools\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003eModel Context Protocol enables standardized communication between agents and external tools/services via MCP servers.\u003cbr\u003e\u003cbr\u003e• Standardized communication\u003cbr\u003e• Model-agnostic\u003cbr\u003e• External tool integration\u003cbr\u003e• System interoperability\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eEnterprise data:\u003c/strong\u003e ERP/CRM system access\u003cbr\u003e\u003cstrong\u003eKnowledge retrieval:\u003c/strong\u003e Vector DB queries\u003cbr\u003e\u003cstrong\u003eAutomation:\u003c/strong\u003e Scheduling/ticketing APIs\u003cbr\u003e\u003cstrong\u003eHealthcare:\u003c/strong\u003e EHR/medical ontology access\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eUse:\u003c/strong\u003e Structured external tool access\u003cbr\u003e\u003cstrong\u003eAvoid:\u003c/strong\u003e Self-contained tasks or simple API calls\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"./agentic-patterns/mcp-server-tools.py\"\u003e\u003ccode\u003emcp-server-tools.py\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eAgents as Tools\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        A multi-agent pattern where individual agents expose their capabilities as callable tools, enabling orchestration by a central agent or system.\n        \u003cbr\u003e\u003cbr\u003e\n        • Agents encapsulate domain-specific intelligence\u003cbr\u003e\n        • Flexible agent composition\u003cbr\u003e\n        • Scalable, modular architecture\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eCustomer Support:\u003c/strong\u003e AI chatbots handling FAQs\u003cbr\u003e\n        \u003cstrong\u003eFinance:\u003c/strong\u003e Loan processing agents or fraud detection agents\u003cbr\u003e\n        \u003cstrong\u003eEducation:\u003c/strong\u003e Adaptive learning agents or curriculum planning agents\u003cbr\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eUse:\u003c/strong\u003e Scenarios requiring multiple specialized agents to collaborate\u003cbr\u003e\u003cstrong\u003eAvoid:\u003c/strong\u003e Simple single-domain applications where one agent suffices\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"./agentic-patterns/agents-as-tools.py\"\u003e\u003ccode\u003eagents-as-tools.py\u003c/code\u003e\u003c/a\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eSwarm\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003e Multiple specialized agents work together as autonomous peers through shared working memory and self-organizing coordination.\u003cbr\u003e\u003cbr\u003e• Autonomous coordination without central control\u003cbr\u003e• Shared working memory for all agents\u003cbr\u003e• Dynamic task distribution based on discoveries\u003cbr\u003e• Peer-to-peer handoffs\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eViral content creation:\u003c/strong\u003e trend analysts, creators, copywriters collaborating fluidly\u003cbr\u003e\u003cstrong\u003eResearch investigation:\u003c/strong\u003e specialists handing off based on emerging findings\u003cbr\u003e\u003cstrong\u003eCrisis response:\u003c/strong\u003e dynamic collaboration as situations evolve\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eUse:\u003c/strong\u003e Unpredictable outcomes, creative collaboration\u003cbr\u003e\u003cstrong\u003eAvoid:\u003c/strong\u003e Clear hierarchies, central coordination preferred\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"./agentic-patterns/swarm.py\"\u003e\u003ccode\u003eswarm.py\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eGraph Multi-Agent Pattern\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        A deterministic DAG-based orchestration model where each node is an agent (or custom multi-agent), and edges represent execution dependencies.\n        \u003cbr\u003e\u003cbr\u003e\n        • Deterministic execution order\u003cbr\u003e\n        • Clear dependency management\u003cbr\u003e\n        • Nested patterns and custom node types\u003cbr\u003e\n        • Conditional and multi-modal support\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eFinancial analysis:\u003c/strong\u003e fetch → analyze → summarize → report\u003cbr\u003e\n        \u003cstrong\u003eContent creation:\u003c/strong\u003e research → draft → edit → publish\u003cbr\u003e\n        \u003cstrong\u003eIoT:\u003c/strong\u003e monitor → diagnose → optimize → alert\u003cbr\u003e\n        \u003cstrong\u003eHealthcare:\u003c/strong\u003e collect → analyze → diagnose → recommend\u003cbr\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eUse:\u003c/strong\u003e Complex workflows with clear agent dependencies\u003cbr\u003e\u003cstrong\u003eAvoid:\u003c/strong\u003e Simple pipelines better suited for Workflow pattern\u003c/td\u003e\n      \u003ctd\u003e\u003ca href=\"./agentic-patterns/graph-multi-agent.py\"\u003e\u003ccode\u003egraph-multi-agent.py\u003c/code\u003e\u003c/a\u003e\n      \u003ca href=\"./agentic-patterns/graph-multi-agent-tool.py\"\u003e\u003ccode\u003egraph-multi-agent-tool.py\u003c/code\u003e\u003c/a\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n## License\n\nThis project is licensed under the Apache License, Version 2.0. See the [LICENSE](LICENSE) file for details.\n\n## Repository Structure\n\n```\n├── .github/                                 # GitHub Actions workflows\n│   ├── workflows/                           # GitHub Actions workflow files\n│   │   └── uv-ci.yaml                       # uv (python) Continuous Integration workflow\n│   └── dependabot.yaml                      # Configuration file for Dependabot\n├── agentic-patterns/                        # Implementation directory\n│   ├── agents-as-tools.py                   # Agents as tools orchestration workflow\n│   ├── graph-multi-agent-tool.py            # Tool-based graph multi-agent implementation\n│   ├── graph-multi-agent.py                 # Graph multi-agent implementation\n|   ├── llm_routing.py                       # LLM Routing Implementation\n│   ├── mcp-server-tools.py                  # MCP server tools implementation\n│   ├── parallel-workflow-tool.py            # Tool-based parallel workflow implementation\n│   ├── pure-tools.py                        # Pure tools implementation\n|   ├── reflection_pattern.py                # Reflection Pattern implementation\n│   ├── sequential-workflow-tool.py          # Tool-based sequential workflow implementation\n│   ├── sequential-workflow.py               # Function-based sequential workflow implementation\n│   └── swarm.py                             # Swarm pattern implementation\n├── assets/                                  # Diagrams\n│   └── strands_agents_pattern.drawio       # Diagrams for strands agents pattern\n├── .gitignore                               # Git ignore patterns\n├── .pre-commit-config.yaml                  # Pre-commit hooks configuration\n├── .python-version                          # Python version specification\n├── LICENSE                                  # Project license\n├── pyproject.toml                           # Pyproject configuration file\n├── README.md                                # Project documentation\n└── uv.lock                                  # uv lock file for dependencies\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flokahq%2Fagentic-patterns-101","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flokahq%2Fagentic-patterns-101","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flokahq%2Fagentic-patterns-101/lists"}