Major

How to Create an AI Agent: A Build Guide That Survives Day Two

Creating an AI agent takes an afternoon. Getting it to do the same thing twice is the part nobody writes about. Here is the build procedure, the no-code and free options, and the step where most agents quietly start costing more than they save.

Rahul RamakrishnanUpdated
Support operator wearing a headset working at a computer, handling customer requests

An AI agent is a loop in which a language model chooses the next step and calls tools until a task is done. You create one in five moves: pick one narrow task with a checkable result, give the model a few scoped tools, write instructions that cover the edge cases, add a human checkpoint on anything irreversible, and log every run. The afternoon build is easy. The project is making run 500 behave like run 5.

That second half is where Major fits. Major is the enterprise platform where agents build the software they run on. You describe the task, the agent works out the repeatable parts and builds them as apps with a managed database, scoped credentials and audit logs, then runs those apps instead of reasoning through the same steps again. Reason once. Run forever.

What counts as an AI agent

Anthropic's Building Effective Agents draws the line. Workflows are "systems where LLMs and tools are orchestrated through predefined code paths." Agents are "systems where LLMs dynamically direct their own processes and tool usage." OpenAI's practical guide to building agents likewise excludes applications that use a model without letting it control workflow execution.

By that definition a chatbot is not an agent, and a RAG pipeline that always retrieves and always summarizes is a workflow with a model in the middle. Nothing is wrong with that. But once the model picks the path, behavior varies from run to run, and everything hard about production agents follows from that.

The classical taxonomy (simple reflex, model-based, goal-based, utility-based, learning agents, per IBM's overview) is useful vocabulary. Nearly every LLM agent shipping today is goal-based or utility-based.

How to create an AI agent, step by step

The running example is an inbox-triage agent. It reads a support email, classifies it, looks up the customer, and drafts a reply that a person approves before anything sends.

  1. Pick one narrow task. One input, one finished state, a way to tell if it went right. You should be able to list every tool it needs on one hand.
  2. Choose the model. OpenAI's guide suggests prototyping with the most capable model for a baseline, then swapping in smaller ones where they still pass. Starting cheap confuses model capability with prompt quality.
  3. Define the tools. Data tools fetch context, action tools change something, orchestration tools expose one agent to another. Triage needs two data tools (get_customer, search_past_tickets) and one action tool (submit_draft_for_approval). Note what is missing: there is no send_email. Nothing the agent can call reaches a customer, so a prompt injection buried in an inbound email has nowhere to go.
  4. Write instructions that name the edge cases. State the sequence, the customer-facing wording, and what to do when information is missing. "Ask for the order number if it is absent" is an instruction. "Be helpful" is decoration.
  5. Add guardrails and a checkpoint. Rate each tool by whether it writes, whether it is reversible, and what a mistake costs. Route high-risk calls to a person. OpenAI names two triggers: exceeding a failure threshold, and sensitive, irreversible or expensive actions.
  6. Test on twenty real inputs. Include the two barely legible ones. Synthetic cases pass because you wrote them in the same frame of mind as the prompt.
  7. Log and cap. Record the tools available at each turn, the tool chosen, arguments, result and token count. Set a maximum turn count before launch, not during an incident.

Can you create an AI agent without coding?

Yes. Visual builders let you wire tools, write instructions and set guardrails on a canvas, and you can have a working agent the same day. OpenAI's Agent Builder was exactly this, and OpenAI announced in June 2026 that Agent Builder and Evals leave the platform after 30 November 2026. Take the lesson rather than the product: canvases get you the first 80% fast, then run out at version history you can diff, shared state, permissions that outlive the builder, and an audit trail. That is where no-code quietly becomes no record.

Can you build one for free?

Two honest routes, both with a wall. Provider free tiers cover a prototype and then meter you, and cost per run follows the number of reasoning steps, so a triage agent that takes four turns on an easy email and eleven on a messy one has a bill that moves with your inbox. Open-weight models such as OpenAI's gpt-oss-20b (Apache 2.0) run locally through a tool like Ollama at no per-token cost, which shifts the expense into GPU memory, latency and tool-calling reliability. Test that reliability first. A model that fumbles the JSON is not free.

ChatGPT can write your tool schemas and run loop quickly. That makes it a good scaffolding tool and a different thing from the runtime your agent lives in.

Why agents drift on day two

The agent works. Now it runs a thousand times and four problems arrive together.

  • It re-decides. The same email arrives Tuesday and the agent reasons from scratch to the classification it reached Monday. That spend buys nothing.
  • It forgets. State lives in a context window that ends with the run.
  • It varies. Two near-identical inputs take different paths, and neither run is wrong enough to catch.
  • It leaves no record. Months later someone asks what it did in March, and you have the output but not the decision or the tool inventory.

A better prompt fixes none of these. Any step that does the same thing every time should be code. A four-category classification is a function, the customer lookup is a query, and ranking past tickets is a sort. Move those out of the model and its reasoning shrinks to the one real judgment in triage: does this email need escalation.

It is also fair to not build an agent at all. OpenAI's guide says that where a use case lacks real judgment, unstructured data or tangled rules, "a deterministic solution may suffice." Anthropic advises finding "the simplest solution possible, and only increasing complexity when needed." An agent wrapped around a task a cron job could do is a slower, costlier cron job.

This guide does not cover fine-tuning or multi-agent orchestration beyond a mention.

Build the triage agent on Major

Here is the same inbox-triage agent built on Major so the day-two problems are handled by construction.

  • Connectors. Gmail or Zendesk for the inbound mail and tickets, your CRM or Postgres for the customer record, Slack for the approval message. Each runs on scoped credentials, so the agent holds access to what triage needs and nothing else.
  • The app that holds state. The agent builds a triage app with a managed database: tickets, categories, drafts, approval status, and a history per customer. Classification and lookup run there as deterministic code. Today's email and last week's email read the same tables.
  • The agent's judgment. What remains for the model is the escalation call and the tone of the draft. It does less per run, not nothing.
  • The trigger. A workflow fires on each new inbound message, runs the app, calls the agent only for those two decisions, and posts the draft to Slack for a person to approve.
  • Governance. Role-based access decides who can approve and who can edit the app. Every tool call, argument and result lands in the audit log, so the question about March has an answer.

Because the repeatable core is code, cost is front-loaded when the agent reasons the workflow out, then flat as volume grows. Start building free and describe your own first task.

What we think

The industry made creating an agent easy and left running one hard. Most guides end at the moment the agent works once, which is where the expensive problems begin: the same task re-reasoned on every run, state that disappears with the context window, and no way to reconstruct what happened.

Major is built on the other half of that arc. When an agent works out how to handle a repeatable part of a task, it builds an app for that part, and from then on runs the app. None of this makes an agent correct. Bad judgment moved into an app is bad judgment that now runs reliably, which is why the human checkpoint in step five stays on any platform. What changes is the day-two question, from why it did something different this time to whether this is still the right app. A team can answer the second one.

Start building on Major

Turn the repeatable core of your first agent into a governed app with its own database, scoped connectors and audit trail, then keep the model for the judgment calls.

Related articles

Frequently asked questions

How do I build an AI agent?
Pick one task with a checkable success test, give the model a small set of tools with scoped permissions, write instructions that cover edge cases, add a state store so runs survive restarts, and put a human approval gate on anything irreversible. The last two steps are where most projects stall, because they are infrastructure rather than prompting. Major supplies hosting, permissions, database and audit as defaults.
Can I build an AI agent without coding?
Yes. Visual agent builders let you connect tools, write instructions and set guardrails without Python, and a working agent can run the same day. The constraint shows up later: many give you no diffable version history, shared state between runs or audit trail. On Major you describe the task in plain language and the agent produces an app you can version, permission and audit.
Can you build AI agents for free?
Yes, by two routes. Provider free tiers cover a prototype and then meter you, with cost rising alongside reasoning steps per run. Open-weight models such as gpt-oss-20b run locally under Apache 2.0 with no per-token cost, moving the expense into GPU memory, latency and tool-calling reliability. Test that reliability first.
How long does it take to build an AI agent?
A single-task agent with three tools and an approval step is an afternoon of work for someone comfortable with an API. Making it behave identically across hundreds of runs, hold state and leave a record takes far longer. Major shortens that second phase by handling deployment, permissions, storage and audit by default, but defining the task and testing it remain your work.