Content · AI Agents

How to create an AI agent that survives production

Architecture, tools, memory, evaluation and cost: the technical path of an agent that leaves the prototype and becomes a system.

12 min readIntermediaryTechnical founders, CTOs and engineering leadsUpdated September 2026

An AI agent is not a big prompt. It's a control loop: a model decides which tool to call, the system executes the call with explicit privileges, the result returns to the context and the loop continues until a stop condition. Everything that separates a demo from a production system is outside the model — in the tools, the limits, the observability, and the budget per run.

Executive summary

  • Start with the tool inventory, not the prompt.
  • Treat each tool call as an API call with its own authorization.
  • Without automated eval, any model switch is a gamble.
  • Cost per execution is an architectural requirement, not an end-of-month report.

1. Decide whether the case requires an agent or pipeline

Agent is expensive in latency, cost and failure surface. Before writing the first line, check whether the problem has real decision ramifications. If the flow is always A then B then C, you want a deterministic workflow with one or two LLM calls inside it — not an agent.

The practical criterion: if you can draw the complete flowchart without using the word "it depends", you are not an agent. An agent is justified when the number of possible paths is too large to code and the cost of making mistakes is recoverable.

  • Pipeline: data extraction, classification, summarization, batch enrichment.
  • Agent: triage with follow-up, support that queries multiple systems, iterative search, operations that require verification before writing.

2. Model the tools before the prompt

Agent capabilities are exactly the set of functions that you expose. Each function needs typed schema, description written for the model (not pro dev), input validation, and readable errors — the model reads the error message and tries again, so a "500 Internal Server Error" wastes an entire cycle.

Separate reading from writing. Reading tools can be released; writing tools go through confirmation, idempotency key and audit log.

Tool schema with validation and readable error
const buscarPedido = {
  name: "buscar_pedido",
  description:
    "Retorna status, itens e prazo de um pedido. Use quando o cliente citar número de pedido.",
  parameters: z.object({
    pedidoId: z.string().regex(/^\d{6,10}$/),
  }),
  handler: async ({ pedidoId }, ctx) => {
    const pedido = await db.pedido.find(pedidoId, { tenant: ctx.tenantId });
    if (!pedido) {
      return { erro: "Pedido não encontrado para este cliente. Peça o número novamente." };
    }
    return pick(pedido, ["status", "itens", "prazoEntrega"]);
  },
};

3. Choose the control loop

Three topologies cover almost everything. Single agent with tools solves 80% of cases and is what you should try first. Orchestrator with specialized sub-agents is useful when domains have prompts and tools that are incompatible with each other. Explicit state graph is valid when the process has mandatory auditable steps.

In any topology, impose an iteration ceiling, timeout per tool and global timeout. A homeless loop agent is an incident awaiting date.

4. Memory: context, session and knowledge

Confusing the three types of memory is the most common cause of expensive and confusing memory. Context is the current call window and should be mounted, not accumulated. Session is the state of the conversation, saved in the bank and summarized when it passes a limit. Knowledge is what the agent seeks on demand via retrieval.

For knowledge, RAG with embeddings solves semantic search in documentation; direct SQL query solves structured data and is cheaper, faster and auditable. Many people put what should be a SELECT in a vector.

  • Context: system prompt + last N messages + round tool results.
  • Session: persisted history, rolling summary, entities already identified.
  • Knowledge: pgvector for text, relational database for facts, cache for what repeats.

5. Guardrails and security

Treat all model output as untrusted input. The agent can be tricked by content they read — an email, a page, a customer PDF — into calling tools you didn't intend. The defense is not a better prompt, it is authorization in the handler.

Each call loads the tenant and user from the execution context, never arguments from the model. Data scope is resolved on the server. Destructive operations require human confirmation or go through an approval queue.

  • Never accept tenantId, userId or role as a tool parameter.
  • Rate limit per session and per account, not just global.
  • PII filter in log entry and what is sent to the provider.
  • Kill switch per tool, activatable without deployment.

6. Evaluation: what separates engineering from trial and error

Without an evaluation set, you cannot change models, adjust prompts or reduce costs without risk. Assemble 30 to 100 real cases with expected results, run in CI with each change and monitor three metrics: task success, correct choice of tool and average cost per execution.

For open-ended output, use a judge template with written rubric and weekly human sampling. Don't chase 100%: set the acceptable threshold and fallback behavior below it.

7. Cost and latency as a design requirement

Agent cost grows non-linearly: each iteration reloads the entire context. Two levers solve most of this — reduce what goes into context and route by complexity, with a small model in triage and a large model only when the task requires it.

Measure cost per conversation resolved, not per token. It is the only metric that compares to the cost of the manual process that the agent replaces.

  • Prompt cache for stable system prompt.
  • Streaming for latency awareness, with tools in parallel when independent.
  • Spending cap per session, with controlled degradation instead of a surprise bill.

8. Operation: observability and rollout

Each execution needs a complete trace: messages, tools called, arguments, latency, tokens and outcome. Without this, debugging agents becomes archeology.

Climb with small scope and clear escape path. An agent who passes the baton to a human when he is unsure generates more trust than one who answers anything with conviction.

Frequently asked questions

+Framework or own implementation?

For the first agent, a loop of about 200 lines on top of the provider's API is usually easier to debug than a framework. Frameworks pay off when you need multiple agents, state checkpointing, and resumption of long executions.

+Which model to choose?

Choose based on tool calling quality and compliance with instructions, not based on general benchmarks. Keep the provider layer abstracted and the evaluation suite ready: the answer changes every few months.

+How long does it take to put an agent into production?

An agent with a well-defined scope, with two to four tools, usually goes from zero to production in four to six weeks, including evaluation and observability. What extends the deadline is integration with the legacy system, not the AI ​​part.

+Can you use sensitive data?

Yes, with appropriate design: scope per tenant resolved on the server, redaction of PII before leaving your infrastructure, zero retention agreed with the provider and auditable log. In more restricted cases, an open model is run in its own infrastructure.

Want to discuss this architecture for your product? Get 30 minutes with our technical team, free of charge.

Talk to an engineer

OUR FACTORY

Inside our factory

Everything you need to build, maintain and automate real software, under a single team.

01 · Agents

Custom AI agents

Agents trained on your business knowledge to qualify leads, support customers and operate 24/7.

  • LLMs + your own data
  • WhatsApp, Web and API
  • Wired into your CRM
02 · Build

MVPs from zero to launch

From validation to delivery. Modern, scalable architecture designed to grow with your business.

  • Discovery + Design + Dev
  • Modern stack (React, Node, Cloud)
  • Go-live in weeks, not months
03 · Run

Web application support

Maintain, evolve and scale products in production with a dedicated squad, clear SLAs and zero headaches.

  • Dedicated monthly squad
  • Monitoring + fixes
  • Continuous evolution roadmap
04 · Automate

Process automation

We connect systems, remove manual work and give hours back to your team to focus on what matters.

  • SaaS-to-SaaS integrations
  • Workflows with n8n / Make
  • Measurable ROI

Behind the scenes

Behind every delivery, a team standing shoulder to shoulder with founders.

Moments from the Acelerabit team alongside founders and clients turning ideas into live products.

Why Acelerabit

Builder-first. No theatre.

An engineering team that ships real product. No agency layers, no middlemen, no rework.

7+ years accelerating startups

Real experience building MVPs and SaaS for founders. We know what to cut to validate fast without burning runway.

Our own BITLAB method

A protocol that structures every project from discovery to deploy, with real-time visibility into each delivery.

We build our own products

We're a software house that is also a product owner. We know how to build because we live it every day in our own SaaS.

The BITLAB Method

Precision engineering, from brief to deploy.

01

Discovery

We map business, users and metrics, then define the minimum viable scope.

02

Design

Technical architecture and UX prototyped before the first line of code.

03

Build

Short sprints, weekly releases and continuous feedback through our own tool.

04

Launch

Deploy, monitoring and post go-live tuning. Ready to scale.

Stories and products

Accelerated stories.

Products we built from scratch, maintain and scale, including our own AI agent.

Loopilot

Powered by Acelerabit

It qualifies. You only step in to close.

WhatsApp support + CRM + AI in one platform. Tailored by our team and ready to run in your operation. True omnichannel, conversation memory across channels, 24/7.

Result

Qualified leads in seconds, no queue and no opportunity lost outside business hours.

Explore Loopilot
Loopilot interface showing AI conversations
Alcance AI agent architecture: WhatsApp support flow
Alcance logo

AutoTech · AI for sales

Alcance

Digital transformation of an ecosystem with 4,000+ motorcycle salespeople in Brazil. Today AI sits at the heart of their support and sales.

Projects together

  • AI agents for support and sales: AI applied to inbound support, sales, prospecting and reactivation. 24/7, at scale.
  • 4,000+ salespeople ecosystem: A nationwide community of motorcycle salespeople supported by the agents and flows we built together.
  • Internal process automation: Where the relationship started: efficiency in operational and administrative routines.
Multimentoring interface: corporate mentoring program
Erlich logo

Corporate mentoring

Erlich

Organizational mentoring products used in day-to-day operations. Peer matching, development tracking, assessments and session records, all in one place.

Projects together

  • Multimentoring: Started as internal automation to unblock operations and became an end-to-end organizational mentoring platform.
  • Mentor Pilot: Boosts mentee outcomes and gives mentors real visibility.
QVende interface: hiring pipeline kanban
QVende logo

HR Tech · Sales recruiting

QVende

A recruiting platform for sales teams. Fit-based screening, stage kanban and full candidate management, from résumé review to final decision.

Projects together

  • QVende: Sales recruiting and selection in a living kanban.
  • Currículo Express: An AI agent that generates ready-to-send résumés in minutes.
  • Jobs portal: White-label version running at CREA-RN.

Other projects

FinTech · Personal credit

Kredia

A startup in the banking correspondent space on a mission to industrialize personal credit sales. We built several AI agents specialized in credit products that work the closing stage and help reps convert more deals.

AI

HealthTech · Corporate wellbeing

LifeSprint

A corporate healthtech producing health reports by hand, spreadsheet by spreadsheet. We automated the journey with custom questionnaires, reducing illness and raising quality-of-life scores at scale.

Startup

FinTech · Financial education

Bolo no Bolso

A financial education app we inherited from another shop that needed maturity to scale. We ran an end-to-end optimization, added more intelligence to the product and support the active customer base using it today.

Startup

HealthTech · Fundraising and management

Liga Contra o Câncer

A leading oncology institution that had to unblock fundraising and finance at once. Our discovery produced a gamified fundraising model based on physical activity, and an on-demand squad then built the finance system.

Consulting

HealthTech · School health

Bud Saúde

A school-health startup that needed operational muscle for its nursing and medical team. We built the platform that structures student health tracking and management in the school's daily routine.

Startup

AgroTech · Management BI

Baraúna Soluções Biológicas

A biological-solutions manufacturer for agriculture running its entire operation in Excel. We led the end-to-end digital transformation, planning the ecosystem and delivering a web platform, mobile app and management dashboard that supports decisions at the mills.

ConsultingInternal automation

Testimonials

The founders who accelerated with us say it best.

Founders and operators who trusted their products to Acelerabit and built real businesses.

The Acelerabit team understood not just the problem we posed, but the entire business. The project turned out fantastic!

Marcelo Bandiera

Marcelo Bandiera

CEO · QVende

Let's build

Let's design your next step.
Free strategy session.

A 30-minute conversation with our engineering team to understand your product, validate scope and map the shortest path to results. No strings attached.

Book your strategy session

No forms, no waiting. Talk straight to our engineering team on WhatsApp and pick a time.

Book a strategy session

Typical reply within minutes