Ai Agents
Skill Profile
(Select at least one profile to enable specific modules)
Overview
AI agents are autonomous systems that use language models to perform tasks, make decisions, and interact with users or other systems. They combine reasoning (thinking) with action (doing) in iterative loops, enabling them to solve complex problems by breaking them down into smaller steps, using tools, and learning from feedback.
Why This Matters
- Reduces Downtime: AI agents provide 24/7 automated responses, reducing system downtime
- Reduces Manual Effort: Automates repetitive tasks, freeing human time for complex work
- Increases Gross Margin: Automated workflows reduce operational costs
- Consistent Quality: Agents follow defined processes consistently
- Scalability: Can handle many simultaneous requests without degradation
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
- Inputs:
- User goals or queries (text)
- Tool definitions (schemas, descriptions)
- Memory context (conversation history, vector embeddings)
- Entry Conditions:
- LLM API access configured with valid credentials
- Tool definitions registered with clear schemas
- Memory system initialized (if using persistent memory)
- Outputs:
- Final answer or response (text, JSON, structured data)
- Execution trace (thoughts, actions, observations)
- Tool execution results
- Artifacts Required (Deliverables):
- Agent implementation code
- Tool definitions and schemas
- Memory system configuration
- Monitoring and logging setup
- Acceptance Evidence:
- Test execution logs showing successful agent runs
- Performance metrics (latency, token usage, success rate)
- Error handling validation
- Success Criteria:
- Agent completes goals within max iterations (typically <10)
- p95 latency < 5 seconds for typical tasks
- Tool execution success rate > 95%
- Cost per task within budget limits
Skill Composition
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
# Example implementation following best practices
def example_function():
# Your implementation here
pass
Assumptions / Constraints / Non-goals
- Assumptions:
- Development environment is properly configured
- Required dependencies are available
- Team has basic understanding of domain
- Constraints:
- Must follow existing codebase conventions
- Time and resource limitations
- Compatibility requirements
- Non-goals:
- This skill does not cover edge cases outside scope
- Not a replacement for formal training
Compatibility & Prerequisites
- Supported Versions:
- Python 3.8+
- Node.js 16+
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Required AI Tools:
- Code editor (VS Code recommended)
- Testing framework appropriate for language
- Version control (Git)
- Dependencies:
- Language-specific package manager
- Build tools
- Testing libraries
- Environment Setup:
.env.example keys: API_KEY, DATABASE_URL (no values)
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 / Pitfalls
- ⛔ Don't: Log PII, catch-all exception, N+1 queries
- ⚠️ Watch out for: Common symptoms and quick fixes
- 💡 Instead: Use proper error handling, pagination, and logging
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.
1---2name: ai-agents-23description: AI agents are autonomous systems that use language models to perform Use when this capability is needed.4---56# Ai Agents78## Skill Profile9*(Select at least one profile to enable specific modules)*10- [ ] **DevOps**11- [x] **Backend**12- [ ] **Frontend**13- [ ] **AI-RAG**14- [ ] **Security Critical**1516## Overview17AI agents are autonomous systems that use language models to perform tasks, make decisions, and interact with users or other systems. They combine reasoning (thinking) with action (doing) in iterative loops, enabling them to solve complex problems by breaking them down into smaller steps, using tools, and learning from feedback.1819## Why This Matters20- **Reduces Downtime**: AI agents provide 24/7 automated responses, reducing system downtime21- **Reduces Manual Effort**: Automates repetitive tasks, freeing human time for complex work22- **Increases Gross Margin**: Automated workflows reduce operational costs23- **Consistent Quality**: Agents follow defined processes consistently24- **Scalability**: Can handle many simultaneous requests without degradation2526---2728## Core Concepts & Rules2930### 1. Core Principles31- Follow established patterns and conventions32- Maintain consistency across codebase33- Document decisions and trade-offs3435### 2. Implementation Guidelines36- Start with the simplest viable solution37- Iterate based on feedback and requirements38- Test thoroughly before deployment394041## Inputs / Outputs / Contracts42* **Inputs**:43 - User goals or queries (text)44 - Tool definitions (schemas, descriptions)45 - Memory context (conversation history, vector embeddings)46* **Entry Conditions**:47 - LLM API access configured with valid credentials48 - Tool definitions registered with clear schemas49 - Memory system initialized (if using persistent memory)50* **Outputs**:51 - Final answer or response (text, JSON, structured data)52 - Execution trace (thoughts, actions, observations)53 - Tool execution results54* **Artifacts Required (Deliverables)**:55 - Agent implementation code56 - Tool definitions and schemas57 - Memory system configuration58 - Monitoring and logging setup59* **Acceptance Evidence**:60 - Test execution logs showing successful agent runs61 - Performance metrics (latency, token usage, success rate)62 - Error handling validation63* **Success Criteria**:64 - Agent completes goals within max iterations (typically <10)65 - p95 latency < 5 seconds for typical tasks66 - Tool execution success rate > 95%67 - Cost per task within budget limits6869## Skill Composition70* **Depends on**: [llm-integration](../06-ai-ml-production/llm-integration/SKILL.md), [vector-database](../04-database/vector-database/SKILL.md)71* **Compatible with**: [chatbot-integration](./chatbot-integration/SKILL.md), [conversational-ui](./conversational-ui/SKILL.md), [ai-search](./ai-search/SKILL.md)72* **Conflicts with**: Simple API integration patterns (over-engineering risk)73* **Related Skills**: [llm-function-calling](../06-ai-ml-production/llm-function-calling/SKILL.md), [agent-patterns](../06-ai-ml-production/agent-patterns/SKILL.md), [langchain-patterns](../06-ai-ml-production/langchain-patterns/SKILL.md)7475---7677## Quick Start / Implementation Example78791. Review requirements and constraints802. Set up development environment813. Implement core functionality following patterns824. Write tests for critical paths835. Run tests and fix issues846. Document any deviations or decisions8586```python87# Example implementation following best practices88def example_function():89 # Your implementation here90 pass91```929394## Assumptions / Constraints / Non-goals9596* **Assumptions**:97 - Development environment is properly configured98 - Required dependencies are available99 - Team has basic understanding of domain100* **Constraints**:101 - Must follow existing codebase conventions102 - Time and resource limitations103 - Compatibility requirements104* **Non-goals**:105 - This skill does not cover edge cases outside scope106 - Not a replacement for formal training107108109## Compatibility & Prerequisites110111* **Supported Versions**:112 - Python 3.8+113 - Node.js 16+114 - Modern browsers (Chrome, Firefox, Safari, Edge)115* **Required AI Tools**:116 - Code editor (VS Code recommended)117 - Testing framework appropriate for language118 - Version control (Git)119* **Dependencies**:120 - Language-specific package manager121 - Build tools122 - Testing libraries123* **Environment Setup**:124 - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)125126127## Test Scenario Matrix (QA Strategy)128129| Type | Focus Area | Required Scenarios / Mocks |130| :--- | :--- | :--- |131| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |132| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |133| **E2E** | User Journey | Critical user flows to test |134| **Performance** | Latency / Load | Benchmark requirements |135| **Security** | Vuln / Auth | SAST/DAST or dependency audit |136| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |137138139## Technical Guardrails & Security Threat Model140141### 1. Security & Privacy (Threat Model)142* **Top Threats**: Injection attacks, authentication bypass, data exposure143- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII144- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager145- [ ] **Authorization**: Validate user permissions before state changes146147### 2. Performance & Resources148- [ ] **Execution Efficiency**: Consider time complexity for algorithms149- [ ] **Memory Management**: Use streams/pagination for large data150- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks151152### 3. Architecture & Scalability153- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection154- [ ] **Modularity**: Decouple logic from UI/Frameworks155156### 4. Observability & Reliability157- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`158- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`159- [ ] **Error Handling**: Standardized error codes, no bare except160- [ ] **Observability Artifacts**:161 - **Log Fields**: timestamp, level, message, request_id162 - **Metrics**: request_count, error_count, response_time163 - **Dashboards/Alerts**: High Error Rate > 5%164165166## Agent Directives & Error Recovery167*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*168169- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.170- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.171- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.172- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.173174175## Definition of Done (DoD) Checklist176177- [ ] Tests passed + coverage met178- [ ] Lint/Typecheck passed179- [ ] Logging/Metrics/Trace implemented180- [ ] Security checks passed181- [ ] Documentation/Changelog updated182- [ ] Accessibility/Performance requirements met (if frontend)183184185## Anti-patterns / Pitfalls186187* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries188* ⚠️ **Watch out for**: Common symptoms and quick fixes189* 💡 **Instead**: Use proper error handling, pagination, and logging190191192## Reference Links & Examples193194* Internal documentation and examples195* Official documentation and best practices196* Community resources and discussions197198199## Versioning & Changelog200201* **Version**: 1.0.0202* **Changelog**:203 - 2026-02-22: Initial version with complete template structure204205---206> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.207<!-- tomevault:4.0:skill_md:2026-04-13 -->