AI Agent Guides 9 min read

How to Build an AI Agent, Step by Step (With or Without Code)

Pick the job, connect the tools, add guardrails, schedule it. A no-code path you can finish this afternoon, and a code path with an SDK for when you want full control.

Build an AI agent step by step: pick the job, connect tools, add guardrails and schedule it. A no-code path in minutes, plus a code path with SDKs.

Shabnam Katoch

Growth Head

How to build an AI agent step by step: pick the job such as inbox triage, write instructions with a never list, connect tools like Gmail and Slack, and turn approvals on

The first agent most people build is a chatbot with ambitions.

You give it a clever prompt, ask it to "handle my inbox", and watch it write a lovely summary of emails it can't actually touch. No tools.

No trigger. No memory of yesterday. It's a very articulate intern locked in an empty room.

Here's the thing. Learning how to build an AI agent isn't about a smarter prompt. It's about the five parts around the model.

The short version: an AI agent = a model + instructions + tools + memory + a trigger. Build one in 6 steps: pick the job, write instructions, connect tools, add an approval step, test, then schedule it. No-code takes about 15 minutes. Code takes a weekend.

What you need before you start building an AI agent

Most failed agents fail before anyone writes a line of instructions. The job was vague, the data was out of reach, or nobody decided what "done" looks like.

So answer three questions first:

QuestionWeak answerStrong answer
What's the job?"Help with email""Every weekday at 8:00, sort new mail into Urgent, Reply today and FYI"
What data and tools does it need?"Access to everything""Read Gmail, write labels, post one Slack message"
How will you know it worked?"It feels useful""Fewer than 2 wrong labels per 50 emails, checked for a week"

If you can't fill in the right-hand column, you don't have an agent yet. You have a wish.

Three questions before you build: what's the job (weekday 8:00 triage), what tools does it need (read Gmail, post Slack), how will you know it worked (fewer than 2 errors per 50). If you can't answer all three, you don't have an agent yet

The 6 steps at a glance

Every agent, no-code or code, comes down to the same parts. This also answers the question people search for most: what are the key components of an AI agent?

StepComponentWhat it means
1The jobOne narrow, repeatable task with a clear finish line
2InstructionsWho the agent is, what it does, and what it must never do
3ToolsThe apps it can read from and act on, like Gmail, Slack or a calendar
4GuardrailsWhich actions need your approval before they happen
5A test runReal inputs, watched by you, before anything runs alone
6A triggerA schedule or an event that starts the work without you

Memory sits underneath all six. It's what lets Tuesday's run know what Monday's run already did.

Every AI agent in six steps: the job (one narrow, repeatable task), instructions (including a never list), tools (only what the job needs), approvals (risky actions wait for you), a test run (real inputs, watched) and a trigger (a schedule or event). Memory sits underneath all six

Path A, no-code: build an AI agent in BetterClaw

This is the path for founders, ops leads and anyone who'd rather not maintain a Python environment. We'll build an inbox triage agent.

Create the agent

In BetterClaw, open Agents under Workspace settings and click "New agent". Pick a template (General Assistant is a good start), give it a name and click "Create agent".

If you bring your own model key, a "Connect a model" card asks you to pick a provider and model and add the key first. Our guide to creating an agent shows each screen.

Write the instructions

Open the agent's settings and replace the template personality with something specific:

You triage my Gmail inbox every weekday morning.
Sort each new email into one label: Urgent, Reply today or FYI.
Never send, delete or forward email. Never open links.
If you're unsure, use Reply today. Post a 5-line summary to Slack.

Notice the "never" lines. They matter more than the clever ones.

Connect the tools

Grant the agent the connectors it needs, here Gmail and Slack, and nothing else. Narrow access is the cheapest safety feature you'll ever add.

Add an approval step, test, then schedule

Set the agent so actions that change things wait for your approval. Then start a chat, ask it to triage today's inbox, and watch what it does. When a full run looks right, open Scheduled tasks, create a recurring task, choose Daily or Weekly, pick the agent and check the first-run preview.

Build an agent in BetterClaw in about 15 minutes with no code: create the agent from a template, write instructions with a never list, connect Gmail and Slack only, approve and test a real run, then schedule a recurring task

Path B, code: build an AI agent with an SDK

If you want full control, write it. Here's a minimal agent with one tool, using the OpenAI Agents SDK in Python (pip install openai-agents, with OPENAI_API_KEY set):

import asyncio
from agents import Agent, Runner, function_tool

@function_tool
def get_unread_count() -> str:
    """Return how many unread emails are waiting."""
    return "12 unread emails"  # replace with a real Gmail call

agent = Agent(
    name="Inbox Helper",
    instructions="Summarise the inbox. Use get_unread_count when asked about volume.",
    tools=[get_unread_count],
)

async def main():
    result = await Runner.run(agent, "How busy is my inbox today?")
    print(result.final_output)

if __name__ == "__main__":
    asyncio.run(main())

That's the whole loop: the model reads the request, decides to call the tool, reads the result, and answers. Real agents add OAuth for each app, memory, retries and logging.

FrameworkLanguageGood for
OpenAI Agents SDKPython, TypeScriptTool-calling agents on OpenAI models
LangGraphPython, TypeScriptComplex, stateful multi-step flows
CrewAIPythonTeams of role-based agents
Claude Agent SDKPython, TypeScriptAgents built on Claude Code's tools

Our AI agent frameworks guide compares these in more depth.

What a production agent adds on top of those 20 lines:

  • OAuth sign-in for each app, with tokens that refresh.
  • Memory that survives a restart.
  • Retries and timeouts for flaky APIs.
  • Logs you can read when something goes wrong.
  • A machine that stays on, and an alert when it doesn't.

Here's what nobody tells you about Path B. The code is the easy weekend. Hosting it 24/7, rotating tokens, and noticing when it silently stops working is the hard month.

Build an agent with an SDK: install with pip install openai-agents, write about 20 lines of Python, run it so the model calls your tools, then production is the hard month. Code takes a weekend, running it takes longer

How to build an AI agent with Claude or with ChatGPT

Both Claude and ChatGPT can act on your apps today. The question is whether you want help when you ask, or work done when you don't.

With Claude

On claude.ai you can connect apps like Gmail and Google Calendar from Customize > Connectors and add reusable skills. That's a capable assistant inside a chat. For an agent that runs on a schedule without you opening a tab, use the Claude Agent SDK or a platform that runs Claude models for you.

With ChatGPT

ChatGPT's own agent features now live in ChatGPT Work and, on Business, Enterprise and Edu plans, workspace agents. If you'd rather use your ChatGPT Plus or Pro subscription in an always-on agent, BetterClaw supports signing in with it, so your agent's model usage draws on that subscription.

Can you build an AI agent for free?

Yes, with limits. The SDKs above are free and open source, but you pay for model usage and for a machine to run the agent on.

On BetterClaw, the free plan includes one agent and 100 credits a month, with no card. You bring your own model key, so you still pay your provider for inference. A small daily triage agent fits comfortably; an agent that browses the web all day won't.

CostFree pathPaid path
Builder or frameworkFree SDK, or BetterClaw's free planBetterClaw from $19/month
HostingYour own machine, if it stays onIncluded on a managed platform
Model usageYour provider's free tier, if anyPay your provider per token, or use a ChatGPT subscription
Your timeHighestLowest

That's honestly why we built BetterClaw: most people who want an agent don't want a server, a Docker file and a token-refresh script to come with it.

Add guardrails before it runs unattended

Stay with me here, because this step is where agents earn trust or lose it.

An agent with inbox access and no approval step is one confused prompt away from a bad day. In February, a Meta alignment director watched an open-source agent bulk-trash hundreds of her emails after it lost her "confirm before acting" instruction.

The fix is architecture, not a stronger prompt. Make "send", "delete" and "pay" wait for a human.

On BetterClaw, that's built into trust levels. An Intern agent drafts but never executes. A Specialist executes within the boundaries you set.

A Lead acts on its own, with a one-click kill switch always available. Start every new agent as an Intern, and promote it only after a clean test week. Our guide to human approval guardrails shows how to set that up without slowing everything down.

Test, schedule and monitor

Run the agent by hand on real inputs for a few days. Read every output. Count the mistakes against the success check you wrote at the start.

A simple test log is enough:

DayEmailsWrong labelsNotes
Mon463Newsletters labelled Urgent; added a rule
Tue511One invoice missed; added "invoice" keyword
Wed390Clean run

When two runs in a row meet your success check, you're ready to schedule.

Notice what the log is really doing. Every mistake turns into a rule in the instructions, so the agent gets better each day of the test week instead of staying exactly as good as its first prompt.

Then schedule it. On BetterClaw, recurring tasks run hourly, daily, weekly, monthly or on a custom cron, within your plan's limits; the free and Starter plans run at most once a day.

After that, check the run history once a week. Agents rarely fail loudly.

They drift quietly. Our guide to scheduling an AI agent automatically covers schedules, run history and what to watch for.

Common mistakes when you build an AI agent

  • Too broad a job. "Run my marketing" fails. "Draft three LinkedIn posts from last week's blog" works.
  • Too much access. Every extra permission is another way to make a mess.
  • No "never" list. Agents follow what you forbid as closely as what you ask.
  • Skipping the test week. The first run is never the one to trust.
  • No owner. Someone has to read the run history, or nobody will.

What comes after your first agent

Once one agent works, the next step is a small team: one agent triages, another drafts, a third reports. Each stays narrow, and you approve the hand-offs.

Here's the honest takeaway. The model is the easy part now.

The craft is in the job you choose, the access you withhold and the checks you keep. Get those right and a 15-minute agent will quietly save you hours every week.

If you'd like to skip the servers and start building, give BetterClaw a try. The free plan includes 1 agent and 100 credits a month, with no card, and paid plans start at $19/month (see full pricing).

We handle the infrastructure. You handle the interesting part.

Frequently Asked Questions

What are the key components of an AI agent?

An AI agent has five parts: a model that reasons, instructions that define the job, tools that let it read and act in other apps, memory that carries context between runs, and a trigger that starts the work. Remove any one and you're back to a chatbot.

Is ChatGPT an agent or an LLM?

ChatGPT is an app built on large language models. On its own, a chat that answers questions is an assistant, not an agent. It becomes agent-like when it uses tools and takes multi-step actions, which OpenAI now offers through ChatGPT Work and workspace agents.

How long does it take to build an AI agent?

A simple no-code agent, like inbox triage, takes about 15 minutes to set up, plus a few days of supervised testing. A coded agent takes a weekend to write and longer to host and maintain reliably.

How much does it cost to build an AI agent?

The frameworks are free; you pay for model usage and somewhere to run it. On BetterClaw, the free plan includes 1 agent and 100 credits a month, paid plans start at $19/month, and with your own key you pay your model provider directly. Our AI agent cost guide breaks down the rest.

Do I need to code to build an AI agent?

No. No-code builders handle the model, tools, memory and scheduling for you. Code makes sense when you need custom logic, unusual integrations or full control over hosting.

Want to skip the setup?

BetterClaw does this in 60 seconds. No Docker, no config files.

Start free
Tags:how to build an ai agenthow to create an ai agenthow to make an ai agenthow to build an ai agent for freebuild ai agent with claudebuild ai agent with chatgptkey components of an ai agent
Shabnam Katoch

Written by

Growth Head

Shabnam leads growth at BetterClaw and has spent the past three years building organic distribution for AI-native products. She writes about no-code agent builders, content strategy, and what it actually takes to grow without an ads budget.

Share this article
Was this helpful?