| name | agent-patterns |
| description | AI agents are autonomous systems that use Large Language Models (LLMs) Use when this capability is needed. |
| metadata | {"author":"amnadtaowsoam"} |
Agent Patterns
Skill Profile
(Select at least one profile to enable specific modules)
Overview
AI agents are autonomous systems that use Large Language Models (LLMs) to reason, plan, and execute tasks. Unlike simple chatbots, agents can break down complex problems into steps, use tools to interact with external systems, and adapt their behavior based on feedback. This skill covers agent architectures (ReAct, Plan-and-Execute, Tree of Thoughts, Reflexion), core components (memory, planning, tool use), frameworks (LangChain, AutoGPT, CrewAI, Semantic Kernel), tool design, multi-agent systems, error recovery, guardrails, evaluation, and production deployment.
Why This Matters
AI agents represent a paradigm shift from passive LLM interactions to autonomous problem-solving systems. They enable:
- Complex Task Decomposition: Breaking down user goals into actionable steps
- Tool Integration: Seamlessly connecting LLMs to external APIs and databases
- Adaptive Behavior: Learning from feedback and adjusting strategies
- Multi-Agent Collaboration: Specialized agents working together on complex problems
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
Skill Composition
- Depends on: None
- Compatible with: None
- Conflicts with: None
- Related Skills: None
Quick Start / Implementation Example
- Review requirements and constraints
- Set up development environment
- Implement core functionality following patterns
- Write tests for critical paths
- Run tests and fix issues
- Document any deviations or decisions
def example_function():
pass
Assumptions
- LLM API is available and reliable
- Tools are well-documented with clear schemas
- Network connectivity for external API calls
- Sufficient compute resources for LLM inference
Compatibility
- Python 3.8+
- OpenAI API (or compatible LLM provider)
- LangChain 0.1+ (optional, for framework-based agents)
- CrewAI 0.1+ (optional, for multi-agent systems)
Test Scenario Matrix (QA Strategy)
| Type | Focus Area | Required Scenarios / Mocks |
|---|
| Unit | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| Integration | DB / API | All external API calls or database connections must be mocked during unit tests |
| E2E | User Journey | Critical user flows to test |
| Performance | Latency / Load | Benchmark requirements |
| Security | Vuln / Auth | SAST/DAST or dependency audit |
| Frontend | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done (DoD) Checklist
Anti-patterns
- Unbounded Iterations: Agents running forever without iteration limits
- Tool Overload: Too many tools causing confusion and poor performance
- Memory Bloat: Unbounded memory growth without cleanup
- Prompt Injection: User input manipulating agent behavior
- Silent Failures: Tool errors not properly propagated
- Hard-coded Context: Context baked into prompts instead of using memory
Reference Links & Examples
- Internal documentation and examples
- Official documentation and best practices
- Community resources and discussions
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
Converted and distributed by TomeVault — claim your Tome and manage your conversions.