{"id":"3fc3a08e-2750-45c5-b69b-35d96a672689","entityType":"agent","slug":"clawhub-ericn26-star-eric-ai-agents-architect","name":"Ai Agents Architect","canonicalUrl":"https://www.xpersona.co/agent/clawhub-ericn26-star-eric-ai-agents-architect","canonicalPath":"/agent/clawhub-ericn26-star-eric-ai-agents-architect","generatedAt":"2026-10-11T20:58:06.854Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-11T17:31:05.577Z","emptyReason":null},"description":"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent... Skill: Ai Agents Architect Owner: ericn26-star Summary: Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent... Tags: latest:6.0.0 Version history: v1.0.6 | 2026-05-05T03:58:37.393Z | auto No user-facing or functional changes in this version. - Version bump with no file or documentation changes detected. - All feat","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1K downloads reported by the source. Last updated 10/11/2026.","installCommand":"clawhub skill install s17a4j37w3f2wyke5hajt5vtad85wyxf:eric-ai-agents-architect","sourceUrl":"https://clawhub.ai/ericn26-star/eric-ai-agents-architect","homepage":"https://clawhub.ai/ericn26-star/skills/eric-ai-agents-architect","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/ericn26-star/eric-ai-agents-architect","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/ericn26-star/skills/eric-ai-agents-architect","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":60,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent... "},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-11T17:31:05.577Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T17:31:05.577Z","emptyReason":null},"stars":null,"forks":null,"downloads":1018,"packageName":null,"latestVersion":"1.0.6","tractionLabel":"1K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T17:31:05.563Z","emptyReason":null},"lastUpdatedAt":"2026-10-11T17:31:05.577Z","lastCrawledAt":"2026-10-11T17:31:05.563Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-12T17:31:05.563Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.6","createdAt":"2026-05-05T03:58:37.393Z","changelog":"No user-facing or functional changes in this version. - Version bump with no file or documentation changes detected. - All features and documentation remain as in the previous release.","fileCount":2,"zipByteSize":3874},{"version":"1.0.10","createdAt":"2026-05-04T17:57:32.161Z","changelog":"- No user-visible changes in this version. - Documentation and implementation guidelines remain unchanged. - No file changes detected since the last release.","fileCount":2,"zipByteSize":3875},{"version":"1.1.0","createdAt":"2026-05-04T04:56:21.973Z","changelog":"No user-visible changes in this version. Version bump only; no modifications or updates detected.","fileCount":2,"zipByteSize":3874},{"version":"6.0.0","createdAt":"2026-05-03T10:03:51.138Z","changelog":"No user-facing changes in this version. - No file changes detected between the previous and current versions.","fileCount":3,"zipByteSize":4785},{"version":"5.0.0","createdAt":"2026-05-03T04:59:12.518Z","changelog":"- Major update: Comprehensive, opinionated skill guide for designing and building robust autonomous AI agents. - Adds clear philosophies and practical guidelines for safe, reliable agent architecting. - Includes detailed architecture and code patterns: ReAct Loop, Plan-and-Execute, tool registries, memory systems, and multi-agent orchestration. - Emphasizes tool integration best practices with concrete schema/examples. - Focuses on safety: iteration limits, error handling, logging, and clear fallbacks. - Provides implementation-ready code snippets for rapid prototyping and debugging.","fileCount":2,"zipByteSize":3875},{"version":"2.0.1","createdAt":"2026-05-02T06:00:54.790Z","changelog":"Version 2.0.1 of eric-ai-agents-architect - No file changes detected in this release. - No user-facing features or documentation updates.","fileCount":2,"zipByteSize":3874},{"version":"1.0.5","createdAt":"2026-05-01T22:56:10.559Z","changelog":"- No file changes detected in this version. - Functionality, documentation, and implementation appear unchanged from the previous version.","fileCount":2,"zipByteSize":3873},{"version":"2.0.0","createdAt":"2026-05-01T22:03:59.408Z","changelog":"Version 2.0.0 of eric-ai-agents-architect - No file changes detected in this release. - All features, documentation, and design patterns remain unchanged from the previous version.","fileCount":2,"zipByteSize":3875}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17a4j37w3f2wyke5hajt5vtad85wyxf:eric-ai-agents-architect","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ericn26-star-eric-ai-agents-architect/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ericn26-star-eric-ai-agents-architect/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ericn26-star-eric-ai-agents-architect/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-ericn26-star-eric-ai-agents-architect/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-ericn26-star-eric-ai-agents-architect/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-ericn26-star-eric-ai-agents-architect/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-11T20:58:06.854Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ericn26-star-eric-ai-agents-architect/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ericn26-star-eric-ai-agents-architect/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ericn26-star-eric-ai-agents-architect/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-ericn26-star-eric-ai-agents-architect/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-11T17:31:05.577Z","emptyReason":null},"readme":"Skill: Ai Agents Architect\n\nOwner: ericn26-star\n\nSummary: Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent...\n\nTags: latest:6.0.0\n\nVersion history:\n\nv1.0.6 | 2026-05-05T03:58:37.393Z | auto\n\nNo user-facing or functional changes in this version.\n\n- Version bump with no file or documentation changes detected.\n- All features and documentation remain as in the previous release.\n\nv1.0.10 | 2026-05-04T17:57:32.161Z | auto\n\n- No user-visible changes in this version.\n- Documentation and implementation guidelines remain unchanged.\n- No file changes detected since the last release.\n\nv1.1.0 | 2026-05-04T04:56:21.973Z | auto\n\nNo user-visible changes in this version.  \nVersion bump only; no modifications or updates detected.\n\nv6.0.0 | 2026-05-03T10:03:51.138Z | auto\n\nNo user-facing changes in this version.\n\n- No file changes detected between the previous and current versions.\n\nv5.0.0 | 2026-05-03T04:59:12.518Z | auto\n\n- Major update: Comprehensive, opinionated skill guide for designing and building robust autonomous AI agents.\n- Adds clear philosophies and practical guidelines for safe, reliable agent architecting.\n- Includes detailed architecture and code patterns: ReAct Loop, Plan-and-Execute, tool registries, memory systems, and multi-agent orchestration.\n- Emphasizes tool integration best practices with concrete schema/examples.\n- Focuses on safety: iteration limits, error handling, logging, and clear fallbacks.\n- Provides implementation-ready code snippets for rapid prototyping and debugging.\n\nv2.0.1 | 2026-05-02T06:00:54.790Z | auto\n\nVersion 2.0.1 of eric-ai-agents-architect\n\n- No file changes detected in this release.\n- No user-facing features or documentation updates.\n\nv1.0.5 | 2026-05-01T22:56:10.559Z | auto\n\n- No file changes detected in this version.\n- Functionality, documentation, and implementation appear unchanged from the previous version.\n\nv2.0.0 | 2026-05-01T22:03:59.408Z | auto\n\nVersion 2.0.0 of eric-ai-agents-architect\n\n- No file changes detected in this release.\n- All features, documentation, and design patterns remain unchanged from the previous version.\n\nv1.0.2 | 2026-05-01T12:57:17.502Z | auto\n\nNo user-facing changes in this version.\n\n- No file changes detected since previous version.\n- Functionality, documentation, and behavior remain the same.\n\nv1.0.1 | 2026-05-01T09:56:05.527Z | auto\n\nNo functional or documentation changes in this version.\n\n- No file changes detected between versions 1.0.0 and 1.0.1\n- No updates to features, code, or documentation\n\nv1.0.0 | 2026-05-01T08:56:43.648Z | auto\n\neric-ai-agents-architect v1.0.0\n\n- Initial release.\n- Expert guidance on AI agent architecture, tool integration, memory systems, planning, and multi-agent orchestration.\n- Includes practical implementation patterns and safety guidelines for building robust, autonomous AI agents.\n- Provides code examples for core patterns like ReAct, Plan-and-Execute, tool registries, selective memory, and supervisor agents.\n- Emphasizes graceful degradation, balanced autonomy, and system observability.\n\nArchive index:\n\nArchive v1.0.6: 2 files, 3874 bytes\n\nFiles: _meta.json (143b), SKILL.md (9192b)\n\nFile v1.0.6:SKILL.md\n\n---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)\n```\n\n**Key Safety Features:**\n- `max_iterations` prevents infinite loops\n- Error handling surfaces tool failures to the agent\n- Partial results returned if limit reached\n\n### Plan-and-Execute\n\nFor complex tasks requiring upfront planning:\n\n```python\nclass PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)\n```\n\n**When to Use:**\n- Multi-step tasks with dependencies\n- Tasks requiring different expertise per step\n- When you want to show the plan to users first\n\n### Tool Registry Pattern\n\nDynamic tool management:\n\n```python\nclass ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)\n```\n\n## Tool Definition Best Practices\n\n### Good Tool Schema\n\n```json\n{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}\n```\n\n### Bad Tool Schema (Avoid)\n\n```json\n{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}\n```\n\n## Memory Architecture\n\n### Selective Memory Pattern\n\n```python\nclass AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)\n```\n\n## Multi-Agent Orchestration\n\n### Supervisor Pattern\n\n```python\nclass SupervisorAgent:\n    def __init__(self, supervisor_llm, worker_agents: dict):\n        self.supervisor = supervisor_llm\n        self.workers = worker_agents\n\n    def run(self, task: str) -> str:\n        # Supervisor decides which worker to use\n        while not self.is_complete(task):\n            decision = self.supervisor.decide(task, self.workers.keys())\n\n            worker = self.workers[decision.worker_name]\n            result = worker.run(decision.subtask)\n\n            task = self.supervisor.update_task(task, result)\n\n        return self.supervisor.synthesize(task)\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Problem | Solution |\n|--------------|---------|----------|\n| Unlimited loops | Agent runs forever | Set `max_iterations` |\n| Too many tools | Agent gets confused | Limit to 5-7 tools per task |\n| Vague tool descriptions | Wrong tool selection | Write detailed descriptions with examples |\n| Silent failures | Agent doesn't know tool failed | Surface errors explicitly |\n| Memory hoarding | Context overflow | Use selective memory with importance scoring |\n| Over-engineering | Single agent works fine | Justify multi-agent complexity |\n\n## Debugging Checklist\n\nWhen an agent misbehaves:\n\n1. **Check iteration count**: Is it hitting limits?\n2. **Review tool calls**: Are tools being called correctly?\n3. **Inspect memory**: Is relevant context available?\n4. **Trace reasoning**: What thoughts led to bad actions?\n5. **Test tools independently**: Do tools work in isolation?\n\nFile v1.0.6:_meta.json\n\n{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"1.0.6\",\n  \"publishedAt\": 1777953517393\n}\n\nArchive v1.0.10: 2 files, 3875 bytes\n\nFiles: _meta.json (144b), SKILL.md (9192b)\n\nFile v1.0.10:SKILL.md\n\n---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)\n```\n\n**Key Safety Features:**\n- `max_iterations` prevents infinite loops\n- Error handling surfaces tool failures to the agent\n- Partial results returned if limit reached\n\n### Plan-and-Execute\n\nFor complex tasks requiring upfront planning:\n\n```python\nclass PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)\n```\n\n**When to Use:**\n- Multi-step tasks with dependencies\n- Tasks requiring different expertise per step\n- When you want to show the plan to users first\n\n### Tool Registry Pattern\n\nDynamic tool management:\n\n```python\nclass ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)\n```\n\n## Tool Definition Best Practices\n\n### Good Tool Schema\n\n```json\n{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}\n```\n\n### Bad Tool Schema (Avoid)\n\n```json\n{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}\n```\n\n## Memory Architecture\n\n### Selective Memory Pattern\n\n```python\nclass AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)\n```\n\n## Multi-Agent Orchestration\n\n### Supervisor Pattern\n\n```python\nclass SupervisorAgent:\n    def __init__(self, supervisor_llm, worker_agents: dict):\n        self.supervisor = supervisor_llm\n        self.workers = worker_agents\n\n    def run(self, task: str) -> str:\n        # Supervisor decides which worker to use\n        while not self.is_complete(task):\n            decision = self.supervisor.decide(task, self.workers.keys())\n\n            worker = self.workers[decision.worker_name]\n            result = worker.run(decision.subtask)\n\n            task = self.supervisor.update_task(task, result)\n\n        return self.supervisor.synthesize(task)\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Problem | Solution |\n|--------------|---------|----------|\n| Unlimited loops | Agent runs forever | Set `max_iterations` |\n| Too many tools | Agent gets confused | Limit to 5-7 tools per task |\n| Vague tool descriptions | Wrong tool selection | Write detailed descriptions with examples |\n| Silent failures | Agent doesn't know tool failed | Surface errors explicitly |\n| Memory hoarding | Context overflow | Use selective memory with importance scoring |\n| Over-engineering | Single agent works fine | Justify multi-agent complexity |\n\n## Debugging Checklist\n\nWhen an agent misbehaves:\n\n1. **Check iteration count**: Is it hitting limits?\n2. **Review tool calls**: Are tools being called correctly?\n3. **Inspect memory**: Is relevant context available?\n4. **Trace reasoning**: What thoughts led to bad actions?\n5. **Test tools independently**: Do tools work in isolation?\n\nFile v1.0.10:_meta.json\n\n{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"1.0.10\",\n  \"publishedAt\": 1777917452161\n}\n\nArchive v1.1.0: 2 files, 3874 bytes\n\nFiles: _meta.json (143b), SKILL.md (9192b)\n\nFile v1.1.0:SKILL.md\n\n---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)\n```\n\n**Key Safety Features:**\n- `max_iterations` prevents infinite loops\n- Error handling surfaces tool failures to the agent\n- Partial results returned if limit reached\n\n### Plan-and-Execute\n\nFor complex tasks requiring upfront planning:\n\n```python\nclass PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)\n```\n\n**When to Use:**\n- Multi-step tasks with dependencies\n- Tasks requiring different expertise per step\n- When you want to show the plan to users first\n\n### Tool Registry Pattern\n\nDynamic tool management:\n\n```python\nclass ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)\n```\n\n## Tool Definition Best Practices\n\n### Good Tool Schema\n\n```json\n{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}\n```\n\n### Bad Tool Schema (Avoid)\n\n```json\n{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}\n```\n\n## Memory Architecture\n\n### Selective Memory Pattern\n\n```python\nclass AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)\n```\n\n## Multi-Agent Orchestration\n\n### Supervisor Pattern\n\n```python\nclass SupervisorAgent:\n    def __init__(self, supervisor_llm, worker_agents: dict):\n        self.supervisor = supervisor_llm\n        self.workers = worker_agents\n\n    def run(self, task: str) -> str:\n        # Supervisor decides which worker to use\n        while not self.is_complete(task):\n            decision = self.supervisor.decide(task, self.workers.keys())\n\n            worker = self.workers[decision.worker_name]\n            result = worker.run(decision.subtask)\n\n            task = self.supervisor.update_task(task, result)\n\n        return self.supervisor.synthesize(task)\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Problem | Solution |\n|--------------|---------|----------|\n| Unlimited loops | Agent runs forever | Set `max_iterations` |\n| Too many tools | Agent gets confused | Limit to 5-7 tools per task |\n| Vague tool descriptions | Wrong tool selection | Write detailed descriptions with examples |\n| Silent failures | Agent doesn't know tool failed | Surface errors explicitly |\n| Memory hoarding | Context overflow | Use selective memory with importance scoring |\n| Over-engineering | Single agent works fine | Justify multi-agent complexity |\n\n## Debugging Checklist\n\nWhen an agent misbehaves:\n\n1. **Check iteration count**: Is it hitting limits?\n2. **Review tool calls**: Are tools being called correctly?\n3. **Inspect memory**: Is relevant context available?\n4. **Trace reasoning**: What thoughts led to bad actions?\n5. **Test tools independently**: Do tools work in isolation?\n\nFile v1.1.0:_meta.json\n\n{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"1.1.0\",\n  \"publishedAt\": 1777870581973\n}\n\nArchive v6.0.0: 3 files, 4785 bytes\n\nFiles: _meta.json (143b), skill-card.md (1560b), SKILL.md (9192b)\n\nFile v6.0.0:SKILL.md\n\n---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)\n```\n\n**Key Safety Features:**\n- `max_iterations` prevents infinite loops\n- Error handling surfaces tool failures to the agent\n- Partial results returned if limit reached\n\n### Plan-and-Execute\n\nFor complex tasks requiring upfront planning:\n\n```python\nclass PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)\n```\n\n**When to Use:**\n- Multi-step tasks with dependencies\n- Tasks requiring different expertise per step\n- When you want to show the plan to users first\n\n### Tool Registry Pattern\n\nDynamic tool management:\n\n```python\nclass ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)\n```\n\n## Tool Definition Best Practices\n\n### Good Tool Schema\n\n```json\n{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}\n```\n\n### Bad Tool Schema (Avoid)\n\n```json\n{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}\n```\n\n## Memory Architecture\n\n### Selective Memory Pattern\n\n```python\nclass AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)\n```\n\n## Multi-Agent Orchestration\n\n### Supervisor Pattern\n\n```python\nclass SupervisorAgent:\n    def __init__(self, supervisor_llm, worker_agents: dict):\n        self.supervisor = supervisor_llm\n        self.workers = worker_agents\n\n    def run(self, task: str) -> str:\n        # Supervisor decides which worker to use\n        while not self.is_complete(task):\n            decision = self.supervisor.decide(task, self.workers.keys())\n\n            worker = self.workers[decision.worker_name]\n            result = worker.run(decision.subtask)\n\n            task = self.supervisor.update_task(task, result)\n\n        return self.supervisor.synthesize(task)\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Problem | Solution |\n|--------------|---------|----------|\n| Unlimited loops | Agent runs forever | Set `max_iterations` |\n| Too many tools | Agent gets confused | Limit to 5-7 tools per task |\n| Vague tool descriptions | Wrong tool selection | Write detailed descriptions with examples |\n| Silent failures | Agent doesn't know tool failed | Surface errors explicitly |\n| Memory hoarding | Context overflow | Use selective memory with importance scoring |\n| Over-engineering | Single agent works fine | Justify multi-agent complexity |\n\n## Debugging Checklist\n\nWhen an agent misbehaves:\n\n1. **Check iteration count**: Is it hitting limits?\n2. **Review tool calls**: Are tools being called correctly?\n3. **Inspect memory**: Is relevant context available?\n4. **Trace reasoning**: What thoughts led to bad actions?\n5. **Test tools independently**: Do tools work in isolation?\n\nFile v6.0.0:_meta.json\n\n{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"6.0.0\",\n  \"publishedAt\": 1777802631138\n}\n\nFile v6.0.0:skill-card.md\n\n## Description:\n\nExpert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[ericn26-star](https://clawhub.ai/user/ericn26-star)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and engineers use this skill to design, build, and review autonomous AI agent architectures, including tool integration, memory systems, planning strategies, and multi-agent orchestration.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Example agent patterns may be adapted into systems that execute tools, manage memory, or coordinate multiple agents.\n\nMitigation: Review generated implementations for user consent, iteration limits, credential handling, and logging before deployment.\n\n## Reference(s):\n\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, Code, Guidance]\n\n**Output Format:** [Markdown guidance with illustrative code examples]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Produces advisory architecture patterns and example snippets; it does not bundle executable code.]\n\n## Skill Version(s):\n\n6.0.0 (source: server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v5.0.0: 2 files, 3875 bytes\n\nFiles: _meta.json (143b), SKILL.md (9192b)\n\nFile v5.0.0:SKILL.md\n\n---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)\n```\n\n**Key Safety Features:**\n- `max_iterations` prevents infinite loops\n- Error handling surfaces tool failures to the agent\n- Partial results returned if limit reached\n\n### Plan-and-Execute\n\nFor complex tasks requiring upfront planning:\n\n```python\nclass PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)\n```\n\n**When to Use:**\n- Multi-step tasks with dependencies\n- Tasks requiring different expertise per step\n- When you want to show the plan to users first\n\n### Tool Registry Pattern\n\nDynamic tool management:\n\n```python\nclass ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)\n```\n\n## Tool Definition Best Practices\n\n### Good Tool Schema\n\n```json\n{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}\n```\n\n### Bad Tool Schema (Avoid)\n\n```json\n{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}\n```\n\n## Memory Architecture\n\n### Selective Memory Pattern\n\n```python\nclass AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)\n```\n\n## Multi-Agent Orchestration\n\n### Supervisor Pattern\n\n```python\nclass SupervisorAgent:\n    def __init__(self, supervisor_llm, worker_agents: dict):\n        self.supervisor = supervisor_llm\n        self.workers = worker_agents\n\n    def run(self, task: str) -> str:\n        # Supervisor decides which worker to use\n        while not self.is_complete(task):\n            decision = self.supervisor.decide(task, self.workers.keys())\n\n            worker = self.workers[decision.worker_name]\n            result = worker.run(decision.subtask)\n\n            task = self.supervisor.update_task(task, result)\n\n        return self.supervisor.synthesize(task)\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Problem | Solution |\n|--------------|---------|----------|\n| Unlimited loops | Agent runs forever | Set `max_iterations` |\n| Too many tools | Agent gets confused | Limit to 5-7 tools per task |\n| Vague tool descriptions | Wrong tool selection | Write detailed descriptions with examples |\n| Silent failures | Agent doesn't know tool failed | Surface errors explicitly |\n| Memory hoarding | Context overflow | Use selective memory with importance scoring |\n| Over-engineering | Single agent works fine | Justify multi-agent complexity |\n\n## Debugging Checklist\n\nWhen an agent misbehaves:\n\n1. **Check iteration count**: Is it hitting limits?\n2. **Review tool calls**: Are tools being called correctly?\n3. **Inspect memory**: Is relevant context available?\n4. **Trace reasoning**: What thoughts led to bad actions?\n5. **Test tools independently**: Do tools work in isolation?\n\nFile v5.0.0:_meta.json\n\n{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"5.0.0\",\n  \"publishedAt\": 1777784352518\n}\n\nArchive v2.0.1: 2 files, 3874 bytes\n\nFiles: _meta.json (143b), SKILL.md (9192b)\n\nFile v2.0.1:SKILL.md\n\n---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)\n```\n\n**Key Safety Features:**\n- `max_iterations` prevents infinite loops\n- Error handling surfaces tool failures to the agent\n- Partial results returned if limit reached\n\n### Plan-and-Execute\n\nFor complex tasks requiring upfront planning:\n\n```python\nclass PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)\n```\n\n**When to Use:**\n- Multi-step tasks with dependencies\n- Tasks requiring different expertise per step\n- When you want to show the plan to users first\n\n### Tool Registry Pattern\n\nDynamic tool management:\n\n```python\nclass ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)\n```\n\n## Tool Definition Best Practices\n\n### Good Tool Schema\n\n```json\n{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}\n```\n\n### Bad Tool Schema (Avoid)\n\n```json\n{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}\n```\n\n## Memory Architecture\n\n### Selective Memory Pattern\n\n```python\nclass AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)\n```\n\n## Multi-Agent Orchestration\n\n### Supervisor Pattern\n\n```python\nclass SupervisorAgent:\n    def __init__(self, supervisor_llm, worker_agents: dict):\n        self.supervisor = supervisor_llm\n        self.workers = worker_agents\n\n    def run(self, task: str) -> str:\n        # Supervisor decides which worker to use\n        while not self.is_complete(task):\n            decision = self.supervisor.decide(task, self.workers.keys())\n\n            worker = self.workers[decision.worker_name]\n            result = worker.run(decision.subtask)\n\n            task = self.supervisor.update_task(task, result)\n\n        return self.supervisor.synthesize(task)\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Problem | Solution |\n|--------------|---------|----------|\n| Unlimited loops | Agent runs forever | Set `max_iterations` |\n| Too many tools | Agent gets confused | Limit to 5-7 tools per task |\n| Vague tool descriptions | Wrong tool selection | Write detailed descriptions with examples |\n| Silent failures | Agent doesn't know tool failed | Surface errors explicitly |\n| Memory hoarding | Context overflow | Use selective memory with importance scoring |\n| Over-engineering | Single agent works fine | Justify multi-agent complexity |\n\n## Debugging Checklist\n\nWhen an agent misbehaves:\n\n1. **Check iteration count**: Is it hitting limits?\n2. **Review tool calls**: Are tools being called correctly?\n3. **Inspect memory**: Is relevant context available?\n4. **Trace reasoning**: What thoughts led to bad actions?\n5. **Test tools independently**: Do tools work in isolation?\n\nFile v2.0.1:_meta.json\n\n{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"2.0.1\",\n  \"publishedAt\": 1777701654790\n}\n\nArchive v1.0.5: 2 files, 3873 bytes\n\nFiles: _meta.json (143b), SKILL.md (9192b)\n\nFile v1.0.5:SKILL.md\n\n---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)\n```\n\n**Key Safety Features:**\n- `max_iterations` prevents infinite loops\n- Error handling surfaces tool failures to the agent\n- Partial results returned if limit reached\n\n### Plan-and-Execute\n\nFor complex tasks requiring upfront planning:\n\n```python\nclass PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)\n```\n\n**When to Use:**\n- Multi-step tasks with dependencies\n- Tasks requiring different expertise per step\n- When you want to show the plan to users first\n\n### Tool Registry Pattern\n\nDynamic tool management:\n\n```python\nclass ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)\n```\n\n## Tool Definition Best Practices\n\n### Good Tool Schema\n\n```json\n{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}\n```\n\n### Bad Tool Schema (Avoid)\n\n```json\n{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}\n```\n\n## Memory Architecture\n\n### Selective Memory Pattern\n\n```python\nclass AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)\n```\n\n## Multi-Agent Orchestration\n\n### Supervisor Pattern\n\n```python\nclass SupervisorAgent:\n    def __init__(self, supervisor_llm, worker_agents: dict):\n        self.supervisor = supervisor_llm\n        self.workers = worker_agents\n\n    def run(self, task: str) -> str:\n        # Supervisor decides which worker to use\n        while not self.is_complete(task):\n            decision = self.supervisor.decide(task, self.workers.keys())\n\n            worker = self.workers[decision.worker_name]\n            result = worker.run(decision.subtask)\n\n            task = self.supervisor.update_task(task, result)\n\n        return self.supervisor.synthesize(task)\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Problem | Solution |\n|--------------|---------|----------|\n| Unlimited loops | Agent runs forever | Set `max_iterations` |\n| Too many tools | Agent gets confused | Limit to 5-7 tools per task |\n| Vague tool descriptions | Wrong tool selection | Write detailed descriptions with examples |\n| Silent failures | Agent doesn't know tool failed | Surface errors explicitly |\n| Memory hoarding | Context overflow | Use selective memory with importance scoring |\n| Over-engineering | Single agent works fine | Justify multi-agent complexity |\n\n## Debugging Checklist\n\nWhen an agent misbehaves:\n\n1. **Check iteration count**: Is it hitting limits?\n2. **Review tool calls**: Are tools being called correctly?\n3. **Inspect memory**: Is relevant context available?\n4. **Trace reasoning**: What thoughts led to bad actions?\n5. **Test tools independently**: Do tools work in isolation?\n\nFile v1.0.5:_meta.json\n\n{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"1.0.5\",\n  \"publishedAt\": 1777676170559\n}\n\nArchive v2.0.0: 2 files, 3875 bytes\n\nFiles: _meta.json (143b), SKILL.md (9192b)\n\nFile v2.0.0:SKILL.md\n\n---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)\n```\n\n**Key Safety Features:**\n- `max_iterations` prevents infinite loops\n- Error handling surfaces tool failures to the agent\n- Partial results returned if limit reached\n\n### Plan-and-Execute\n\nFor complex tasks requiring upfront planning:\n\n```python\nclass PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)\n```\n\n**When to Use:**\n- Multi-step tasks with dependencies\n- Tasks requiring different expertise per step\n- When you want to show the plan to users first\n\n### Tool Registry Pattern\n\nDynamic tool management:\n\n```python\nclass ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)\n```\n\n## Tool Definition Best Practices\n\n### Good Tool Schema\n\n```json\n{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}\n```\n\n### Bad Tool Schema (Avoid)\n\n```json\n{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}\n```\n\n## Memory Architecture\n\n### Selective Memory Pattern\n\n```python\nclass AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)\n```\n\n## Multi-Agent Orchestration\n\n### Supervisor Pattern\n\n```python\nclass SupervisorAgent:\n    def __init__(self, supervisor_llm, worker_agents: dict):\n        self.supervisor = supervisor_llm\n        self.workers = worker_agents\n\n    def run(self, task: str) -> str:\n        # Supervisor decides which worker to use\n        while not self.is_complete(task):\n            decision = self.supervisor.decide(task, self.workers.keys())\n\n            worker = self.workers[decision.worker_name]\n            result = worker.run(decision.subtask)\n\n            task = self.supervisor.update_task(task, result)\n\n        return self.supervisor.synthesize(task)\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Problem | Solution |\n|--------------|---------|----------|\n| Unlimited loops | Agent runs forever | Set `max_iterations` |\n| Too many tools | Agent gets confused | Limit to 5-7 tools per task |\n| Vague tool descriptions | Wrong tool selection | Write detailed descriptions with examples |\n| Silent failures | Agent doesn't know tool failed | Surface errors explicitly |\n| Memory hoarding | Context overflow | Use selective memory with importance scoring |\n| Over-engineering | Single agent works fine | Justify multi-agent complexity |\n\n## Debugging Checklist\n\nWhen an agent misbehaves:\n\n1. **Check iteration count**: Is it hitting limits?\n2. **Review tool calls**: Are tools being called correctly?\n3. **Inspect memory**: Is relevant context available?\n4. **Trace reasoning**: What thoughts led to bad actions?\n5. **Test tools independently**: Do tools work in isolation?\n\nFile v2.0.0:_meta.json\n\n{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"2.0.0\",\n  \"publishedAt\": 1777673039408\n}\n\nArchive v1.0.2: 2 files, 3875 bytes\n\nFiles: _meta.json (143b), SKILL.md (9192b)\n\nFile v1.0.2:SKILL.md\n\n---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)\n```\n\n**Key Safety Features:**\n- `max_iterations` prevents infinite loops\n- Error handling surfaces tool failures to the agent\n- Partial results returned if limit reached\n\n### Plan-and-Execute\n\nFor complex tasks requiring upfront planning:\n\n```python\nclass PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)\n```\n\n**When to Use:**\n- Multi-step tasks with dependencies\n- Tasks requiring different expertise per step\n- When you want to show the plan to users first\n\n### Tool Registry Pattern\n\nDynamic tool management:\n\n```python\nclass ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)\n```\n\n## Tool Definition Best Practices\n\n### Good Tool Schema\n\n```json\n{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}\n```\n\n### Bad Tool Schema (Avoid)\n\n```json\n{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}\n```\n\n## Memory Architecture\n\n### Selective Memory Pattern\n\n```python\nclass AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)\n```\n\n## Multi-Agent Orchestration\n\n### Supervisor Pattern\n\n```python\nclass SupervisorAgent:\n    def __init__(self, supervisor_llm, worker_agents: dict):\n        self.supervisor = supervisor_llm\n        self.workers = worker_agents\n\n    def run(self, task: str) -> str:\n        # Supervisor decides which worker to use\n        while not self.is_complete(task):\n            decision = self.supervisor.decide(task, self.workers.keys())\n\n            worker = self.workers[decision.worker_name]\n            result = worker.run(decision.subtask)\n\n            task = self.supervisor.update_task(task, result)\n\n        return self.supervisor.synthesize(task)\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Problem | Solution |\n|--------------|---------|----------|\n| Unlimited loops | Agent runs forever | Set `max_iterations` |\n| Too many tools | Agent gets confused | Limit to 5-7 tools per task |\n| Vague tool descriptions | Wrong tool selection | Write detailed descriptions with examples |\n| Silent failures | Agent doesn't know tool failed | Surface errors explicitly |\n| Memory hoarding | Context overflow | Use selective memory with importance scoring |\n| Over-engineering | Single agent works fine | Justify multi-agent complexity |\n\n## Debugging Checklist\n\nWhen an agent misbehaves:\n\n1. **Check iteration count**: Is it hitting limits?\n2. **Review tool calls**: Are tools being called correctly?\n3. **Inspect memory**: Is relevant context available?\n4. **Trace reasoning**: What thoughts led to bad actions?\n5. **Test tools independently**: Do tools work in isolation?\n\nFile v1.0.2:_meta.json\n\n{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"1.0.2\",\n  \"publishedAt\": 1777640237502\n}\n\nArchive v1.0.1: 2 files, 3875 bytes\n\nFiles: _meta.json (143b), SKILL.md (9192b)\n\nFile v1.0.1:SKILL.md\n\n---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)\n```\n\n**Key Safety Features:**\n- `max_iterations` prevents infinite loops\n- Error handling surfaces tool failures to the agent\n- Partial results returned if limit reached\n\n### Plan-and-Execute\n\nFor complex tasks requiring upfront planning:\n\n```python\nclass PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)\n```\n\n**When to Use:**\n- Multi-step tasks with dependencies\n- Tasks requiring different expertise per step\n- When you want to show the plan to users first\n\n### Tool Registry Pattern\n\nDynamic tool management:\n\n```python\nclass ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)\n```\n\n## Tool Definition Best Practices\n\n### Good Tool Schema\n\n```json\n{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}\n```\n\n### Bad Tool Schema (Avoid)\n\n```json\n{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}\n```\n\n## Memory Architecture\n\n### Selective Memory Pattern\n\n```python\nclass AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)\n```\n\n## Multi-Agent Orchestration\n\n### Supervisor Pattern\n\n```python\nclass SupervisorAgent:\n    def __init__(self, supervisor_llm, worker_agents: dict):\n        self.supervisor = supervisor_llm\n        self.workers = worker_agents\n\n    def run(self, task: str) -> str:\n        # Supervisor decides which worker to use\n        while not self.is_complete(task):\n            decision = self.supervisor.decide(task, self.workers.keys())\n\n            worker = self.workers[decision.worker_name]\n            result = worker.run(decision.subtask)\n\n            task = self.supervisor.update_task(task, result)\n\n        return self.supervisor.synthesize(task)\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Problem | Solution |\n|--------------|---------|----------|\n| Unlimited loops | Agent runs forever | Set `max_iterations` |\n| Too many tools | Agent gets confused | Limit to 5-7 tools per task |\n| Vague tool descriptions | Wrong tool selection | Write detailed descriptions with examples |\n| Silent failures | Agent doesn't know tool failed | Surface errors explicitly |\n| Memory hoarding | Context overflow | Use selective memory with importance scoring |\n| Over-engineering | Single agent works fine | Justify multi-agent complexity |\n\n## Debugging Checklist\n\nWhen an agent misbehaves:\n\n1. **Check iteration count**: Is it hitting limits?\n2. **Review tool calls**: Are tools being called correctly?\n3. **Inspect memory**: Is relevant context available?\n4. **Trace reasoning**: What thoughts led to bad actions?\n5. **Test tools independently**: Do tools work in isolation?\n\nFile v1.0.1:_meta.json\n\n{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"1.0.1\",\n  \"publishedAt\": 1777629365527\n}","readmeExcerpt":"Skill: Ai Agents Architect Owner: ericn26-star Summary: Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent... Tags: latest:6.0.0 Version history: v1.0.6 | 2026-05-05T03:58:37.393Z | auto No user-facing or functional changes in this version. - Version bump with no file or documentation changes detected. - All feat","codeSnippets":[],"executableExamples":[{"language":"python","snippet":"class ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            action = self.llm.select_action(thought, self.tools)\n            history.append({\"type\": \"action\", \"content\": action})\n\n            # Observe: process result\n            try:\n                observation = self.tools.execute(action)\n            except Exception as e:\n                observation = f\"Error: {str(e)}\"\n            history.append({\"type\": \"observation\", \"content\": observation})\n\n        return \"Max iterations reached. Partial result: \" + self.summarize(history)"},{"language":"python","snippet":"class PlanExecuteAgent:\n    def __init__(self, planner_llm, executor_llm, tools):\n        self.planner = planner_llm\n        self.executor = executor_llm\n        self.tools = tools\n\n    def run(self, task: str) -> str:\n        # Phase 1: Create plan\n        plan = self.planner.create_plan(task)\n        results = []\n\n        # Phase 2: Execute steps\n        for step in plan.steps:\n            result = self.executor.execute_step(step, self.tools, results)\n            results.append(result)\n\n            # Phase 3: Replan if needed\n            if result.requires_replanning:\n                plan = self.planner.replan(task, plan, results)\n\n        return self.synthesize(results)"},{"language":"python","snippet":"class ToolRegistry:\n    def __init__(self):\n        self.tools = {}\n        self.usage_stats = {}\n\n    def register(self, name: str, func: callable, schema: dict, examples: list):\n        \"\"\"Register a tool with full documentation.\"\"\"\n        self.tools[name] = {\n            \"function\": func,\n            \"schema\": schema,\n            \"examples\": examples,\n            \"description\": schema.get(\"description\", \"\")\n        }\n\n    def get_tools_for_task(self, task: str, max_tools: int = 5) -> list:\n        \"\"\"Select relevant tools for a specific task.\"\"\"\n        # Avoid tool overload - return only relevant tools\n        relevant = self.rank_tools_by_relevance(task)\n        return relevant[:max_tools]\n\n    def execute(self, tool_name: str, **kwargs):\n        \"\"\"Execute tool with tracking.\"\"\"\n        self.usage_stats[tool_name] = self.usage_stats.get(tool_name, 0) + 1\n        return self.tools[tool_name][\"function\"](**kwargs)"},{"language":"json","snippet":"{\n  \"name\": \"search_documents\",\n  \"description\": \"Search through indexed documents using semantic similarity. Returns top-k most relevant documents with their content and metadata. Use this when you need to find information from the knowledge base.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"query\": {\n        \"type\": \"string\",\n        \"description\": \"Natural language search query describing what you're looking for\"\n      },\n      \"top_k\": {\n        \"type\": \"integer\",\n        \"description\": \"Number of results to return (default: 5, max: 20)\",\n        \"default\": 5\n      },\n      \"filters\": {\n        \"type\": \"object\",\n        \"description\": \"Optional filters like date_range, document_type, etc.\"\n      }\n    },\n    \"required\": [\"query\"]\n  },\n  \"examples\": [\n    {\n      \"query\": \"quarterly revenue reports 2024\",\n      \"top_k\": 3\n    }\n  ]\n}"},{"language":"json","snippet":"{\n  \"name\": \"search\",\n  \"description\": \"Searches stuff\",\n  \"parameters\": {\n    \"q\": {\"type\": \"string\"}\n  }\n}"},{"language":"python","snippet":"class AgentMemory:\n    def __init__(self, max_short_term=10, importance_threshold=0.7):\n        self.short_term = []  # Recent interactions\n        self.long_term = VectorStore()  # Persistent knowledge\n        self.max_short_term = max_short_term\n        self.importance_threshold = importance_threshold\n\n    def add(self, item: dict):\n        \"\"\"Add item to memory with importance scoring.\"\"\"\n        importance = self.score_importance(item)\n\n        # Always add to short-term\n        self.short_term.append(item)\n        if len(self.short_term) > self.max_short_term:\n            self.short_term.pop(0)\n\n        # Only persist important items\n        if importance >= self.importance_threshold:\n            self.long_term.add(item)\n\n    def retrieve(self, query: str, k: int = 5) -> list:\n        \"\"\"Retrieve relevant memories.\"\"\"\n        return self.short_term + self.long_term.search(query, k)"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: eric-ai-agents-architect\ndescription: \"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent orchestration. Use when: building AI agents, designing autonomous systems, implementing tool use, function calling patterns, or agent workflows.\"\n---\n\n# AI Agents Architect\n\nYou are an expert AI Agent Systems Architect. You help users design, build, and optimize autonomous AI agent systems that are powerful yet controllable.\n\n## Core Philosophy\n\n- **Graceful Degradation**: Design agents that fail safely and recover intelligently\n- **Balanced Autonomy**: Know when an agent should act independently vs ask for help\n- **Practical Implementation**: Provide working code, not just theory\n- **Observable Systems**: Every agent should be traceable and debuggable\n\n## Working Approach\n\n1. **Understand the Use Case**: Ask clarifying questions about the user's goals\n2. **Recommend Architecture**: Suggest appropriate patterns with trade-offs\n3. **Implement Iteratively**: Build working prototypes, test, and refine\n4. **Add Safety Rails**: Include iteration limits, error handling, and logging\n\n## Capabilities\n\n### Architecture Design\n- Design agent architectures tailored to specific use cases\n- Select appropriate patterns (ReAct, Plan-and-Execute, etc.)\n- Define clear agent boundaries and responsibilities\n\n### Tool Integration\n- Design tool schemas with clear descriptions and examples\n- Implement function calling patterns\n- Create tool registries for dynamic tool management\n\n### Memory Systems\n- Design short-term and long-term memory strategies\n- Implement selective memory to avoid context bloat\n- Create retrieval mechanisms for relevant context\n\n### Multi-Agent Systems\n- Orchestrate multiple agents for complex workflows\n- Design agent communication protocols\n- Implement supervisor patterns for agent coordination\n\n## Implementation Guidelines\n\nWhen building agents, always include:\n- Maximum iteration limits to prevent infinite loops\n- Clear error handling with actionable messages\n- Logging and tracing for debugging\n- Graceful fallbacks when tools fail\n\n---\n\n# AI Agent Design Patterns\n\nThis section provides detailed implementation patterns for building robust AI agents.\n\n## Core Patterns\n\n### ReAct Loop (Reason-Act-Observe)\n\nThe fundamental agent execution cycle:\n\n```python\nclass ReActAgent:\n    def __init__(self, llm, tools, max_iterations=10):\n        self.llm = llm\n        self.tools = tools\n        self.max_iterations = max_iterations\n\n    def run(self, task: str) -> str:\n        history = []\n\n        for i in range(self.max_iterations):\n            # Reason: decide what to do\n            thought = self.llm.think(task, history)\n            history.append({\"type\": \"thought\", \"content\": thought})\n\n            # Check if done\n            if thought.is_final_answer:\n                return thought.answer\n\n            # Act: select and invoke tool\n            acti"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn712egma3976f4b68hksznyrs85wsr5\",\n  \"slug\": \"eric-ai-agents-architect\",\n  \"version\": \"1.0.6\",\n  \"publishedAt\": 1777953517393\n}"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent... Skill: Ai Agents Architect Owner: ericn26-star Summary: Expert in designing and building autonomous AI agents. Helps with agent architecture, tool integration, memory systems, planning strategies, and multi-agent... Tags: latest:6.0.0 Version history: v1.0.6 | 2026-05-05T03:58:37.393Z | auto No user-facing or functional changes in this version. - Version bump with no file or documentation changes detected. - All feat","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1000,"uniquenessScore":48,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-11T17:31:05.577Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-11T17:31:05.577Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-11T20:58:06.854Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}