AI AgentsTelegramSupportTutorial

How to build an AI support agent, step by step

Nine minutes of video and the written version: create the agent, connect it to Telegram, give it tools, test it safely, and watch it answer in the Inbox.

Written by: Joel FereiraReviewed by: Jennifer VillalobosSeptember 22, 20269 min read
View as Markdown
8:52Watch on YouTube

Chapters

The video runs eight minutes and fifty-two seconds and ends with an agent answering messages on a real channel. It is not a demo against a mock: the agent is wired to a Telegram bot, it replies, and the conversations land in the Inbox like any other.

This is the written version, with what a video cannot pause to say: what each field decides, what gets billed, and the exact point where an agent stops answering and a person takes the conversation. The narration is in Spanish; the steps below are the whole thing in English.

What you end up with

  • An agent with a name, a goal and a prompt, created from the dashboard.
  • A Telegram bot connected and activated, receiving and replying.
  • Tools declared: what the agent is allowed to do against your systems.
  • A way to test it without messaging a customer.
  • An Inbox where you read the conversations and can step in yourself.

If you have never built one and want the mental model first — what an agent loop is, what separates it from a chatbot — start with how to build an AI agent and come back.

1. Create the agent

In the dashboard: Agents → create agent. The dialog asks for two things and nothing else.

Name. You will see it in the metrics, in the Inbox and in the logs. "Support" is enough.

Goal. A plain-language description of what it should do. This becomes the first draft of its prompt, so write it the way you would explain the job to someone starting tomorrow: which questions it answers, in what tone, and what is not its call.

Senders are connected afterwards. A freshly created agent is attached to no number and no bot, and that separation is deliberate: one agent can serve several senders, and a sender answers with one agent at a time.

2. Configure it

This is where the agent stops being a name. The agent screen holds the prompt and the switches that decide when it wakes up.

FieldWhat it decidesThe part that matters
System promptHow it answers and what it never doesThe only place your policy lives. If you do not write it, it does not exist
ModelWhich engine reasonsWith the zavu provider you do not need to bring your own API key
Context windowHow many previous messages it seesBetween 1 and 50. More context is more coherence and more cost per reply
Trigger channelsWhere it answersAn agent triggering on a channel its sender does not have answers in the playground and nowhere else
Message typesText, image, audioText only by default

Two sentences in the prompt are worth more than everything else: what it does when it does not know, and what it must never promise. An agent that invents a delivery date with total confidence is not a model problem. It is a design decision nobody made.

3. Connect Telegram

In Accounts you connect the bot: talk to @BotFather on Telegram, send /newbot, and paste the token it gives you. Zavu stores it encrypted, registers the webhook, and the bot starts receiving.

Three things worth knowing before they surprise you:

Connecting is not activating. A newly connected account arrives inactive and every send on it is refused until you switch it on. Activation is what counts as a channel connection against your plan.

Telegram identifies people by a numeric chat ID, not by @username. A bot cannot message someone who never opened a conversation with it. You message the bot once, and its reply carries the ID.

Telegram has no 24-hour window and no templates to get approved. That is why it is the right channel for a first agent: two minutes and you have a real channel to test on. WhatsApp is where the volume eventually lives, and it brings business verification and the 24-hour window; the same agent works on both, you change the sender. If that is your destination, the WhatsApp guide covers what it adds.

4. The tools

A model with no tools can talk about your return policy. A model with a lookup_order tool can tell a customer where their package is. Nearly all of a support agent's value lives there.

A tool is four things: a name, a description — which is what the model reads to decide whether to call it — the parameters as JSON Schema, and an HTTPS URL of yours that receives the call.

terminal
curl -X POST https://api.zavu.dev/v1/agents/AGENT_ID/tools \ -H "Authorization: Bearer $ZAVU_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "lookup_order", "description": "Returns the status and estimated date of an order by its number.", "webhookUrl": "https://api.yourstore.com/zavu/orders", "parameters": { "type": "object", "properties": { "order_id": { "type": "string", "description": "Order number, e.g. ORD-12345" } }, "required": ["order_id"] } }'

The response carries a webhookSecret once and never again. Zavu signs every call to your endpoint with it, in the X-Zavu-Signature header: an HMAC-SHA256 of the body. Verify it before trusting the call, or anyone who guesses your URL can ask your backend for order data.

The description is the tool's prompt. "Looks up orders" gets it called when it should not be; "Returns the status and estimated date of an order by its number" tells the model when yes and when no.

5. Test it before a customer does

There are two ways and they do different things.

The Playground runs the agent and shows you the reply without sending anything to anyone. It is where you iterate the prompt. One detail that matters: by default it does not execute the tools, because executing them has real side effects, so the model says which one it would call and stops there. There is a switch to run them for real when you want to exercise the whole loop. A reply that sounds like "I have checked your order" with tools off is an invented reply, and that confusion has cost more than one debugging session.

The Sandbox lets you message the agent over WhatsApp or SMS from Zavu's own numbers, from the phone of someone on your team. It is the same path a real message takes.

And from the API, to put it in CI:

terminal
curl -X POST https://api.zavu.dev/v1/agents/AGENT_ID/test \ -H "Authorization: Bearer $ZAVU_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "message": "Where is my order ORD-12345?", "executeTools": true }'

The response carries warnings: things that are true of this agent and that a dry run cannot prove. That the agent is disabled, for instance, or that it triggers on channels its sender does not have. Read them before calling the setup done.

6. Real conversations, and when it goes quiet

With the bot live, every conversation lands in the Inbox with its full history. You see what the agent answered, and you can answer yourself.

The handoff to a person works exactly like this: when a handoff opens, the agent stops answering. Not the contact's next message, not the one after that. The conversation waits in the Inbox. When someone on the team replies, the thread goes back to the agent for whatever follows, so the silence is not permanent.

It is worth stating precisely, because the earlier version of this did not do it: the agent marked a status, nobody was notified, and the bot kept talking over the person it had just promised.

What gets billed, and what does not

  • Telegram, WhatsApp, Instagram and Messenger share one monthly message allowance, and it counts both directions: what you receive spends exactly like what you send.
  • Zavu does not charge delivery on Telegram. What you pay for is the active channel connection, monthly, according to your plan.
  • The model is billed per token. The Agents screen shows executions, tool calls, tokens and cost per agent; a 50-message context window shows up in that column.
  • SMS, voice and email are billed separately, per message or per minute.

When this stops being enough

This route — dashboard, prompt, tools, Telegram — is the right one for a support agent that answers questions and looks data up. It stops being enough when the agent needs logic that does not fit in one webhook per tool: rules spanning several systems, queues, retries, state between conversations.

At that point the agent is declared in code and deployed as a function, with defineAgent and defineTool, and it still shows up on the same screens. Same agent, written differently. And if you would rather your coding agent write it, that is a whole workflow of its own.

What does not change on either route: an agent is worth what its tools are worth, and it only works on the channel where your customers are already typing.

Frequently asked questions

How long does it take to build an AI support agent in Zavu?
Under ten minutes to have it answering on Telegram: create the agent with a name and a goal, connect a bot with the @BotFather token, activate it and test it. Tools against your own systems take however long those endpoints take to write.
Do I need to write code to build the agent?
No. The agent, its prompt, its tools and the channel are all configured from the dashboard. Code only appears on the tool side: each tool calls an HTTPS URL of yours, which you implement and which must verify the X-Zavu-Signature header.
Why Telegram and not WhatsApp for a first agent?
Telegram needs a bot token and two minutes, with no business verification and no approved templates. WhatsApp adds verification and the 24-hour window. The agent is the same on both: connect it to another sender when you move volume to WhatsApp.
What happens when the agent cannot resolve a question?
If the conversation is escalated to a person, the agent stops replying entirely and the thread waits in the Inbox. When someone on the team answers, the agent picks the following messages back up. There is no moment where both are typing over each other.
Does the agent execute its tools when I test it in the Playground?
Not by default. The Playground reports which tool it would call and stops, because executing them has real side effects. A switch runs them for real. A reply claiming it looked something up with tools off is an invented reply.

Need help? Contact us or join our Discord community for support.

Get started

Ready to get started?

Start building for free, or schedule a call to discuss your specific use case.

How to build an AI support agent | Zavu Blog