How to build an AI agent: a step-by-step guide without programming

11 minutes

An AI agent is a language model that doesn’t just answer a question — it decides for itself which steps to take and which tools to use in order to complete a task. You can build one without programming: describe the task precisely, give the agent instructions and access to the files it needs, and then check the result on test data.

Below: what an agent is made of, when you actually need one, and how to build your first agent step by step, using Claude Code as the example.

What an AI agent is, in plain terms

At Anthropic, «agents» refers to systems where a language model directs its own workflow and chooses its own tools, while staying in control of how it completes the task. Put simply: you set the goal, and the agent plans the steps, carries them out, and shows you the result.

The foundation of any agent is a model augmented with information retrieval, tools and memory. Tools are what the agent can actually do in the real world: read and create files, run commands, call other services.

How an agent differs from a chatbot

A chatbot replies with text, and then you do the rest yourself: copy the answer, move the data over, check it. An agent works with your files and tools directly. Claude Code, for example, reads a project’s files, edits them, and runs commands. That’s why an agent needs not just good instructions, but boundaries too: what it can do without your confirmation, and what it can’t.

What an AI agent is made of

Part of the agentWhat it isWhat it looks like in Claude Code
ModelThe language model that understands the task and plans the stepsA Claude model, which you can choose for the agent
InstructionsA description of the role, the task, the rules and the result formatThe agent file, or CLAUDE.md for standing instructions
ToolsThe actions available to the agent: reading files, running commands, external servicesThe tools field in the agent file, and connections via MCP
ContextThe data the agent works withThe project folder, the files you give the agent
ChecksThe rules the agent and the human use to evaluate the resultA checklist in the instructions, plus your own review

In Claude Code, an agent is described by a plain text file: at the top, a name, a description and a list of tools; below that, the instructions. A project’s standing rules live in a CLAUDE.md file: Claude Code reads it at the start of every session.

When you need an agent, and when a simple script will do

Anthropic recommends starting with the simplest solution and adding complexity only when it’s genuinely needed. If a task always goes through the same steps in the same order, it’s more reliable to describe it as a fixed script with the path laid out in advance. An agent is useful where you can’t predict in advance how many steps will be needed, and the path can’t be hard-coded.

Good tasks for a first agent:

  • go through a folder of documents and build a table from them;
  • check a table for errors and gaps and put together a summary;
  • gather information for a list of questions and produce a report with source links;
  • run a chain of similar file operations according to instructions.

Bad tasks for a first agent are ones where a mistake is costly and hard to spot: payments, sending emails to clients, deleting data.

Examples of AI agents for business

TaskWhat the agent doesWhat the human checks
Incoming documentsReads invoices or contracts, extracts key fields into a tableGaps and disputed values from the agent’s report
Spreadsheet reportConsolidates data from several files, flags errors and duplicatesThe conclusions and figures before sending them to a manager
Information overviewGathers information for a list of questions and produces a report with linksThe reliability of the sources and the completeness of the overview
Draft preparationPrepares standard text from a template and data from a tableEvery piece of text before it’s sent to a client
Tidying up filesRenames and sorts files according to rulesThe result on a copy of the folder, before running it on the live one

In every example, the agent handles the routine part, while the decision and the responsibility stay with the human. The higher the cost of a mistake, the more checks there should be, both in the instructions and after the run.

How to build an AI agent, step by step

Step 1. Pick one recurring task

Start with a task you already do by hand following clear rules. Describe it in two or three sentences: what goes in, what needs to be done, what should come out.

Step 2. Describe the result so it can be checked

Instead of «make a report,» say «a table with columns ‘date,’ ‘counterparty,’ ‘amount,’ one row per document; documents with no amount go into a separate list.» The more specific the result, the easier it is for both the agent and you to tell when the task is done.

Step 3. Prepare test data

Make a copy of a few documents, or come up with sample cases, including a couple of «awkward» ones: an empty field, an unusual format. The first runs should only be on test data.

Step 4. Install Claude Code

Claude Code installs with a single command in the terminal; you need a paid Claude subscription or a Claude Console account to use it. Installation and the first run are covered in detail in a separate article — how to use Claude Code.

Step 5. Write the agent’s instructions

Create a .claude/agents/<name>.md file in the project folder. Agents from this folder are available in the current project; personal agents for all your projects live in ~/.claude/agents/. Two fields are required: name — the agent’s name, and description — when to call it. Claude Code uses the description to decide when to hand a task to the agent.

You don’t have to write the file by hand: ask Claude Code to create the agent by describing the task in words, and it will prepare the file with the right fields itself.

Step 6. Restrict the tools and permissions

Give the agent only the tools the task needs. For example, an agent that reads documents and writes a report doesn’t need to run arbitrary commands. The list of tools is set by the tools field.

Keep a separate eye on the session’s permission mode. In manual mode, Claude Code asks before most actions that change files, run commands, or reach the network. The documentation recommends the fully permissive mode — where the agent can do everything without checks — only inside isolated containers or virtual machines.

Step 7. Run it on test data and check it

Ask the agent to run the task on the test folder and check the result line by line. Look not just at the final output, but at how it got there: which files the agent opened, where it hesitated, what it skipped.

Step 8. Fix the instructions and repeat

Turn every mistake you find into a rule in the instructions: «if the amount isn’t found, don’t make one up — add the document to the list of gaps.» Keep repeating the run until the result on test data is stable. Only then move on to real documents.

Example: an agent that builds a table from documents

Here’s what the agent file .claude/agents/doc-table.md might look like:

---
name: doc-table
description: Builds a summary table from the documents in a folder, plus a report of any gaps. Call it when you need to process a folder of documents.
tools: Read, Glob, Grep, Write
---

You process the documents in the folder the user specifies.

For each document, find: the date, the counterparty's name, the amount.
Write the result to a result.csv file: one row per document.

Rules:
- Don't make up data. If a field isn't found, leave the cell blank.
- List documents with blank fields in a missing.md file, with the reason.
- At the end, report how many documents were processed and how many had gaps.

You run it with an ordinary request in a Claude Code session: «process the test-docs folder with the doc-table agent.» You can also call the agent explicitly by mentioning it with @.

Notice three things: the agent is only allowed to read, search and write files; the rule «don’t make up data» is spelled out explicitly in the instructions; and the result and the list of gaps live in separate files that are easy to check.

How to turn an agent into automation

Once an agent reliably works on command, you can make it part of a recurring process:

  • Skill. A recurring procedure is convenient to package as a skill — a SKILL.md file with instructions. Claude Code applies a skill when a task matches it, and you can also call it manually with a command using its name.
  • Running it from the command line. Claude Code can be launched from scripts and command chains, for example passing it data and a task in a single command.
  • Running on a schedule or trigger. Tasks can run on a schedule: cloud «routines» keep working even when your computer is off, and can also run on triggers; local scheduled tasks exist too.
  • Hooks. Hooks run commands before or after Claude Code’s actions — for example, checking the result after every file change.

Automatic runs don’t remove the need for checking. The less often you look at the result by hand, the more important it is that checks are built into the process itself.

Security: what to check before launch

  • The agent works only with the folder the task actually needs.
  • The agent’s list of tools is kept to a minimum.
  • The first runs were on test data, not on live documents.
  • The agent doesn’t perform irreversible actions (deleting, sending, paying) without a human’s confirmation.
  • The instructions include a rule against making up data and a requirement to report gaps.
  • Only vetted external services are connected: the documentation warns that MCP servers that ingest external content can expose you to prompt-injection attacks.
  • You understand that the model processes the content of your files, and your company’s rules allow for that.

Anthropic stresses that agents need to be tested thoroughly in an isolated environment and given guardrails, because an agent’s mistakes can compound.

Common mistakes

  • Too big a first task. «Automate all of accounting» isn’t a task for a first agent. One folder, one type of document, one result format.
  • A vague result. If you can’t check the result in a couple of minutes, the agent won’t be able to tell when the task is done either.
  • No rule for the unknown case. Without an explicit prohibition, an agent may fill an empty field with a plausible but made-up value.
  • Checking only the final result. Mistakes are often visible along the way: the agent opened the wrong file, or skipped part of the documents.
  • Jumping straight to live data. A mistake on a copy is easy to fix; on live documents, it’s costly.

Frequently asked questions

Can you build an AI agent for free?

Not with Claude Code: you need a Claude Pro, Max, Team or Enterprise subscription, or a Claude Console account; the free claude.ai plan doesn’t include access to Claude Code.

Do you need to know how to program?

No. An agent in Claude Code is described in plain text: the task, the rules, the result format. You’ll need to follow instructions to work with the terminal and check the result carefully.

Will the agent work without my involvement?

Once launched, the agent goes through the task’s steps on its own, and it can also be run on a schedule. But the decisions you’re responsible for, and checking the result, stay with a human.

Can an agent be connected to other services?

Yes, Claude Code connects to external tools and data through the MCP protocol. Only connect services you trust, and only with the permissions the task actually needs.

Want to build your first agent step by step? In the «My First AI Agent» workshop, you’ll go from installing Claude Code to your own working agent on a training example, and learn to adapt it to your own tasks. The workshop is launching soon — you can sign up in advance. → Learn about the workshop