How to build a custom AI agent: steps, architecture, and cost

A custom AI agent is software built around a language model: the model chooses the next step of a task itself, and the software connects it to your company's data and tools, under written rules for which actions it may take on its own and which need a person. At Ronas IT, building an agent for your systems starts at $3,000 and takes at least 1 week. Before the build, we recommend an analysis phase of $1,000 to $2,000, but you can skip it.
This guide is for product owners and operations leads who want an agent to take over a real task. It explains when an agent is the right tool, what it is made of, why the harness around the model matters, which frameworks and platforms it can be built on, how we build one, what can go wrong, and what it costs. Our AI software development page describes the service itself.
What a custom AI agent is
An AI agent is software in which a language model chooses the next step of a task: what to look up, which tool to call, and when the task is finished. “Custom” means it works with your data, your systems, and your rules. A general chat assistant knows nothing about your orders, clients, or approval limits.
Anthropic's engineering guide Building effective agents (2024) distinguishes between two kinds of systems. In workflows, the model and tools are “orchestrated through predefined code paths.” In agents, the model directs its own “processes and tool usage.” OpenAI's A practical guide to building agents (2025) adds that simple chatbots and single-turn models are not agents. In practice, there are three levels:
- Chatbot or assistant: answers questions and can search your documents, but does not change anything in your systems.
- Workflow with AI steps: code sets the order of steps, and the model does one of them, such as sorting an email or drafting a reply.
- Agent: the model picks the steps and tools itself, within limits, and checks each result before the next step.
A system can stop at the second level and still do the job. Anthropic recommends “finding the simplest solution possible, and only increasing complexity when needed.”
When a custom agent is worth building
Build a custom agent when the task needs judgment over free text, uses your own systems, and repeats often enough to pay for the build. If fixed rules are enough, use rules. If the task stays inside one platform your team already uses, try that platform's agent builder first.
OpenAI's guide lists three signs that a task suits an agent: decisions with exceptions and context, rule sets that have become too large to maintain, and heavy use of unstructured data such as emails, documents, or conversations. If a task does not clearly show these signs, the guide says “a deterministic solution may suffice,” meaning one built on fixed rules.
| Your situation | Better fit | Reason |
|---|---|---|
| Fixed steps and clear rules, such as routing a form by its budget field | Rules or a workflow automation tool such as n8n | Cheaper to run, predictable, and easy to test |
| The task stays inside Microsoft 365 or Salesforce | The platform's own agent builder, such as Copilot Studio or Agentforce | The vendor maintains the connectors to its own apps |
| The task spans your own software, such as an in-house CRM or an internal database | Custom agent | Ready-made connectors do not know your data model or your approval rules |
| The agent serves your customers inside your product | Custom agent | It becomes a feature of your product, with your interface and your rules |
| Data may not leave your servers | Custom agent with an open model on your servers, run with a tool such as Ollama | The model, the data, and the logs stay in your infrastructure |
Our own automation puts rules first too. An AI step reads an inbound job posting only after the posting passes fixed checks on its budget, the client's rating, and the words in its title. For follow-ups, a query chooses the leads, and the model's part is the wording of each message. If a platform or a set of rules fits your task, we will tell you.
What a custom agent is made of
A custom agent has six parts: a model, instructions, tools, access to your data, limits on its actions, and tests with traces. OpenAI's guide names the first three as the core of any agent. The other three make it safe to run on real business data and let you find out why it did what it did.

- Model: a hosted model through an API, such as OpenAI GPT, Anthropic Claude, or Google Gemini, or an open model on your servers. OpenAI's guide suggests building the first version with the most capable model to set a baseline, then trying smaller, cheaper models where the results stay good enough.
- Instructions: the task, the order of checks, what to do when data is missing, and when to stop and ask a person. This is the hardest part to get right. Writing instructions is iterative: the first version rarely handles every case, and each wrong result leads to a new version. The instruction behind our sales team's first-reply agent opens with the order in which to trust its inputs, plus a rule for when a form field and the email body say different things. The tests and traces at the end of this list show which cases the current version still gets wrong.
- Tools: narrow functions over your systems' APIs, such as “find an order” or “create a draft refund,” rather than “run any database query.” The Model Context Protocol (MCP) gives AI applications one standard way to reach data sources, tools, and workflows. Our public MCP server for Open WebUI knowledge bases has three tools, and all three only read: list the knowledge bases, search one, and get its details. With custom MCP server development, your systems get a server that tells the agent which tools it can call.
- Data: records come through tools, and documents through search that finds the right passages for each step. Our guide to AI-based knowledge management systems explains how that search works and how it respects access rules.
- Limits: a separate account for the agent with the smallest set of permissions, a list of actions that need a person's approval, and a maximum number of steps per task.
- Tests and traces: a saved set of real cases with the correct outcome, and a record of every step the agent took, so a wrong result can be followed back to the tool call or passage behind it. Each wrong result becomes a new test case and the reason for the next version of the instructions.
The instructions and the data together are the agent's context, and a better model does not fix a weak one. Brian Houck of DX and co-authors from Capital One, Google, and the University of Victoria propose five checks for agent context, called CAFE(S): can the agent read the request as intended, does it know the goal and what “done” looks like, is the information true and current, can it find what matters without the noise, and should it see this information at all. Before any of these, the knowledge has to be written down: an exception rule that lives only in a manager's head never reaches the agent through search. Cloudflare did this for its engineering standards. It rewrote them as documents of MUST and SHOULD statements, gave each area a named owner, and gave every statement a stable ID, so its AI reviewers load only the rules that apply to the change in front of them. Your approval limits and exception rules can be kept the same way: short numbered statements, each with a person who keeps it current.
Why the harness matters as much as the model
The model only proposes the next step. The software that runs it is called the harness: it repeats the cycle of planning a step, taking it, and reading the result, gives the model its instructions and context, checks the arguments of each tool call before it runs, holds risky actions for approval, saves progress, keeps the agent in a sandbox, and records traces. Investor Tom Tunguz splits a harness into seven parts and gives an example of what a good one does: when a ten-step task fails at step 7, it resumes at step 8 instead of starting again. Every company can buy the same models, so most of the work in a custom agent goes into its harness.
The harness changes results with the model held fixed. LangChain reports that it changed only the harness of its coding agent in 2026: the system prompt, the tools, and hooks such as one that stops the agent before it finishes and makes it check its work against the task. On Terminal Bench 2.0, a benchmark of 89 tasks, its score rose from 52.8% to 66.5%. A harness also costs money. In an experiment published on Martin Fowler's site in October 2026, Naresh Jain gave a coding agent interface contracts and tests to run while it worked and scored each result on 178 acceptance tests. A frontier model passed in all 10 runs with and without the harness, and the harness made a run about seven times more expensive. A cheaper model passed in 3 of 10 runs alone and in 10 of 10 with the harness, and still cost less per run than the frontier model without it.
So the harness is set up for the model and the task, and it is tested like the agent itself: which checks run at every step and which only at the end, which steps a smaller model can take, and what the agent reads when it resumes a task. A new model or a new harness setting goes through the same saved cases before it reaches users.
Agent frameworks and platforms
The harness can be built with an agent framework, or the agent can run on an open-source agent platform that already has memory, skills, chat channels, and scheduled tasks. A framework fits an agent inside your product or back office. A platform fits an assistant your team talks to in Slack or Telegram and gives recurring work to.
Frameworks for building agents
Frameworks for building the harness include:
- LangChain: a framework for building agents and applications on language models, with ready connections to models and third-party services; LangGraph below comes from the same team.
- LlamaIndex: an open-source framework for retrieval and agent applications over your documents; the company behind it now focuses on document parsing and extraction.
- LangGraph: a low-level library, with Python and JavaScript versions, for long-running agents that keep their state, resume after a failure, and pause for a person to check or change their work.
- OpenAI Agents SDK: a lightweight framework built around agents, tools, handoffs between agents, guardrails, and built-in tracing; it also works with models from other providers.
- Google Agent Development Kit (ADK): a code-first framework for building, evaluating, and deploying agents, tuned for Gemini but usable with other models.
- CrewAI: a Python framework for teams of role-based agents that work on one task together, plus event-driven flows for steps that need fixed control.
- Pydantic AI: a typed Python agent framework from the team behind the Pydantic library, with its own tools for evaluating agent outputs.
- Mastra: a TypeScript framework for agents and workflows that fits into React, Next.js, and Node.js apps.
- Claude Agent SDK: Anthropic's library for Python and TypeScript that gives your agent the harness of Claude Code: the same tools, agent loop, and context management.
- Microsoft Agent Framework: the successor to Semantic Kernel and AutoGen, built by the same teams: an open-source framework for Python and .NET with graph-based workflows for several agents.
Our technology radar marks the frameworks LangChain and LlamaIndex, PostgreSQL with pgvector for document search, and Langfuse for traces as Adopt, which means our default choice. Multi-agent systems are at Trial: we do not choose them for a new build and work with them when a client's system already uses them. OpenAI's guide makes a similar point: a single agent “can handle many tasks by incrementally adding tools.”
Agent platforms: OpenClaw and Hermes Agent
OpenClaw is an open-source AI assistant that runs on your own hardware and that people reach through the chat apps they already use, such as Slack, Microsoft Teams, Telegram, or WhatsApp. One installation can serve a single person or a team whose members share the same level of trust: according to OpenClaw's security policy, anyone who can message a shared agent can use everything that agent is allowed to do. People who need their access kept apart get separate gateways or hosts. Models can be swapped, and tools, skills, and plugins extend what the assistant can do. Hermes Agent from Nous Research is an open-source agent with a built-in learning loop: it writes skills from finished tasks, keeps memory across sessions, works with many model providers, and has a scheduler for recurring tasks.
We run our own internal agents for marketing, project management, and sales on OpenClaw. Either platform can be the base for a client's agent when the team should work with it through chat. The parts of an agent described above still apply: the agent gets its own account with narrow permissions, a list of actions that need approval, and tests on real cases.
How to build a custom AI agent, step by step
We build an agent in seven steps, from one measured task to a gradual launch. The first four happen before the agent exists: they decide whether it is worth building, what it may touch, and how you will know it works. An analysis phase that takes at least one week usually covers steps 1 to 3 and can include the first versions of the agent's instructions. Our sprints are one to three weeks long in most cases, and each one ends with something you can open and check.
“Before the first prompt, I want two lists written down: the cases the agent has to get right, and the actions it may never take alone. With those two lists, every change to a prompt, a model, or a tool gets checked the same way, and nobody argues from a single good demo.”
Alexander Storozhevsky, Lead developer at Ronas IT
- Pick one task and measure it today. Write down who does it, how often, how long it takes, and where it goes wrong. On an AI tool for a creative agency, our analysis broke the agency's video workflow into steps and found the most resource-intensive task: revising storyboards when clients changed the scenario. That is where the AI went.
- Split the decisions between code and the model. The model reads free text and chooses a reply. Thresholds, eligibility, and permissions stay in code. When our AI step qualifies an incoming request, it fills in fields of a task in our tracker instead of writing a comment, and picks the service and the industry from fixed lists. People can then filter and count tasks by these fields and fix a wrong value.
- Map the systems and the access. For each system, list the actions the agent needs, the API that offers them, and the account it will use. For a system without an API, we recommend adding one: API calls are faster, easier to test, and easier to limit to the actions the agent needs. The other way is computer use, where the model sends mouse and keyboard actions to the system's screens. It needs no new API, but Anthropic's documentation warns that it can be too slow where speed matters and that the model can click in the wrong place.
- Build the test set. Collect typical cases with the outcome you expect, built from anonymized or synthetic data rather than your customers' records. We keep every version of our own prompts, in Git or in Langfuse, and each new version is compared with the previous one on the same saved cases. Write the correct outcome of each case before the agent ever runs on it, and include the edges: an empty search result, a tool that times out, a request only half inside the task. In his checklist for reviewing AI-written code, Alex Garrett-Smith notes that tests written after the output share its wrong assumptions, and that such code handles the typical case well and breaks at the boundaries. An agent's test set falls into the same trap when its expected answers are copied from what the agent said.
- Build a prototype and score it. Connect the model to the tools in a test environment with test data, and run it on the test set. If you want an answer on feasibility before you commit to the full build, the analysis phase can give it first.
- Add limits, approvals, and stop rules. Remove every tool and permission the task does not need, send high-impact actions to a person, and cap the number of steps. Our team lead assistant can read code review and task data, but it must not comment, approve, merge, or create anything. It prepares drafts and recommendations, and the lead decides. For coding agents in an old codebase, Addy Osmani divides the code into zones, and the idea carries over to business systems: green areas where the agent works freely, yellow areas it changes only after tests pin down how they behave today, and red areas, such as billing, permissions, and payroll, where a person checks every step. In his words, “A person draws the map, not the agent.”
- Launch to a small group and widen it. Start with one team or a share of requests, read the traces of wrong results every week, and add each one to the test set. Give new powers in stages, the way Cloudflare introduces a new standard: its AI reviewers first only flag violations of it, and block a merge only after the standard is promoted to “enforced.” An agent can first propose an action and take it alone only after its proposals have held up. Judge progress by how often people step in, which errors reached production, and which actions had to be rolled back, rather than by how many tasks the agent touched.
Risks and how to limit them
The main risks are an agent that can do more than its task needs, instructions hidden in the content it reads, errors that add up over several steps, costs that grow with every extra step, a model that its provider retires, and no clear owner for what it produces. The first four are limited before launch, by how the agent is built, and the last two after launch, by the saved test cases and a named owner.

- Too much power: The OWASP Top 10 for LLM applications calls this excessive agency and names three root causes: “excessive functionality; excessive permissions; excessive autonomy.” Its example: an extension that summarizes email only needs to read it, so it should not be able to send or delete messages.
- Hidden instructions: An email, a document, or a web page can contain text written to steer the model. OWASP lists prompt injection as the first risk on the same list and says it is unclear whether any method prevents it fully. So build the agent on the assumption that some of that text will get through: what it reads must not give it tools or permissions it does not already have, and any action it proposes goes through the same approval rules as any other action. The risk is not theoretical: in 2025 Microsoft fixed EchoLeak (CVE-2025-32711), a prompt injection in Microsoft 365 Copilot that needed no click from the user.
- Errors that add up: Anthropic warns that agent autonomy brings “higher costs, and the potential for compounding errors,” and recommends testing in sandboxed environments. The agent should check each tool result before the next step, and a test run should not touch live data. A failure can also look like success: Nango, which runs API connections to hundreds of services, reports that when a permission policy is missing, Workday and Dayforce answer with no data and no error at all. An agent that reads “nothing found” there will act on it, so its tools should tell an empty result from a failed call.
- Loops and cost: An agent that keeps retrying pays for model usage on every attempt. Anthropic mentions stop conditions “such as a maximum number of iterations,” and OpenAI's guide suggests handing the task to a person when the agent passes a set limit of retries or actions.
- A retired model: A hosted model has an end date. Anthropic's deprecation policy promises at least 60 days' notice for publicly released models, and after the retirement date “requests to retired models fail.” OpenAI lists the shutdown dates of its models on its deprecations page. A newer model can follow the same instructions differently, so the switch is a release of its own: run the saved test cases on the new model, fix the instructions where its results differ, and plan this work every time a model your agent uses is announced for retirement.
- No clear owner: Name one person on your side who owns the agent after launch and does the weekly review of wrong results from step 7. At Ronas IT, the person who uses an agent makes the decision and is responsible for it. Your company answers for what the agent tells customers: in February 2024, a Canadian tribunal held Air Canada liable for a refund rule its website chatbot made up.
“Don't judge an agent by its first week. Its first instructions are a draft, and it gets better only when someone reads its wrong answers and fixes the instructions, again and again. If nobody on your team will do that, the agent stays as good as its first demo.”
Roman Surikov, CEO at Ronas IT
What a custom AI agent costs
At Ronas IT, an agent whose systems already have APIs starts at $4,000 for the analysis phase and the build together, or at $3,000 for the build alone. The analysis phase is optional; we recommend it before the build, and it ends with a scope document, a budget, and a timeline. The table shows our starting prices for the parts of such a project and when each one applies.
| What you need | When it applies | Starting price | Timeline |
|---|---|---|---|
| Analysis phase: use cases, technical feasibility, architecture review, scope, budget, and timeline | Optional, recommended before the build | $1,000 to $2,000 | At least 1 week |
| AI integration: a custom agent connected to your systems and the tools your team works in | For the agent build itself | From $3,000 per AI feature | At least 1 week |
| Backend and API: a new API for one of your systems | If a system the agent must use has no API and you choose to add one | From $2,500 | At least 2 weeks |
| Support: monitoring, fixes, and updates of the live app or system the agent runs in | After launch, if you choose this monthly plan | From $1,000 per month for one app, from $2,000 for a web app with its mobile apps | Ongoing |
If you add a new API to one system first, the analysis phase, the API, and the build together start at $6,500. Project management and testing are part of each of these prices. If people need a new screen to review and approve the agent's actions, its design is included in the $3,000, and building it is quoted in the estimate. For a narrower task, an AI chatbot that answers questions and qualifies requests can replace the agent, also from $3,000 and at least 1 week. Our guide to AI development cost breaks these prices down.
After launch you also pay for hosting and for model usage. Usage grows with the number of tasks, the steps in each task, and the amount of text sent to the model at each step. With an open model on your own servers, the usage fee becomes the cost of those servers. Setting them up is a DevOps job estimated by its scope, and hosting and monitoring them starts from $200 per month.
What to do next
Find your row in the table of situations above: rules, a platform, or a custom agent. If it is a custom agent, start with steps 1 to 4 of the build: one task measured as it is done today, the decisions split between code and the model, a map of the systems and access, and a test set of anonymized or synthetic cases with their correct outcomes.
First published 2025-08-17 by Roman Surikov, CEO at Ronas IT. Rewritten by Evgeny Leonov.
Frequently Asked Questions (FAQs)
What is a custom AI agent?
It is software in which a language model itself picks what to do next in a task: it reads the request, decides which of your systems to check or update, and stops when the task is done or a person has to decide. It works with your company's data and tools, and written limits say which actions it may take on its own.
Is a custom GPT the same as an AI agent?
Not quite. According to OpenAI's documentation, custom GPTs let users customize ChatGPT with instructions, attached documents, and connections to third-party services. OpenAI is moving custom GPTs to plugins, which are also used inside ChatGPT. A custom agent runs inside your own product or systems, under your access rules, with your own logs and tests.
What is the difference between an AI agent and a chatbot?
A chatbot answers questions. An agent also acts: it can look up an order, create a ticket, or prepare a refund for a person to approve. Many business projects need something in between, where the model drafts the answer or sorts the request and fixed code does the rest.
Do I need to train my own AI model for an agent?
Usually not. An agent can use a ready-made model through an API, or an open model on your own servers, and get your company knowledge through instructions, tools, and search over your documents. Training your own model makes sense when the task is a prediction from your own data, such as demand or churn. At Ronas IT, a custom machine learning model trained on your anonymized or synthetic data starts at $15,000, with project management included.
How secure is a custom-built AI agent?
As secure as the limits around it. The agent should use its own account with the smallest set of permissions, call only narrow tools, and ask a person before any payment, deletion, or message to a customer. Assume that hidden instructions in the content it reads may get through. That text must not be able to give the agent new tools or permissions, and any action the agent proposes goes through the usual approval rules. Every tool call should be logged, so each action can be traced back to the request behind it.
How long does a custom AI agent take to build?
At Ronas IT, one agent connected to your systems takes at least 1 week, and a larger scope with more tools and approval steps takes longer. The analysis phase we recommend before it adds one week or more, but it is optional. Work runs in sprints of usually one to three weeks, each with a result you can review.
How much does it cost to build an AI agent?
At Ronas IT, a custom agent for your systems is priced as one AI feature and starts at $3,000, and so does a narrower assistant that answers questions and qualifies requests. With the optional analysis phase we recommend before the build, an agent whose systems already have APIs starts at $4,000. Design, project management, and testing are part of these prices. After launch you also pay for model usage and hosting.
How do you measure whether an AI agent works?
Measure it against a set of real past cases with known correct outcomes, before launch and after every change. In production, track how many tasks it finishes without help, how often people correct it, how long a task takes, and what a task costs in model usage. Agree on the target for each number before the launch to a small group.





