Browse Consulting Blog Login / Sign Up
← Back to Blog
March 9, 2026 · 10 min read

Your First Agent in 30 Minutes

This is a step-by-step guide. No theory, no philosophy, no "what is an agent" preamble. By the end of this post, you will have a working AI agent that can read files, execute tasks, and produce output in your terminal. Thirty minutes, start to finish.

Prerequisites

You need two things before we start:

  1. A Claude Pro subscription ($20/month), which gives you access to Claude Code, the CLI agent tool. Alternatively, you can use an Anthropic API key, but the subscription is simpler for getting started.
  2. A terminal. macOS Terminal, iTerm2, or any Linux terminal. Windows users should use WSL.

Install Claude Code if you have not already:

npm install -g @anthropic-ai/claude-code

Verify it is installed:

claude --version

If you see a version number, you are ready.

Step 1: Create the Project Directory

Every agent needs a workspace. Create a dedicated directory:

mkdir -p ~/projects/my-first-agent
cd ~/projects/my-first-agent

This is where your agent will operate. It will read files from this directory, write files to it, and use it as its working context. Keep things organized from the start.

Step 2: Write the CLAUDE.md

The CLAUDE.md file is the instruction manual for your agent. It is a markdown file that Claude Code reads automatically when it starts in a directory. Think of it as the system prompt, but version-controlled and editable.

Create the file:

touch CLAUDE.md

Open it in your editor and add the following:

# Agent Instructions

## Role
You are a research assistant. Your job is to analyze text files
in this directory and produce concise summaries.

## Rules
- Read all .txt files in the current directory before responding
- Summaries should be 3-5 bullet points per file
- Write output to summaries/ directory as markdown files
- Use clear, factual language. No opinions or editorializing.
- If a file is empty or unreadable, skip it and note that in your output.

## Output Format
For each file, create a summary with this structure:
- Filename as heading
- 3-5 bullet points covering key information
- One sentence stating the main takeaway

This is a simple, constrained agent. It has a clear role, explicit rules, and a defined output format. These constraints are what turn a general-purpose model into a focused tool.

Step 3: Create a Simple Task

Your agent needs something to work on. Create a few sample text files:

mkdir -p summaries

cat > article1.txt << 'EOF'
Remote work adoption increased 340% between 2019 and 2023.
Companies with hybrid policies report 12% higher retention
rates compared to fully in-office mandates. The average
remote worker saves $6,000 per year in commuting and
wardrobe costs. Productivity metrics show no significant
difference between remote and in-office workers for
knowledge work roles, though collaboration scores drop
by 8% in fully remote setups.
EOF

cat > article2.txt << 'EOF'
Global semiconductor revenue reached $527 billion in 2025,
a 15% increase from the previous year. The growth was
driven primarily by AI chip demand, which accounted for
32% of total industry revenue. TSMC maintained its
position as the leading foundry with 58% market share.
Supply chain constraints have largely resolved, with
average lead times dropping from 26 weeks in 2022 to
11 weeks in 2025.
EOF

cat > article3.txt << 'EOF'
The average American household spends $2,375 per year on
subscription services, up from $640 in 2019. Streaming
video accounts for 35% of this spending, followed by
software subscriptions at 28%. Subscription fatigue is
measurable: 67% of consumers report having canceled at
least one subscription in the past six months. Bundling
strategies are emerging as the primary retention mechanism,
with bundled subscribers showing 40% lower churn rates.
EOF

You now have three text files with factual content and an output directory waiting for summaries.

Step 4: Run the Agent

This is the step where it all comes together. From your project directory, launch Claude Code:

claude

Claude Code will start, automatically read your CLAUDE.md, and present you with an interactive prompt. Now give it a task:

Summarize all the text files in this directory and write the summaries to the summaries/ folder.

The agent will:

  1. Read the CLAUDE.md to understand its role and rules
  2. Scan the directory for .txt files
  3. Read each file
  4. Generate summaries following the format you specified
  5. Write markdown files to the summaries/ directory

Watch it work. You will see it list the tools it is using: reading files, writing files, thinking through the summaries. This is not a chat interaction. It is an agent executing a workflow.

Step 5: Verify the Output

Once the agent finishes, check what it produced:

ls summaries/

You should see markdown files corresponding to each text file. Read one:

cat summaries/article1.md

Verify that the output follows your specified format: heading, bullet points, takeaway sentence. If it does, your agent is working. If the format is wrong, update your CLAUDE.md with more specific instructions and run it again. This iteration loop, adjusting instructions and re-running, is how you develop agent workflows.

Step 6: Run It Non-Interactively

An agent you have to babysit is only half-useful. The real power comes from running it without interaction. Claude Code supports this with the -p flag:

claude -p "Summarize all text files and write summaries to the summaries/ folder"

This runs the agent in non-interactive mode. It reads the CLAUDE.md, executes the task, and exits. No human in the loop. This is the form you will use when you eventually connect your agent to a cron job or a CI pipeline.

What You Just Built

In 30 minutes, you have:

This is the foundation. Every agent system, from simple file processors to complex multi-agent pipelines, starts with this same structure: a directory, an instruction file, input data, and an execution command.

Next Steps

From here, the path forward depends on what you want to build:

The hard part is not the technology. It is knowing what to automate and writing instructions precise enough that the agent does it reliably. Start small, verify output, and expand gradually. That is how production agent systems get built.

The best agent setup is the one you actually use every day. Start with something simple enough to trust, then grow it from there.

Want the complete setup with templates and configs?

Get the Quick Start Kit →