How to build an AI agent
In Publicus an agent is a flow. You build it from the same nodes you use everywhere else: an Agent node does the reasoning, and the nodes you connect to it become its tools, its memory, its trigger, and its reply. This guide walks the whole loop — set up → test → monitor.
There is one runtime: the flow. A plain flow handles a message per run (the agent remembers earlier turns through memory). For agents that must pause mid-task or act proactively, build the flow around a Signal/Await loop — same engine, no special mode.
The quick start: New agent
Section titled “The quick start: New agent”Open Agents, press New agent and choose how to start:
- Describe it to the AI builder opens the builder in a new conversation, with a first message ready for you to send. It asks who the agent is for, where it talks and what it may do on its own, then sets it up with you from the template that fits.
- Customer agent: your customers talk to it. It answers from what you give it, changes only what you allow, and keeps within a budget per conversation.
- Team assistant: your colleagues talk to it. It knows what the team shares, and keeps what each person tells it for that person.
- Personal assistant: it works for you alone. See A personal assistant.




A template opens on a setup list that says what is left and links to where you do it; reopen it with Set up on the agent’s card. The setup list also opens the agent’s flow, and so does the agent’s name on its card. When nothing is left, press Open chat and talk to it the way its users would.


A customer agent
Section titled “A customer agent”You get a ready flow: a chat, an agent that only reads, a conversation memory, a budget per conversation, and a Toolbox with one entry left to fill: the knowledge it answers from.
To let customers reach it from a chat app, press Connect a channel on its card: paste your Telegram bot’s token (from @BotFather), or pick a Discord or Slack connection the workspace already has. Its messages then start the agent, and the agent answers in the chat. The setup list says whether each channel reaches it; one added after you published the agent needs publishing again.


To let customers email it, choose Email and pick a mailbox under Services → Mailboxes that the platform can send from: a Publicus inbox, a connected Microsoft or Google mailbox, or one with SMTP settings. For people to write to the agent at a Publicus inbox, switch on its New mail setting. The agent then answers each email as a reply in its thread, from the mailbox it arrived in, and remembers the thread as one conversation. Choose whether it sends its answers or saves them as drafts for someone to check and send (drafts need a Microsoft or Google mailbox). Two steps appear after the agent on its canvas: Only for email, which lets only an email through (not a chat, and not an automatic reply such as an out-of-office), and Answer by email, the reply itself, whose wording you can change.




Everything it starts with is an ordinary setting you can change, which the rest of this guide explains.
A team assistant
Section titled “A team assistant”You get the same shape for colleagues: a chat, an agent that asks before it changes anything, a conversation memory per person, a Toolbox with one knowledge entry to fill, and a Team memory.


-
What holds for everyone goes in its brief. On the Memory page, press Write a brief and use the tag
brief/team. The assistant can also propose additions there for you to keep or drop.

-
What a colleague tells it is kept for that colleague, and recalled only in that colleague’s conversations. It knows who is writing in the app’s chat, Telegram, Slack, Discord and email.
-
Give it one channel. A colleague who writes from Slack and from Telegram is two people to it.
Coming from OpenClaw
Section titled “Coming from OpenClaw”If you ran an assistant on OpenClaw, the builder can set it up here from its workspace. Zip the workspace’s text files and attach the zip in the builder. In a new conversation, Bring an agent from OpenClaw or Hermes words the request and opens the file picker for you:
cd ~/.openclaw && zip -r openclaw.zip workspace openclaw.json -i '*.md' '*.json'A file can be up to 8 MB, which a workspace’s text files rarely reach; a whole folder with its scripts and history usually does. A .tar.gz or .tar works as well as a zip. To bring scheduled jobs along, add openclaw automations list --all --json > automations.json to the zip. The keys in openclaw.json are in the zip already; to bring the ones in your .env too, zip it as well: zip -r openclaw.zip workspace openclaw.json .env -i '*.md' '*.json' '*.env'.
Publicus cleans the zip before the builder sees it. It keeps the persona, rules, memory, skills, notes and scheduled jobs as one document, or as a few parts when the workspace is long, so that the builder reads each one whole. It leaves out credential files, and every key or token in the text is replaced with [redacted]. The builder then starts the template that fits and carries the rest over: the assistant itself proposes what belongs in its brief and records what it should remember, and you keep or drop each proposal on the Memory page. Your keys come along only if you ask, as Bring your keys along describes.
Coming from Hermes Agent
Section titled “Coming from Hermes Agent”If you ran an assistant on Hermes Agent, the builder can set it up here from its home folder. Zip the files the import reads and attach the zip in the builder:
cd ~/.hermes && zip -r hermes.zip SOUL.md profile.yaml config.yaml memories skills cron/jobs.jsonFor a named profile, run the same command in ~/.hermes/profiles/<name>, or attach the .tar.gz that hermes profile export <name> writes. Each profile is its own assistant, so attach one archive per profile. zip warns about any file your home does not have, and that is fine. To bring your keys along, add .env auth.json to the command.
Publicus cleans the zip before the builder sees it. It keeps the persona, the memory, the scheduled jobs, the names of your settings and the skills you or your assistant wrote. It leaves out your keys and tokens, your past conversations, and the skills that ship with Hermes. The builder then starts the template that fits and carries the rest over the same way as an OpenClaw import: the assistant proposes its own brief and memory, and you keep or drop each proposal on the Memory page. Your keys come along only if you ask, as below.
Bring your keys along
Section titled “Bring your keys along”When the archive holds keys (a .env, the keys in openclaw.json, or the API keys Hermes keeps in auth.json or its config.yaml), the builder lists them under the attached file with Move its keys into this workspace. Tick it, and when you send the message Publicus puts each key straight into the workspace’s vault:
- A key for a service Publicus connects with a key alone, such as GitHub, Notion or Linear, becomes a connection.
- A Telegram, Discord or Slack bot token becomes a secret, which you pick when you connect the channel.
- Any other key becomes a secret.
The builder sees each key’s name and where it went, never its value. Nothing already in the workspace is replaced. Which keys, and where each would go lists them before you send.
A key for an AI model provider, such as OpenAI or Anthropic, is kept as a secret unless you also tick Pay this workspace’s model calls with those model keys. That makes it the key every call to that provider from this workspace is billed to, your colleagues’ calls included, so leave it off in a workspace you share. You can make it the workspace’s key later under AI models.
Leave the box unticked and the keys stay behind: the builder asks for each one it needs, on a card.
Sign-ins such as Gmail and Google Calendar never move, because your old assistant used them through your own Google app. The builder helps you connect them again here.
A personal assistant
Section titled “A personal assistant”For an assistant that works for you alone, open Agents, press New agent and choose Personal assistant. A workspace holds one: when it has one already, the choice says so and opens its setup instead. You get three flows that share a table and a few settings:
- Assistant talks to you in Telegram and in the app’s chat. It can look things up, and it asks you before it changes anything.
- Assistant heartbeat wakes every 15 minutes from 07:00 to 23:00 and works through your Standing orders. It messages you only when an order has something to report.
- Assistant inbox sorts the mail that reaches your mailbox. For a mail worth answering it sends you the reply it would write, in Telegram, for you to edit and send or skip. A reply you have not answered within two days is kept as a draft in your mailbox.
The setup list walks you through the rest:
-
Use a workspace only you are in. Every member of a workspace can read what its assistant reads and remembers.
-
On the assistant’s card, press Connect a channel, choose Telegram and paste your own bot’s token (from @BotFather).
-
Turn on Approvals for that bot, so you can answer the assistant’s questions with a button in Telegram.
-
Link your Telegram account with Use from a chat app on the AI builder page. A button you press counts only from a linked account.
-
Press Fill in. It tells the assistant your Telegram chat and your time zone, and lets the heartbeat and the inbox write to you through your bot.
-
Set your workspace’s time zone on the Schedules page if you have not.
-
Choose the mailbox the inbox reads. Use a connected Microsoft or Google mailbox: only those can keep drafts.
-
Tell it who you are in its brief: on the Memory page, press Write a brief and use the tag
brief/assistant. You can also tell the assistant and keep what it proposes there.

-
Switch on the heartbeat’s and the inbox’s triggers when you are ready.
Standing orders are rows in the Standing orders table. Each has a title and instructions. It runs either every so many minutes (every_minutes) or once a day at a time of yours (at_time, such as 07:30). Fill in neither and it runs once, which makes it a reminder. Two orders come with it: a heartbeat checklist every 30 minutes and a morning brief at 07:30. The assistant can add orders itself when you ask it to, after you approve.
To pause the heartbeat, set assistant_paused to 1 under Key-value.
1. Add the Agent node
Section titled “1. Add the Agent node”Create a flow and add an Agent node (the picker groups it under AI). Configure:
- Model: your LLM (OpenAI, Anthropic, Gemini, Ollama, Mistral, Groq, xAI). Picking a model sets its Provider; the form asks for the provider only when the model does not say which.
- Credential: leave it empty to pay with the workspace’s key for the provider, set on the AI models page. To pay with another key, pick a secret holding it, or a saved connection.
- Instructions: who the agent is and how it should behave.
- Message: the user’s message, usually from the trigger:
{{ $start->payload->message }}.
Max steps and Approval mode follow. Files to read, the shape of the answer and the budgets are under More settings, and the options for a chat app’s bot under Chat app; both open when you click them.
The agent emits its reply under content.


2. Give it tools (your APIs and resources)
Section titled “2. Give it tools (your APIs and resources)”An agent is only as useful as what it can do. Any node that implements the tool contract can be attached to the agent’s TOOL handle, and the model calls it when it decides to. Useful tools:
-
Rest / OperationandOpenApi / Operation— call your business APIs. -
Database / Selectand the storage nodes (KeyValueStore,TableStore) — read and write your data.

-
Rag / VectorStore / Query— answer from a knowledge base. -
Channel / *— let the agent send a message itself.
Wiring a tool: connect the tool node’s OUTPUT to the agent’s TOOL handle (the violet wrench at the left of the Agent node’s bottom edge). To let the model fill a tool’s parameters, use a {$fromAI:name:description:type} directive in that node’s field — the model supplies the value at call time.


Or pick them from a list: add a Toolbox node, wire it to the agent’s TOOL handle, and add a row per thing the workspace already has. One Toolbox holds as many as you like:
- A flow — the agent runs it as a tool and reads what it returns.
- An MCP server — all of its tools, or only the ones you choose.
- An API — an OpenAPI, SOAP, GraphQL or OData schema you imported, all of it or chosen operations, signed in with a connection or a secret.
- Knowledge — a knowledge base the agent can search.
- A table — the agent can find rows; switch on May change things to let it add and change them too.
Each row has When to use it, a sentence for the agent, and Ask before it runs. For a flow, the agent reads that sentence after the flow’s own Description, so describe what the flow does on the flow and say here when this agent should use it. May change things decides whether a Read-only agent may use that row’s tools to change something (see Keep a public agent small). Running a flow counts as a change.


3. Give it memory
Section titled “3. Give it memory”Add a Chat Thread node to the canvas (find it under AI in the node picker) and connect its output to the agent’s MEMORY handle (the stacked discs on the Agent node’s bottom edge, between the wrench and the chip). This makes conversation history a visible, composable part of the flow.


Configure the Chat Thread node with a stable per-conversation identity:
- Channel: required. The channel the conversation comes from (
discord,slack,telegram, etc.), or{{ $start->channel }}for an agent behind a chat app. - Conversation: a unique key for this conversation, e.g.
{{ $start->threadId }}from a chat trigger. - User: optional. Scope the thread further to a specific user.


Use stable values so each turn of the same conversation loads the same history. Conversation history is stored in a chat thread you can inspect later.
Chat Thread is not the only memory node. The MEMORY handle also accepts a Governed node (durable facts, constraints, and decisions, recalled by relevance each turn and reviewable by a human) and a Summary node (rolling per-turn summaries recalled into the system prompt). You can attach more than one. See memory for how each layer works.
4. Add a trigger
Section titled “4. Add a trigger”How the flow starts:
- Webhook or
Webhook / Chat— start on an inbound HTTP request / chat message. Webhook / Telegram— a Telegram bot message.- Schedule — run the agent on a cron (for proactive or batch work).
5. Send the reply
Section titled “5. Send the reply”An agent connected to a chat app with Connect a channel, or behind a Discord or Slack bot under Chat apps, needs no step for this: the bot posts the answer in the conversation the message came from. Otherwise, add a Channel / * send node and wire Agent → Channel/*, setting the message to {{ $prev->content }}. See connecting an agent to a chat channel for Slack, Discord, Teams, Telegram, and WhatsApp.
6. Test it
Section titled “6. Test it”Click Run by hand on the flow page. When the flow asks for input, Publicus builds a form from it, so you can run the agent without crafting a request by hand. A flow that a trigger starts and that asks for nothing offers its start data under Start data instead, filled in with an example of what the trigger sends, for you to change. Watch the canvas: the Agent node streams its tokens live, and node states update as the run progresses.




7. Monitor it
Section titled “7. Monitor it”Start on the agent’s card under Agents. Its badge says whether the agent works, in the words the Flows list uses, such as Working, Failing or Quiet; hover over it to see why. Under the agent’s name you see when it last ran and how many runs it has, and the count opens those runs.
The card also lists where people reach the agent: Chat in Publicus, and each Discord or Slack channel, mailbox and Telegram bot you connected. (off) follows one whose trigger is switched off, so it does not reach the agent until you switch it on. A channel or mailbox that has stopped working, or has heard nothing for two weeks, carries a badge saying so; select its name to open its page. A chat block on a portal page is not listed, but its conversations count in the agent’s runs.
Monitor opens the agent’s own conversations. It appears once the agent has had one.
For a single run, read its run report: open the run from the Runs panel beside the flow’s canvas, or from the card’s runs count. The report shows a per-node timeline with each agent turn nested under the Agent node, tokens streaming live while the run is active, token totals, previews of every tool call, and what memory the agent recalled and recorded. Pending human approvals can be decided with Approve / Deny directly on the report, and a Re-run action starts the flow again with the same input.






For the conversation itself, open the agent’s chat thread to review the transcript — every message with its role, content, token usage (in/out), and any tool calls — plus a running total of tokens used. This is where you confirm the agent recalled context, called the right tools, and answered correctly.


8. (Optional) Expose it to other AI clients
Section titled “8. (Optional) Expose it to other AI clients”Mark the flow as an MCP tool so external AI clients can invoke your agent as a tool.
Keep a public agent small
Section titled “Keep a public agent small”An agent anyone can write to, such as a support bot on Telegram, needs limits a person at a keyboard does not:
-
Read-only, with only the changes you chose. See Let a Read-only agent make one kind of change.


-
Most tokens one conversation may use per day, under More settings. Past it, the agent’s next turn in that conversation gets your Reply when the budget is spent instead of a model call. It needs a chat memory node, which is what tells one conversation from another. Write the reply in your customers’ language; the default is a short English sentence.


-
The workspace’s daily AI token limit applies to every agent. A conversation past it gets the same reply; an agent with no conversation (a scheduled or pipeline run) fails its step and names the limit.
Both limits are checked before a turn starts, never halfway: a turn already under way, and an agent a running flow calls as a tool, always finishes.
Related
Section titled “Related”- Llm / Agent — the Agent node reference.
- Connect an agent to a chat channel.
- Offer a flow to MCP clients through MCP access.
- Scheduling · Data storage · Secrets.