Building Your First Agent
Let's build a real agent that completes tasks autonomously. We'll start simple and progressively add capabilities.
Agent 1: Research Assistant (No Code)
Goal: Agent that researches a topic and creates a summary document
Platform: Claude or ChatGPT (free tier works)
Step 1: Define the Task
Instead of asking questions, give a complete task:
Research the top 5 AI code editors in 2026. For each one:
- Key features
- Pricing
- Best use case
- Market position
Create a comparison document with recommendations.
Step 2: Let It Run
The agent will:
- Search for information
- Analyze findings
- Structure the document
- Create the output
Step 3: Review and Refine
Provide feedback:
Good start. Please add:
- User reviews/ratings
- Integration capabilities
- Update with pricing I can verify
You just built your first agent! It's autonomous, multi-step, and completes the full task.
Agent 2: Custom Skill Agent
Goal: Create a reusable research skill
Platform: Claude Code (or any tool that supports the Agent Skills open standard)
A skill is a folder containing a SKILL.md file. That file has YAML frontmatter telling the agent when to use the skill, followed by the instructions it should follow. Once the file exists, your agent can load it automatically when it's relevant, or you can invoke it directly.
Step 1: Create the Skill
Skills live on your filesystem, not on a website. Create a folder and add a SKILL.md file inside it:
mkdir -p ~/.claude/skills/deep-tech-research
Then save the following to ~/.claude/skills/deep-tech-research/SKILL.md:
---
name: deep-tech-research
description: Comprehensive technology research with competitive analysis. Use when researching a tool, product, or technology.
---
# Deep Tech Research
## Instructions
1. Search for the technology/tool
2. Find official sources first (documentation, company site)
3. Check reviews on Reddit, HN, X
4. Analyze competitors
5. Identify strengths and weaknesses
6. Create a structured comparison
## Output Format
# [Technology Name]
## Overview
[2-3 sentence summary]
## Key Features
- [Feature 1]
- [Feature 2]
## Competitors
| Name | Strength | Weakness |
## Recommendation
[Who should use this and why]
## Sources
[Links to all sources]
The folder name (deep-tech-research) becomes the skill's name, and the description helps the agent decide when to load it automatically.
Step 2: Use the Skill
In Claude Code, invoke the skill directly or let the agent pick it up when it's relevant:
Use the deep-tech-research skill to analyze Cursor IDE
Step 3: Find and Share Skills
You don't have to build every skill yourself. skills.sh is a directory of community skills you can install with a single command:
npx skills add owner/repo
Browse it for existing skills, install the ones you need, and publish your own when you want to share them.
Step 4: Iterate
Refine the skill based on results. Edit the SKILL.md file and the changes take effect right away. Skills improve over time.
Agent 3: Automated Workflow (Low Code)
Goal: Agent that monitors competitors daily
Platform: Make.com or Zapier Agents
Architecture
Step 1: Set Up Trigger
Make.com:
- New scenario
- Schedule trigger: Daily 9am
Zapier Agents:
- Natural language: "Every day at 9am..."
Step 2: Add Web Monitoring
Make.com:
- HTTP module → Get competitor homepage
- Repeat for each competitor
Zapier:
- "Check these URLs: [list]"
Step 3: Add AI Analysis
Make.com:
- Claude/ChatGPT API module
- Prompt: "Analyze these pages for changes in: pricing, features, messaging"
Zapier:
- "Use AI to find changes"
Step 4: Alert on Changes
Make.com:
- Filter: If changes detected
- Slack module: Post message
Zapier:
- "If changes found, post to #competitive-intel"
You now have an autonomous monitoring agent!
Agent 4: Development Agent (Technical)
Goal: Agent that fixes bugs autonomously
Platform: Cursor or Claude Code
Using Cursor
-
Open your project in Cursor
-
Describe the bug:
Agent mode: There's a bug where users can submit empty forms.
Fix the validation and add tests.
-
Cursor Agent will:
- Read relevant files
- Identify the issue
- Write the fix across multiple files
- Add tests
- Verify it works
-
Review the changes:
- Check the diff
- Run tests
- Commit if good
Using Claude Code (CLI)
# Install
curl -fsSL https://claude.ai/install.sh | bash
# Navigate to project
cd my-project
# Give it a task
claude "Add rate limiting to the API endpoints"
Claude Code will:
- Analyze your codebase
- Implement rate limiting
- Add tests
- Update documentation
Agent 5: Custom Agent (Code)
Goal: Build a custom agent from scratch
Platform: Python + Claude API
Simple Agent Framework
import anthropic
import os
class ResearchAgent:
def __init__(self):
self.client = anthropic.Anthropic(
api_key=os.environ.get("ANTHROPIC_API_KEY")
)
def research_topic(self, topic):
"""Autonomous research agent"""
# Agent loop
messages = [{
"role": "user",
"content": f"""Research {topic} thoroughly.
Steps:
1. Search for official information
2. Find user reviews
3. Compare alternatives
4. Create summary document
Use tools as needed. Complete the full task."""
}]
# Agent runs until task complete
while True:
response = self.client.messages.create(
model="claude-sonnet-5",
max_tokens=4096,
messages=messages,
tools=[
{
"type": "web_search_20260209",
"name": "web_search"
},
{
"name": "create_document",
"description": "Create markdown document",
"input_schema": {
"type": "object",
"properties": {
"content": {"type": "string"}
}
}
}
]
)
# Check if agent is done
if response.stop_reason == "end_turn":
return response.content
# A long server-side web search loop can pause here; re-send
# the same messages to let the API resume where it left off
if response.stop_reason == "pause_turn":
messages.append({
"role": "assistant",
"content": response.content
})
continue
# Execute client-side tool calls (web_search runs server-side
# and needs no handling here — only custom tools do)
if response.stop_reason == "tool_use":
for block in response.content:
if block.type == "tool_use":
result = self._execute_tool(
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
}]
})
def _execute_tool(self, tool_name, params):
"""Execute tool and return result"""
if tool_name == "create_document":
return self._create_doc(params["content"])
def _create_doc(self, content):
# Save document
with open("research.md", "w") as f:
f.write(content)
return "Document created"
# Use the agent
agent = ResearchAgent()
result = agent.research_topic("AI code editors 2026")
print(result)
Run It
export ANTHROPIC_API_KEY=your_key
python research_agent.py
The agent autonomously completes the research task!
Common Patterns
Pattern 1: Approval Gates
For agents that take actions, add human approval:
def needs_approval(action):
"""Human approval for critical actions"""
print(f"Agent wants to: {action}")
response = input("Approve? (y/n): ")
return response.lower() == 'y'
Pattern 2: Error Recovery
Agents should retry on failure:
def safe_tool_call(tool, params, max_retries=3):
for attempt in range(max_retries):
try:
return tool(params)
except Exception as e:
if attempt == max_retries - 1:
return f"Failed after {max_retries} attempts: {e}"
time.sleep(2 ** attempt) # Exponential backoff
Pattern 3: Cost Limits
Prevent runaway costs:
class Agent:
def __init__(self, max_cost_usd=1.0):
self.max_cost = max_cost_usd
self.current_cost = 0
def check_budget(self, estimated_cost):
if self.current_cost + estimated_cost > self.max_cost:
raise BudgetExceeded("Cost limit reached")
self.current_cost += estimated_cost
Next Steps
Level up your agents:
- Agent Patterns - Learn advanced architectures
- Multi-Agent Systems - Coordinate multiple agents
- MCP Integration - Connect to tools and data
- Agent Safety - Guardrails and sandboxing
Resources:
Community:
- Share your agents on skills.sh
- Join Anthropic Discord
- Follow #ai-agents on X
Start with Agent 1 today. By Agent 5, you'll be building production systems!