How I Built my First AI Telegram Orchestrator Agent

Oct 06, 2025

Authored by Nate Herk, modified by Augmented AI

This AI agent is designed to do everything. It’s the foundation for a central system that can manage tasks across your entire business.

However, today, I’m going to show you how each component works, starting with the basic orchestrator agent in n8n.

This is part one of a series where we will build the ultimate AI agent. What we create here is the starting template. In the future, I plan to add specialized agents for Notion, article automation, and even sales lead generation to automate an entire sales team. This is the first step toward building a truly integrated and intelligent system.

The Telegram Interface: Your Command Center

 To start, I’ll execute the workflow. The first interaction happens through a simple Telegram bot. I chose Telegram because it provides a straightforward and accessible interface to communicate with our agent, but you can swap it out for Slack or MS Teams.

I’m not going to cover the basic setup for Telegram or Google Drive credentials, as there are many tutorials available online. However, for those who want a direct guide, I will have the full detailed instructions in our upcoming Corporate Automation Library (CAL), which will host the n8n code and steps required to get this running on your server. We plan on having over 100+ automations with 2–4 corporate automations uploaded weekly.

Getting back to the demo, I’ll send a message to the bot:

“what can you do?”

This message triggers a webhook in my automation platform, n8n. A quick technical note: I’m running this on a local Raspberry Pi. To make it accessible to a public service like Telegram, you need a tool like ngrok to forward your local IP address to a public one. If you are running your automations in the cloud, this won’t be an issue.

Once the message is received, the system captures my details — name, surname, and Telegram username — along with the prompt itself.

Designing the Agent’s Core Logic

The workflow immediately hits a switch node. This is a simple but critical component that directs traffic. Its logic is straightforward: if the input is a photo, it follows one path; otherwise, it sends the text directly to the AI agent.

If I were to send a picture, the workflow would:

  • Download the file.
  • Save it to a designated Google Drive folder.
  • Send it to the AI agent for processing.

This initial sorting mechanism is the first step in building a system that can handle diverse tasks without manual intervention.

The Orchestrator: The Manager of Your AI Workforce

 The core of this system is the orchestrator agent. You can think of it as the manager of a company. Its job isn’t to do the work itself but to understand the task and assign it to the right subordinate.

The prompt I use to define this agent is foundational. We will expand on it later, but the initial instructions are clear:

  • Role Definition: “You are the ultimate manager agent for Augmented AI. You are addressing Ritesh Kanjee, the founder. Your job is to help the user out with the task by using your tools to delegate the task to the correct tool.”
  • Setting Boundaries: “You should never be writing emails or creating summaries. Your sole responsibility is to use the correct tool.”

This second instruction is vital. We don’t want this manager agent doing specialized tasks. We want it to delegate to other agents that have the specific tools and context for that job. This prevents scope creep and ensures each component of our system is specialized and efficient.

To help the agent make these decisions, I’ve given it a specific tool: a think tool. The prompt for this is:

“Use the thinking tool when you feel stuck and need to think about what to do next.”

This gives the AI a built-in mechanism to reason through a request before acting, allowing it to figure out the best way to delegate the task properly.

For the model, I’m using a GPT-5 model via OpenRouter, which allows for flexibility in choosing from various providers, including free models if privacy is not a concern. It also includes a fallback model in case the primary large language model is unavailable, adding resilience to the system.

Finally, the agent has a simple memory with a context window of 50 messages. This acts as a buffer. Once the 51st message comes in, the first message is erased. The larger the context window, the more tokens you will use, so it’s a balance between memory and cost.

Logging: The Key to Measurement and Scale

After the agent processes the request, the workflow moves to a cleanup node and then to a logging step. This is where we track everything.

Previously, the common solution for logging was Google Sheets. This worked, but it was cumbersome. You had to set up the sheet, define the rows, and manage the connection. With the introduction of Data Tables in n8n, this process is now integrated and far more efficient.

My data table is structured to capture the essential information for every interaction:

  • ID and Timestamp: When did the interaction occur?
  • Input and Output: What was the user’s request and what was the agent’s response?
  • Actions Used: Which tools or other agents were triggered?
  • Token Consumption: How many tokens were used for the interaction?

Tracking token usage is especially important. If you plan to use an AI agent across your business, you need to understand its operational cost. This data allows you to measure the ROI of your automation efforts accurately.

If anything goes wrong during the process, an error path ensures a failure message is sent back to Telegram, so the user is never left without a response.

The First Response and The Road Ahead

After sending my initial message, here is the response I received from the bot:

“Ritesh, I am your ultimate AI manager agent from Augmented AI. I can coordinate, prioritize, and delegate across product, engineering, growth, ops, and hiring. Quick summary of my capabilities… tell me which one you want help with.”

This is a great response, but it’s aspirational. The agent can’t do most of these things yet. And that’s okay. We have successfully built the foundation — the manager. In the upcoming articles in this series, we will begin hiring its team by building out the specialized agents it needs to delegate tasks to.

Get this n8n template here

We have created the central nervous system. Now, we just need to connect the limbs which we’ll cover in this upcoming series.

 

From 80-Hour Weeks to 4-Hour Workflows

Get my Corporate Automation Starter Pack and discover how I automated my way from burnout to freedom. Includes the AI maturity audit + ready-to-deploy n8n workflows that save hours every day.

We hate SPAM. We will never sell your information, for any reason.