All skills
Skillintermediate

šŸ” Autonomous Agent

<div align="center">

Claude Code Knowledge Pack7/10/2026

Overview

<div align="center">

šŸ  Home › Autonomous › šŸ” Autonomous Agent

← Autonomous ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā—ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā” Multi-Window Context →

</div>

šŸ” Autonomous Agent

TL;DR: Long-running agents that independently plan, execute, and adapt based on environment feedback. Maximum autonomy, but requires guardrails.


Diagram

%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#64748b'}}}%%
flowchart TB
    classDef user fill:#6366f1,stroke:#4f46e5,stroke-width:2px,color:#ffffff
    classDef data fill:#06b6d4,stroke:#0891b2,stroke-width:2px,color:#ffffff
    classDef main fill:#8b5cf6,stroke:#7c3aed,stroke-width:2px,color:#ffffff
    classDef state fill:#10b981,stroke:#059669,stroke-width:2px,color:#ffffff
    classDef wizard fill:#14b8a6,stroke:#0d9488,stroke-width:2px,color:#ffffff

    GOAL["šŸ™‹ā€ā™€ļøšŸ“„ Goal"]:::user --> PLAN["šŸ”šŸ“‹ Plan"]:::main
    PLAN --> ACT["šŸ”āš” Act"]:::state
    ACT --> ENV["šŸŒ Environment"]:::data
    ENV --> OBSERVE["šŸ”šŸ‘€ Observe"]:::data
    OBSERVE --> REFLECT{"šŸ”šŸ’­ Reflect"}:::wizard

    REFLECT -->|"šŸ”šŸ”„ Adjust"| PLAN
    REFLECT -->|"šŸ”ā–¶ļø Continue"| ACT
    REFLECT -->|"šŸ”āœ… Done"| DONE["šŸ’ā€ā™€ļøšŸ“¤ Result"]:::user

The Agent Loop

%%{init: {'theme': 'base', 'themeVariables': {'lineColor': '#64748b'}}}%%
stateDiagram-v2
    [*] --> Planning: šŸ™‹ā€ā™€ļøšŸ“„ Receive goal
    Planning --> Executing: šŸ”šŸ“‹ Create plan
    Executing --> Observing: šŸ”āš” Take action
    Observing --> Reflecting: šŸ”šŸ‘€ Get feedback
    Reflecting --> Planning: šŸ”šŸ”„ Adjust
    Reflecting --> Executing: šŸ”ā–¶ļø Continue
    Reflecting --> [*]: šŸ’ā€ā™€ļøšŸ“¤ Goal achieved

Key Insight

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  šŸ” AUTONOMOUS AGENT: What Makes It Different                               │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│                                                                             │
│  Agents are emerging in production as LLMs mature in key capabilities:      │
│                                                                             │
│  āœ… Understanding complex inputs                                            │
│  āœ… Engaging in reasoning and planning                                      │
│  āœ… Using tools reliably                                                    │
│  āœ… Recovering from errors                                                  │
│                                                                             │
│  During execution, it's CRUCIAL for agents to gain "ground truth"           │
│  from the environment at each step (tool results, code execution)           │
│  to assess their progress.                                                  │
│                                                                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Characteristics

CharacteristicDescription
Goal-directedWorks toward specified objective
AdaptiveAdjusts based on environment feedback
Self-directedDecides next actions independently
PersistentContinues until goal achieved or stopping condition

When to Use Agents

Agents can be used for open-ended problems where:

  • It's difficult or impossible to predict the required number of steps
  • You can't hardcode a fixed path
  • The LLM will potentially operate for many turns
  • You have some level of trust in its decision-making
DomainExampleWhy Agent?
CodingSWE-bench tasks, multi-file editsCan't predict which files need changes
Computer UseClaude uses a computer to accomplish tasksOpen-ended interaction
ResearchComplex investigations with unknown scopeAdaptive information gathering
Bug InvestigationTracing issues through codebaseUnknown path to root cause

Example: Bug Investigation

Goal: "Fix the login timeout bug"

Agent:
1. PLAN: Need to find where timeout is set
2. ACT: Search codebase for "timeout" in auth
3. OBSERVE: Found 3 locations
4. REFLECT: Most likely in session config
5. ACT: Read session config file
6. OBSERVE: Default timeout is 30 minutes
7. REFLECT: User reported issue after 5 minutes
8. ACT: Check if there's an override
9. ...continues until resolved...

When NOT to Use Agents

  • Predictable tasks with known steps (use Workflows)
  • No rollback capability
  • Tight time constraints
  • Untrusted environments

Risk Management

Warning: The autonomous nature of agents means higher costs, and the potential for compounding errors. We recommend extensive testing in sandboxed environments, along with appropriate guardrails.


Essential Guardrails

GuardrailPurposeImplementation
ā±ļø Iteration LimitPrevent infinite loopsMax turns, timeout
šŸ™†ā€ā™€ļø Human CheckpointsMaintain oversightAskUserQuestion at key decisions
šŸ”’ Action ScopeLimit blast radiusTool restrictions, sandboxing
ā†©ļø RollbackEnable recoveryGit commits, state snapshots
šŸ“Š LoggingAudit trailRecord all agent actions

Stopping Conditions

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  WHEN TO STOP                                                               │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│                                                                             │
│  āœ… Goal achieved                                                           │
│  ā±ļø Maximum iterations reached                                              │
│  🚫 Unrecoverable error                                                     │
│  šŸ™†ā€ā™€ļø Human intervention requested                                           │
│  šŸ’° Cost threshold exceeded                                                 │
│                                                                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Best Practices

Agent-Computer Interface (ACI)

Think about how much effort goes into human-computer interfaces (HCI), and plan to invest just as much effort in creating good agent-computer interfaces (ACI).

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  ACI DESIGN PRINCIPLES                                                      │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│                                                                             │
│  1. Put yourself in the model's shoes                                       │
│     Is it obvious how to use this tool based on description?                │
│                                                                             │
│  2. Include in tool definitions:                                            │
│     - Example usage                                                         │
│     - Edge cases                                                            │
│     - Input format requirements                                             │
│     - Clear boundaries from other tools                                     │
│                                                                             │
│  3. Test how the model uses your tools                                      │
│     Run many example inputs, see mistakes, iterate                          │
│                                                                             │
│  4. Poka-yoke your tools                                                    │
│     Change arguments so it's harder to make mistakes                        │
│                                                                             │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Three Core Principles

PrincipleDescription
1. SimplicityMaintain simplicity in your agent's design
2. TransparencyExplicitly show the agent's planning steps
3. ACI DesignCarefully craft agent-computer interface through thorough tool documentation and testing

<div align="center">

← Autonomous ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā—ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā”ā” Multi-Window Context →

</div>