AI Ops

AI Agents: The Complete Guide — What They Are, How to Build Them, Where to Use Them

What is an AI agent?

An AI agent is a program in which an LLM drives an execution loop: it receives a task, breaks it into steps, calls tools (APIs, databases, the file system), analyzes the results, and decides what to do next. A chatbot generates text. An agent acts: it looks up information, edits files, sends requests, and coordinates other agents.

TL;DR

  • -AI agent = LLM + tools + action loop. A chatbot answers questions; an agent executes tasks: pulls data, calls APIs, makes decisions, coordinates processes
  • -Three core components: reasoning (task decomposition), tool use (calling external functions), memory (context and long-term state across sessions)
  • -Major frameworks: Claude Agent SDK, LangGraph 1.x, OpenAI Agents SDK, CrewAI, Pydantic AI 2.0, Google ADK 2.x, Microsoft Agent Framework 1.0. MCP is the tool-integration standard, now governed by the Agentic AI Foundation
  • -Practical use cases: coding agents (Claude Code, Cursor), DevOps automation, data analysis, customer support, research agents, sales automation
  • -Main challenges: cost (dozens of LLM calls per task), hallucinations, security (an agent with tool access is an attack surface), and the difficulty of evaluating quality
  • -2026: A2A Protocol (v1.0, 150+ organizations), MCP as an industry standard, computer use, agentic coding becoming mainstream development practice

An AI agent is a program in which an LLM drives the execution loop. It receives a task, decomposes it into steps, calls tools, analyzes the results, and decides what to do next. It generates text — and immediately acts on it.

This article is a full overview: from the underlying architecture to working code. What’s under the hood, which frameworks to pick, where to apply them, and what problems you’ll need to solve.

What AI Agents Are

Agent vs. Chatbot

A chatbot is an LLM with an interface. The user asks a question, the model generates an answer. One input, one output. No actions beyond text.

An agent is an LLM with tools and a decision-making loop. The difference is fundamental:

TraitChatbotAI agent
Interaction modelQuestion → answerTask → chain of actions → result
ToolsNone (or minimal)APIs, file system, DB, browser
AutonomyZero — waits for inputWorks independently toward a result
LoopSingle-shotIterative: think → act → observe
MemoryCurrent conversation onlyShort-term + long-term across sessions

Example: ask ChatGPT to “find the bug in this code” and you get a text breakdown. Ask Claude Code, and it reads the project files, finds the problem, fixes the code, runs the tests, and makes a commit. That’s an agent.

Three Components of an Agent

Every AI agent rests on three foundations:

1. Reasoning — the LLM’s ability to decompose a task into steps, plan a sequence of actions, and evaluate intermediate results. This is the agent’s “brain.” A weak model gets stuck at the decomposition stage. A strong one breaks the task into atomic steps and picks the optimal path.

2. Tool use — the functions the agent calls to interact with the outside world. Reading files, making HTTP requests, querying a database, running shell commands. Without tools, an LLM is just a text generator.

3. Memory — context storage. Short-term memory covers the current conversation and intermediate results. Long-term memory carries knowledge across sessions: what the agent learned before, what decisions it made, what mistakes it hit.

Agents in Production

Claude Code — an agent for software development. It runs in the terminal and sees the entire project: files, dependencies, configuration. Give it a task like “add OAuth authentication” and it autonomously finds the right files, writes the code, runs tests, fixes errors, and commits.

Devin (Cognition) — an autonomous software engineer. Works in an isolated environment with an IDE, terminal, and browser. Can spend hours on a task with no human involvement: exploring the codebase, writing code, deploying.

Cursor Agent Mode — the agentic mode inside the IDE. Analyzes the codebase, plans changes, edits multiple files in parallel, runs commands.

OpenAI Operator — a computer-use agent. Controls a browser: fills out forms, navigates sites, completes tasks in web interfaces.

Types of AI Agents

ReAct (Reasoning + Acting)

The basic pattern. The agent cycles through three phases:

  1. Thought — reasoning about the current state and the next step
  2. Action — calling a tool
  3. Observation — analyzing the result
Thought: I need to find the database configuration file
Action: search_files("database config")
Observation: Found config/database.yml

Thought: I'll read the config to understand the current settings
Action: read_file("config/database.yml")
Observation: PostgreSQL, host: localhost, port: 5432

Thought: I need to change the host to the production address
Action: edit_file("config/database.yml", ...)
Observation: File updated successfully

ReAct mirrors a developer’s inner monologue: think it through, do it, check it, think through the next step.

Tool-Use Agents

These specialize in calling external APIs and functions. The LLM decides which tool to call and with what parameters. The focus is on routing requests correctly, not on long reasoning chains.

Typical scenario: an agent receives “book a flight from Moscow to Bali on April 15” and breaks it into a chain of calls: flight search API → filtering → payment API → sending confirmation.

Multi-Agent Systems

Several agents with distinct roles working on a shared task, coordinated through a multi-agent architecture. Each agent specializes in its own domain:

  • Architect agent — designs the solution
  • Coder agent — writes the code
  • Reviewer agent — reviews the code
  • Tester agent — runs and analyzes tests

Agents communicate, hand off artifacts, and coordinate work. This scales well to complex tasks that a single agent can’t handle alone, using supervisor/worker designs and other coordination strategies.

Autonomous Agents

These operate without human involvement over extended periods. They receive a high-level goal and independently plan, execute, and course-correct.

Examples: infrastructure monitoring (detect an anomaly → diagnose → fix → report), continuous data collection with adaptive search strategies.

The hardest class of agents to build. Without solid guardrails, behavior spins out of control.

Coding Agents

A specialized class of agents for software development. They understand code at the AST level and work with the file system, git, package managers, and CI/CD.

AgentTypeNotes
Claude CodeCLI agentFull access to files, shell, MCP. Agentic loop with verification
CursorIDE agentBuilt into a VS Code fork. Agent mode + tab-completion
DevinAutonomousIsolated environment. Hours of unattended work
Codex (OpenAI)Cloud agentSandboxed execution. Optimized for PRs and tracker tasks
WindsurfIDE agentCascade flows. Context-aware actions

Agent Architecture

The General Picture

┌─────────────────────────────────────────────────┐
│                   USER INPUT                     │
│           "Analyze the logs from this week"      │
└──────────────────────┬──────────────────────────┘

┌─────────────────────────────────────────────────┐
│               SYSTEM PROMPT                      │
│  Role, constraints, output format, instructions │
└──────────────────────┬──────────────────────────┘

┌─────────────────────────────────────────────────┐
│                 LLM ("brain")                    │
│  Claude Opus 4.8 / Sonnet 4.6 / GPT-5.5 / Gemini 3.1 Pro  │
│                                                  │
│  ┌───────────┐  ┌──────────┐  ┌──────────────┐ │
│  │ Reasoning │  │ Planning │  │ Tool Select  │ │
│  └───────────┘  └──────────┘  └──────────────┘ │
└──────────────────────┬──────────────────────────┘

          ┌────────────────────────┐
          │    OBSERVATION LOOP    │
          │                        │
          │  Think → Act → Observe │
          │       ↺ repeat         │
          └───────────┬────────────┘

┌─────────────────────────────────────────────────┐
│                   TOOLS                          │
│                                                  │
│  ┌──────────┐ ┌──────────┐ ┌──────────────────┐│
│  │File I/O  │ │ HTTP/API │ │  Database query  ││
│  └──────────┘ └──────────┘ └──────────────────┘│
│  ┌──────────┐ ┌──────────┐ ┌──────────────────┐│
│  │  Shell   │ │ Browser  │ │  MCP servers     ││
│  └──────────┘ └──────────┘ └──────────────────┘│
└─────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────┐
│                  MEMORY                          │
│                                                  │
│  Short-term: context window (current session)   │
│  Long-term: files, DB, vector store              │
└─────────────────────────────────────────────────┘

The LLM as the “Brain”

Model choice sets the agent’s ceiling. Complex tasks — architectural decisions, multi-step debugging, refactoring — need strong models: Claude Opus 4.8, GPT-5.5, Gemini 3.1 Pro. Simpler tasks — search, formatting, routine work — are handled by models like Claude Sonnet 4.6 or GPT-5.5 Instant.

A practical approach is a model hierarchy:

  • Orchestrator (Opus 4.8 / GPT-5.5) — planning, decomposition, final assembly
  • Worker (Sonnet 4.6 / GPT-5.5 Instant) — subtask execution, search, data transforms

Cost drops 3-5x without sacrificing quality at the top layer.

System Prompt

Defines the agent’s behavior: role, constraints, output format, available tools. The system prompt is the agent’s “job description.”

SYSTEM_PROMPT = """
You are a DevOps agent. Your job is monitoring and
maintaining infrastructure.

Rules:
- Never delete production data without confirmation
- Log every action
- On error: three attempts, then escalate

Available tools:
- check_service_status(service_name)
- restart_service(service_name)
- read_logs(service_name, lines=100)
- send_alert(channel, message)
"""

Vague instructions produce unpredictable behavior. Concrete constraints produce controlled results.

Tools — the Agent’s Instruments

Tools are functions the agent calls. Each is described with a JSON schema: name, description, parameters, return type.

tools = [
    {
        "name": "search_database",
        "description": "Search records in PostgreSQL via a SQL query",
        "parameters": {
            "type": "object",
            "properties": {
                "query": {
                    "type": "string",
                    "description": "SQL SELECT query"
                }
            },
            "required": ["query"]
        }
    },
    {
        "name": "send_email",
        "description": "Send an email via SMTP",
        "parameters": {
            "type": "object",
            "properties": {
                "to": {"type": "string"},
                "subject": {"type": "string"},
                "body": {"type": "string"}
            },
            "required": ["to", "subject", "body"]
        }
    }
]

The LLM reads the tool descriptions and decides which one to call. Precise descriptions matter here: a vague description and the model calls the wrong tool or passes incorrect parameters.

Memory — Short-Term and Long-Term

Short-term memory is the context window of the current session. Intermediate results, tool calls, the agent’s reasoning. Bounded by the model’s context size (100K–1M tokens). Once the limit is hit, you summarize or truncate earlier messages.

Long-term memory is data that persists across sessions. Implementations:

  • File system (CLAUDE.md, memory files)
  • Vector store (embeddings in Pinecone, Qdrant, pgvector)
  • Structured storage (SQLite, PostgreSQL)

Example: Claude Code stores memory files under ~/.claude/projects/. In the next session, the agent “remembers” project decisions, mistakes, and context.

The Observation Loop

The core of an agent is the “think → act → observe → repeat” cycle:

while not task_completed:
    # 1. Think — the LLM analyzes the current state
    thought = llm.think(context, task, observations)

    # 2. Act — the LLM picks and calls a tool
    action = llm.select_tool(thought, available_tools)
    result = execute_tool(action)

    # 3. Observe — the LLM analyzes the result
    observations.append(result)

    # 4. Decide — continue or finish
    task_completed = llm.evaluate(observations, task)

The loop keeps going until the agent decides the task is done or it hits an iteration limit. That limit is critical — without it, the agent loops forever.

Frameworks for Building Agents

Claude Agent SDK (Anthropic)

Anthropic’s official SDK. The same agentic loop, tools, and context management that power Claude Code itself.

Installation:

# Python
pip install claude-agent-sdk

# TypeScript
npm install @anthropic-ai/claude-agent-sdk

Key capabilities:

  • Built-in tools: Read, Write, Edit, Bash, Glob, Grep, WebSearch
  • MCP servers as custom tools
  • Output streaming via an async iterator
  • Permission management (permission_mode)
  • Custom system prompts and hooks

Example:

import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, TextBlock

async def main():
    async for message in query(
        prompt="Find every TODO in the project and create GitHub issues for them",
        options=ClaudeAgentOptions(
            system_prompt="You are a project manager agent",
            allowed_tools=["Read", "Glob", "Grep", "Bash"],
            model="claude-sonnet-4-6"
        ),
    ):
        if isinstance(message, AssistantMessage):
            for block in message.content:
                if isinstance(block, TextBlock):
                    print(block.text)

asyncio.run(main())

When to choose it: a reliable agent with file system and shell access. The best pick for coding agents and DevOps automation.

LangGraph (LangChain)

A framework for building agents as directed, stateful graphs. Each node is a processing step; edges are conditional transitions.

Core idea: an agent is a graph where state is explicitly modeled and passed between nodes. Full control over execution flow, checkpoints, human-in-the-loop.

from langgraph.graph import StateGraph, MessagesState
from langgraph.prebuilt import ToolNode
from langchain_anthropic import ChatAnthropic
from langchain_core.tools import tool

@tool
def search_web(query: str) -> str:
    """Search the web for information."""
    return f"Search results for: {query}"

tools = [search_web]
tool_node = ToolNode(tools)

model = ChatAnthropic(model="claude-sonnet-4-6").bind_tools(tools)

def analyst(state: MessagesState):
    response = model.invoke(state["messages"])
    return {"messages": [response]}

def should_continue(state: MessagesState):
    last = state["messages"][-1]
    if last.tool_calls:
        return "tools"
    return "end"

graph = StateGraph(MessagesState)
graph.add_node("analyst", analyst)
graph.add_node("tools", tool_node)
graph.add_edge("__start__", "analyst")
graph.add_conditional_edges("analyst", should_continue)
graph.add_edge("tools", "analyst")

app = graph.compile()

When to choose it: complex workflows with branching, checkpoints, human-in-the-loop. Production systems that need explicit control over state.

CrewAI

A framework for role-based multi-agent systems. Each agent is a specialist with a defined role, goal, and toolset.

from crewai import Agent, Task, Crew

researcher = Agent(
    role="Senior Research Analyst",
    goal="Find up-to-date data on the AI agent market",
    backstory="You're an analyst with 10 years in the AI industry",
    tools=[search_tool, scrape_tool],
    llm="claude-sonnet-4-6"
)

writer = Agent(
    role="Technical Writer",
    goal="Write an analytical report based on the research",
    backstory="You're a technical writer specializing in AI",
    llm="claude-sonnet-4-6"
)

research_task = Task(
    description="Research the AI agent market: key players, trends, market size",
    agent=researcher,
    expected_output="A structured report with figures"
)

writing_task = Task(
    description="Write an analytical report based on the research",
    agent=writer,
    expected_output="A finished report in markdown",
    context=[research_task]
)

crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, writing_task],
    verbose=True
)

result = crew.kickoff()

When to choose it: tasks that break down naturally into roles. Fast prototyping of multi-agent systems. The lowest barrier to entry — 20 lines for a working agent.

Microsoft Agent Framework (Microsoft)

Microsoft’s official production framework for agents, which reached version 1.0 in April 2026. It merges the concepts of AutoGen and Semantic Kernel into a single stack with .NET and Python support.

Key concepts: Agent Harness — bundles function calling, history persistence, planning, and search into a single call; CodeAct — instead of picking a tool, the model writes a short Python program, runs it in a sandbox, and gets the result back. Deep integration with Azure AI Foundry: hosted agents, managed session state, observability, autoscaling.

Note: AutoGen has moved into maintenance mode — for new projects on the Microsoft stack, use Agent Framework instead.

When to choose it: Azure-centric systems, enterprise .NET/Python, multi-agent workflows with managed deployment.

OpenAI Agents SDK

OpenAI’s official SDK for building agents. Key concepts: Agent — an LLM with instructions, a toolset, and a model; handoffs — transferring control between agents (an orchestrator-to-specialist pattern); guardrails — built-in input and output checks. Native support for the OpenAI Responses API and sandboxed code execution.

from agents import Agent, Runner

agent = Agent(
    name="Analyst",
    instructions="You are a data analyst. Answer clearly and in a structured way.",
    model="gpt-5.5",
)

result = Runner.run_sync(agent, "Analyze the top 5 AI agent trends in 2026")
print(result.final_output)

When to choose it: OpenAI-centric systems, fast starts with handoffs between specialized agents, projects that need built-in guardrails and sandboxed execution.

smolagents (Hugging Face)

A minimalist framework — around 1,000 lines of core code. Agents write and execute Python code instead of JSON action descriptions.

from smolagents import CodeAgent, tool, LiteLLMModel

model = LiteLLMModel(model_id="anthropic/claude-sonnet-4-6")

@tool
def get_weather(city: str) -> str:
    """Gets the current weather for a given city."""
    # Weather API call implementation
    return f"It's +22°C and sunny in {city}"

agent = CodeAgent(
    tools=[get_weather],
    model=model
)

result = agent.run("What's the weather in Moscow and Tokyo?")

Advantages: code agents are about 30% more efficient than JSON-based tool calling — fewer steps, fewer LLM calls. Tight integration with the Hugging Face Hub: tools can be imported straight from the community.

When to choose it: simple agents, experiments, learning. When you want minimal abstraction.

Pydantic AI

A Python-first production framework from the Pydantic team, which reached version 2.0 in June 2026. Its central idea is the capability primitive: one composable unit that bundles tools, hooks, instructions, and model settings for an agent. Full type safety (Pydantic schemas), structured output contracts, dependency injection, native Logfire/OpenTelemetry integration, and support for MCP and durable execution.

from pydantic_ai import Agent

agent = Agent(
    model="anthropic:claude-sonnet-4-6",
    system_prompt="You are a data analyst. Answer in a structured way.",
)

result = agent.run_sync("What's the trend in the conversion metric this past quarter?")
print(result.data)

When to choose it: typed Python backends, strict output contracts, projects where testability and type safety matter more than flexibility.

Google ADK (Agent Development Kit)

An open-source toolkit from Google, now at version 2.0 (GA since May 2026). Multi-language (Python, Java), a graph-oriented runtime with support for multi-agent, A2A, and MCP. Key capabilities: Workflow Runtime — a graph engine with routing, fan-out/fan-in, retry, human-in-the-loop; Task API — structured agent-to-agent delegation with output control.

When to choose it: Google Cloud/Vertex AI, production systems with A2A, multilingual multi-agent stacks.

MCP (Model Context Protocol)

MCP isn’t an agent framework — it’s a tool integration protocol. Anthropic’s standard for how an LLM application talks to external data and functions. See MCP servers explained for the full architecture and how to connect one.

97 million installs a month, with support from OpenAI, Google, Microsoft, AWS, and hundreds of other vendors. Since December 2025 the protocol has been governed by the Agentic AI Foundation (AAIF) — a neutral foundation under the Linux Foundation, co-founded by Anthropic, Block, and OpenAI. De facto, it’s the USB-C of AI tooling.

Architecture:

┌──────────────┐     ┌───────────────┐     ┌──────────────┐
│  LLM App     │────▶│  MCP Client   │────▶│  MCP Server  │
│  (agent)     │◀────│               │◀────│  (GitHub,    │
│              │     │               │     │   Slack, DB) │
└──────────────┘     └───────────────┘     └──────────────┘

An MCP server exposes tools, resources, and prompts. The agent connects to the servers it needs and gains access to their capabilities.

Example configuration:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      }
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "DATABASE_URL": "${DATABASE_URL}"
      }
    }
  }
}

One protocol, any tool: GitHub, Slack, Notion, PostgreSQL, Stripe, and dozens more.

Framework Comparison

FrameworkApproachComplexityProduction-readyBest use case
Claude Agent SDKAgent loop + toolsLowYesCoding agents, DevOps
LangGraph 1.xStateful graphsMediumYesComplex workflows, durable execution
OpenAI Agents SDKAgents + handoffs + sandboxLowYesOpenAI-centric agents, sandboxing
CrewAI 1.xRole-based teams + FlowsLowYesMulti-agent business automation
Pydantic AI 2.0Typed agent + capabilitiesMediumYesPython backends, strict contracts
Google ADK 2.xGraph workflows + A2AMediumYesGoogle Cloud, multilingual stacks
Microsoft Agent Framework 1.0Harness + CodeActMediumYesAzure, .NET/Python enterprise
smolagentsCode agentsLowModeratePrototypes, learning
MCPProtocol (tools)LowYesTool integration

Practical Use Cases

Coding Agents — Automating Development

Coding agents are the most mature class of AI agents. Claude Code, Cursor, Devin, Codex — all run in production.

Typical tasks:

  • Implementing features from a ticket description (Jira, Linear, GitHub Issue)
  • Finding and fixing bugs, then running tests
  • Refactoring while preserving backward compatibility
  • Generating tests for existing code
  • Code review with automatic fixes for flagged issues
  • Migrations: dependency upgrades, API changes

ROI: a developer with a coding agent completes tasks 2-5x faster. The biggest win is on routine work: boilerplate, tests, migrations, documentation.

Customer Support — Knowledge-Base-Backed Responses

An agent with access to a knowledge base, CRM, and interaction history. It searches by context rather than keywords — finding relevant articles and drafting a response.

Architecture:

Customer → Agent → [KB search, CRM lookup, order status] → Response
                  → Escalate to a human (if confidence < threshold)

Key metrics:

  • Resolution rate: 40-70% of inquiries resolved without human involvement
  • First response time: seconds instead of minutes
  • CSAT: comparable to a human agent with adequate knowledge-base coverage

Data Analysis — Analytics and Reporting

An agent connects to a database, writes SQL queries, analyzes the results, builds visualizations, and draws conclusions.

# Example task for an analytics agent:
# "Analyze the funnel conversion rate for March, compare it to February,
#  find bottlenecks, and propose hypotheses for A/B tests"

# The agent will:
# 1. Run SQL: SELECT step, count(*) FROM funnel WHERE month = '2026-03' GROUP BY step
# 2. Run the same SQL for February
# 3. Calculate the conversion rate at each step
# 4. Perform a comparative analysis
# 5. Generate hypotheses based on the data
# 6. Produce a report with charts

DevOps — Monitoring, Alerts, Auto-Remediation

An agent monitors infrastructure, responds to alerts, and performs diagnostics and automated recovery.

Scenario:

  1. Prometheus alert: high API latency
  2. The agent checks the service’s metrics
  3. Analyzes the logs — finds an OOM in one of the pods
  4. Checks the current resource limits
  5. Raises the memory limit and restarts the pod
  6. Verifies that latency returned to normal
  7. Sends a Slack report with root cause and actions taken

Research — Gathering and Synthesizing Information

An agent pulls data from multiple sources, filters it, structures it, and synthesizes it into a report.

Examples:

  • Competitive intelligence: monitoring competitor products, pricing changes, new features
  • Market research: gathering data from reports, news, social media
  • Academic research: searching arXiv, PubMed, analyzing and summarizing papers
  • Due diligence: vetting companies before investment

Sales — Lead Qualification and Outreach

An agent parses inbound leads, enriches the data from public sources, scores them against an ICP (Ideal Customer Profile), and writes personalized outreach messages.

Pipeline:

New lead → Enrichment (LinkedIn, CrunchBase, company website)
         → ICP scoring
         → Personalized email/message
         → Automatic follow-up after N days
         → Escalate to a rep once they reply

Building a Simple Agent

An Agent Built on the Claude Agent SDK

A working agent in 20 lines that analyzes a project and generates a report:

import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, TextBlock

async def analyze_project(path: str):
    results = []

    async for message in query(
        prompt=f"""Analyze the project at {path}:
        1. Identify the technology stack
        2. Find potential security issues
        3. Assess code quality
        4. Suggest improvements
        Produce a structured report.""",
        options=ClaudeAgentOptions(
            allowed_tools=["Read", "Glob", "Grep"],
            model="claude-sonnet-4-6",
        ),
    ):
        if isinstance(message, AssistantMessage):
            for block in message.content:
                if isinstance(block, TextBlock):
                    results.append(block.text)

    return "\n".join(results)

report = asyncio.run(analyze_project("/path/to/project"))
print(report)

The SDK handles everything: the agentic loop, tool calls, context, retries. The developer describes the task; the SDK executes it.

An Agent with MCP Tools

An agent connected to GitHub via MCP:

import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, TextBlock

MCP_CONFIG = {
    "github": {
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-github"],
        "env": {"GITHUB_TOKEN": "ghp_..."}
    }
}

async def triage_issues():
    async for message in query(
        prompt="""Review the open issues in owner/repo:
        1. Read each issue
        2. Determine priority (critical/high/medium/low)
        3. Add labels
        4. Assign to the right developer based on
           commit history""",
        options=ClaudeAgentOptions(
            allowed_tools=["Read", "Bash", "mcp__github__*"],
            mcp_servers=MCP_CONFIG,
            model="claude-sonnet-4-6"
        ),
    ):
        if isinstance(message, AssistantMessage):
            for block in message.content:
                if isinstance(block, TextBlock):
                    print(block.text)

asyncio.run(triage_issues())

The agent uses the GitHub MCP server to read issues, add labels, and assign developers. You can swap out the server without changing the agent’s code — the protocol stays the same.

A Multi-Agent System with CrewAI

A team of agents preparing a technical report:

from crewai import Agent, Task, Crew
from crewai_tools import SerperDevTool

search = SerperDevTool()

analyst = Agent(
    role="Data Analyst",
    goal="Gather and analyze data",
    tools=[search],
    llm="claude-sonnet-4-6",
    verbose=True
)

writer = Agent(
    role="Report Writer",
    goal="Write a clear technical report",
    llm="claude-sonnet-4-6",
    verbose=True
)

analysis = Task(
    description="Research the current state of the AI agent market: "
                "size, growth, key players, trends",
    agent=analyst,
    expected_output="Structured data with sources"
)

report = Task(
    description="Create a report based on the analysis: "
                "executive summary, key findings, recommendations",
    agent=writer,
    expected_output="A finished report in markdown",
    context=[analysis]
)

crew = Crew(agents=[analyst, writer], tasks=[analysis, report])
result = crew.kickoff()
print(result)

Challenges and Limitations

Hallucinations

An agent can “invent” facts, nonexistent APIs, incorrect commands. In a chatbot, a hallucination shows up as wrong text. In an agent, it shows up as a call to a function that doesn’t exist, an incorrect command, or false data written to a database.

Mitigation:

  • Restrict the toolset (whitelist, not blacklist)
  • Validate output data before execution
  • Human-in-the-loop for critical operations
  • Grounding: hook up RAG for fact-checking

Cost

The agentic loop means dozens of LLM calls per task. Each think → act → observe iteration burns input and output tokens. A complex task can run 20–50 iterations.

Rough costs (Claude Sonnet 4.6, $3/$15 per 1M tokens):

TaskIterationsTokensCost
Simple file search3-5~10K~$0.05
Bug fix10-15~50K~$0.23
Feature implementation20-40~200K~$1-3
Module refactor30-60~500K~$3-8

Optimization:

  • Model hierarchy: Opus 4.8 / GPT-5.5 for the orchestrator, Sonnet 4.6 / GPT-5.5 Instant for workers
  • Caching intermediate results
  • Prompt caching (natively supported by the Anthropic API)
  • Stopping early once the goal is met

Reliability

An agent doesn’t always produce a stable result. The same task, run twice, might be solved in 5 steps or 50 — or not solved at all.

Causes:

  • Model temperature → different solution paths
  • Sensitivity to the order of observations
  • Reasoning degradation on long contexts

Mitigation:

  • Clear system prompts with tight constraints
  • Iteration limits
  • Retry with exponential backoff
  • Fall back to a human after N failures

Security

An agent with tool access is an attack surface. Prompt injection can trick an agent into running an arbitrary command. An agent with shell access carries real risk.

Defense principles:

  • Least privilege — minimal permissions for each task
  • Sandboxing — isolated execution environment (containers, VMs)
  • Confirmation — critical actions require explicit approval
  • Audit logging — log every action
  • Input validation — validate user input before passing it to the agent
# Example: restricting tools
options = ClaudeAgentOptions(
    allowed_tools=["Read", "Glob", "Grep"],  # read-only
    # NOT included: "Bash", "Write", "Edit" — the agent can't modify anything
    permission_mode="default"  # every action requires confirmation
)

Evaluating Quality

How do you measure whether an agent is doing a good job? There’s no standard metric, which is why AI agent testing and evaluation is its own discipline. Every task is unique, and results are subjective.

Approaches:

  • Task completion rate — the share of tasks solved without human intervention
  • Steps to completion — number of steps to a solution (fewer is better)
  • Cost per task — the cost of solving the task
  • Regression testing — a fixed set of tasks run after every change
  • Human eval — expert assessment of result quality

The Future of AI Agents in 2026

Computer Use

Agents operate graphical interfaces: clicking, scrolling, filling out forms, navigating applications. Anthropic, OpenAI, and Google are all actively pushing this direction.

Automating tasks in SaaS products without an API. Filling out forms in legacy systems. End-to-end testing through the UI.

Limitations: speed (screenshot → analysis → action takes seconds), instability on complex interfaces, and high cost (every screenshot burns thousands of tokens).

Agent-to-Agent Protocols

Two key standards:

MCP (Model Context Protocol) — the standard for connecting tools to agents. 97M+ installs a month. Since December 2025, governed by the Agentic AI Foundation (AAIF, Linux Foundation). Supported by every major AI provider — effectively the USB-C of AI tooling. In 2026, remote MCP, OAuth authorization, and dynamic tool discovery are all seeing active development.

A2A (Agent-to-Agent Protocol) — the standard for agent-to-agent communication. Version 1.0 shipped in March 2026, with 150+ member organizations: Google, Microsoft, AWS, Salesforce, SAP, IBM. Key concepts: agent cards (machine-readable descriptions of an agent’s capabilities), cross-vendor handoff (delegating tasks to an agent from a different provider), task-mode delegation. Agents from different vendors interact directly, with no custom integrations.

MCP solves “agent ↔ tool”; A2A solves “agent ↔ agent.” Together, they form a complete ecosystem for distributed agent systems.

Specialization vs. Generality

The 2026 trend is specialized agents over general-purpose ones. One for code, another for analytics, a third for DevOps. Each is tuned to its domain: specific tools, optimized prompts, relevant memory.

General-purpose agents (“do everything”) lose to specialized ones on both quality and cost. The future is orchestrating teams of agents built for the specific task.

Agentic Coding as the Mainstream

Coding agents have moved from “experiment” to standard developer tooling. Claude Code, Cursor, Copilot Agent — thousands of teams use them daily.

The next stage is agents in CI/CD: automatic code review, tests on every PR, auto-fixing lint issues, dependency migrations. The developer states the task; the agent carries it through to completion.

A shift in roles: the developer becomes a reviewer, not an author of code. The task is stated in natural language, the agent generates the implementation, the developer checks and corrects it. Iteration speed jumps by an order of magnitude.

Managed Agents — Agents as a Service

Anthropic, OpenAI, and Google have launched managed agent platforms: agents run in the cloud, connect to enterprise systems through standard connectors, and are managed via API.

For a business, this means no servers to run, no prompts to manage, no behavior to monitor. The company defines the tasks and constraints; the platform executes.

A typical scenario: connect an agent to Zendesk, Salesforce, and an internal wiki. The agent handles first-line tickets, qualifies leads, and generates reports — without a single line of code.

Multimodal Agents

2026-era agents don’t work with text alone. Multimodal models let an agent analyze images, diagrams, interface screenshots, and video.

Practical applications:

  • A QA agent takes a screenshot of the app and compares it against a Figma mockup
  • An analytics agent “reads” charts out of PDF reports
  • A DevOps agent analyzes Grafana dashboard screenshots during an incident
  • A design agent generates UI components from wireframes

Agents work with the same artifacts people do: screenshots, diagrams, documents.


AI agents are an infrastructure shift, not hype. The LLM stops being a text generator and becomes a runtime for automation. The frameworks are mature. The protocols are standardized. The practical use cases already run in production.

The easiest place to start is the Claude Agent SDK, OpenAI Agents SDK, or CrewAI — 20 lines of code to a working agent. From there: MCP for tool integration, LangGraph for complex stateful workflows, Pydantic AI for typed Python backends, Google ADK or Microsoft Agent Framework for cloud production systems. A2A handles agent-to-agent interaction across services from different providers.