Complete guide โข 9 min read
AI agents are language models that can plan, use tools, and take multi-step actions to complete tasks โ instead of just responding to one prompt. Think of them as autonomous workers vs. chatbots.
An AI agent is an LLM equipped with:
| Chatbot | Agent |
|---|---|
| Single response per prompt | Multi-step autonomous execution |
| No tool access | Calls APIs, runs code, browses |
| Stateless | Maintains memory across steps |
| User in control | Agent plans its own next steps |
The typical loop:
import anthropic
client = anthropic.Anthropic()
tools = [{
"name": "get_weather",
"description": "Get weather for a city",
"input_schema": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}]
def run_agent(user_message):
messages = [{"role": "user", "content": user_message}]
while True:
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
tools=tools,
messages=messages
)
if response.stop_reason == "end_turn":
return response.content[0].text
# Handle tool use
for block in response.content:
if block.type == "tool_use":
result = my_tool_impl(block.name, block.input)
messages.append({"role": "assistant", "content": response.content})
messages.append({"role": "user", "content": [{
"type": "tool_result",
"tool_use_id": block.id,
"content": result
}]})
2026 is the year agents move from "cool demos" to "production tools." Expect: better planning, cheaper models, more integrations, and gradual autonomy. But full "AGI as agent" is not here yet.
Related: What is AI? ยท Claude API Guide ยท AI Glossary