An AI agent isn't a chatbot with a nicer prompt. It's an autonomous worker that perceives context, makes decisions, takes actions in your real systems, and knows when to hand off to a human. Get the architecture right and it becomes your most consistent sales rep — one that never forgets to follow up.
The anatomy of a production sales agent
Every reliable agent we deploy has the same five layers. Skip any one of them and the agent feels impressive in a demo but falls apart in production.
- Perception — pulls context from your CRM, calendar, and conversation history.
- Reasoning — an LLM decides the next best action given goals and guardrails.
- Tools — concrete actions: book a meeting, enrich a lead, send a follow-up.
- Memory — short-term conversation state plus long-term account history.
- Escalation — a confidence threshold that routes hard cases to a human.
Define the job before the prompt
The biggest mistake teams make is starting with the prompt. Start with the job description instead. Write down exactly what a great human SDR would do, what they're allowed to decide, and when they'd escalate. Your system prompt is just that job description, formalized.
A minimal agent loop
Under the hood, an agent is a loop: observe state, choose a tool, execute, observe the result, repeat until the goal is met or escalation triggers. Here's a stripped-down version of the control loop we use.
type AgentState = {
goal: string;
context: LeadContext;
history: Message[];
};
async function runAgent(state: AgentState) {
for (let step = 0; step < MAX_STEPS; step++) {
const decision = await reason(state); // LLM picks the next action
if (decision.action === "escalate" || decision.confidence < 0.6) {
return handoffToHuman(state, decision.reason);
}
if (decision.action === "complete") {
return finalize(state, decision.summary);
}
// Execute the chosen tool and feed the result back into context.
const result = await tools[decision.action](decision.args);
state.history.push({ role: "tool", name: decision.action, result });
}
// Safety net: never loop forever.
return handoffToHuman(state, "max_steps_reached");
}MAX_STEPS guard and the confidence < 0.6 check are non-negotiable.Chat, voice, or both?
Choosing a channel
Guardrails that keep you out of trouble
Before you go live
- Agent identifies itself as an AI when asked
- Hard limits on discounts, promises, and commitments
- PII is handled per your privacy policy
- Every conversation is logged and reviewable
- Low-confidence or upset leads escalate instantly