# Agents (/docs/agents)
An agent is a job description plus what it is allowed to know. You write what it is for and how it should behave, give it documents to answer from, and choose a model. Kumoda runs it whenever a customer writes on a channel you connected.
## Starting points [#starting-points]
Open **Agents** to see your agents, or **Playbooks** for ready-made ones. A playbook opens the agent builder with the agent already filled in, and you can edit anything. The starting points are:
| Playbook | What it does, as the app describes it |
| --- | --- |
| WhatsApp enquiry responder | Answers common service questions from your documents and asks for missing details. |
| Follow-up drafter | You paste an enquiry; it drafts the reply and the next follow-up. |
| Payment reminder drafter | You paste an overdue invoice; it drafts a polite reminder, firmer each time. |
| Support reply drafter | You paste a customer message; it drafts a clear, kind reply. |
| Handover assistant | You describe how you do something; it turns it into steps your team can follow. |
| Writing partner | Drafts and tightens your messages, posts and emails in your voice. |
| Offer sharpener | Pushes on your offer: who it is for, the promise, the price, what is unclear. |
| Start from blank | Write your own instructions. |
The [Quickstart](/docs/quickstart) uses the first one.
## The builder [#the-builder]
The builder has five steps: **Purpose**, **Identity**, **Knowledge**, **Tools** and **Publish**. Changes are saved as a draft as you go.
### Purpose [#purpose]
One or two sentences on what the agent is for. It helps you and your team remember its job, and Flow and your other agents read it to know when to ask this agent (see [Flow](/docs/flow)).
### Identity: names, model and instructions [#identity-names-model-and-instructions]
- **Internal name**: only your team sees it.
- **Customer-facing name**: shown at the top of the chat window. Optional.
- **Opening message**: what the agent says first.
- **Instructions**: up to 4,000 characters. Write who the agent is, what it answers, and what it always does.
- **Rules it always follows**: short rules, up to 12, for example "Never state a refund amount". Rules are for the things that must never go wrong.
Kumoda also tells every agent to treat the results of tools as data, not as instructions.
### Models [#models]
Choose a provider, then a model. Each model card shows bars for speed, quality and cost (for cost, more bars means pricier). The Anthropic models offered are:
| Model | Described in the app as |
| --- | --- |
| Haiku 5.5 | Fast and light. Good for simple, repeated questions. |
| Sonnet 5.5 | The all-round choice for most agents. Marked as recommended. |
| Opus 5.5 | The strongest. For hard judgement, and the priciest. |
Which models you can pick depends on your plan: the builder shows what your plan includes. Other providers are listed too, and their models can be picked once Kumoda has that provider connected. You can change the model at any time, and lighter models use fewer credits. See [Plans, credits and billing](/docs/plans-and-credits).
### Knowledge: documents [#knowledge-documents]
Knowledge sources are what the agent is allowed to say. It searches them for factual questions and answers in its own words. If nothing matches, it says it does not have that to hand. Without any sources, the agent answers from its instructions alone.
You can add a source three ways:
- **Paste text**: a policy, FAQ or price list, up to about 200,000 characters.
- **Web address**: a public page or PDF. The address must start with `https://`. You can have Kumoda read it again later to pick up changes.
- **File**: PDF, Word (`.docx`), text, Markdown, CSV, JSON or HTML, up to 4 MB. A scanned PDF (pictures of pages) has no text to read.
You can edit the text of a source you pasted, and the agent answers from the new text straight away. Removing a source means the agent no longer answers from it.
Search is by shared words. Finding a passage that says the same thing in other words needs a setting on the Kumoda platform, which is shown in the app when it is not on yet.
### Knowledge: skills [#knowledge-skills]
A skill is a procedure for a particular job, such as handling a refund or a booking. The agent reads only each skill's name and when to use it, and opens the steps when a question calls for them.
Each skill has a **name**, **when to use it** (one sentence, up to 300 characters) and **steps** (up to 8,000 characters). An agent can have up to 10 skills.
### Knowledge: memory [#knowledge-memory]
Memory is what the agent keeps about each person it talks to, such as a customer on WhatsApp. Each person has their own memory, and it is never shared between people or agents.
- **Recent messages**: how much of the conversation the agent sees: nothing, or the last 5, 10 (the usual), 20 or 30 messages.
- **Keep a note about the person**: the agent writes down their name, what they want and what was promised, and reads it next time. This uses a little more of your credits on each message.
- **Find older messages by meaning**: lets the agent find something said long ago. It is available only when the platform has it switched on.
If long-term memory is not switched on for the platform, the agent sees only the recent messages it is handed, and the app says so.
### Knowledge: helpers and message screening [#knowledge-helpers-and-message-screening]
- **Helpers**: other agents in the same workspace this one may ask for help with part of a question, up to three. What a helper uses is billed to your credits like any answer.
- **Screen messages**: checks each message for attempts to talk the agent out of its rules. A message that tells the agent to ignore its instructions or reveal them is not answered, and the person gets a polite refusal. It adds a small check to every message (about a tenth of a cent of your credits). If the check itself cannot run, the message is still answered, so a problem with it never leaves a customer without a reply.
### Tools [#tools]
Tools let an agent look something up or do something. See [Tools and connections](/docs/tools-and-connections).
## Test before you publish [#test-before-you-publish]
Ask the agent what a real customer would, in the preview on the builder, and read the answers and the steps it took. A preview is a real model call and uses your credits. Nothing is sent to anyone.
You can also save questions as **Tests**, with what a good answer does. Run them against the saved draft before you publish a change. A member can keep up to five tests per agent, and each run uses credits.
## Publish, pause and versions [#publish-pause-and-versions]
The last step checks that the agent has a name, written instructions, a test in the preview, and at least one rule. **Go live** (or **Publish version N** after the first time) makes that version the one other systems get when they call the agent. It does not message anyone.
After that you can keep editing. Changes are tried in the preview and reach other systems only when you publish again. Each publish is a numbered version with an optional note, and **Restore** puts an older version back as a new one, so nothing is lost.
On the agent's page you can **Pause** and **Resume** it. A draft agent has **Turn on**. An agent's status (draft, live or paused) is separate from its channels: to stop customers being answered on a channel, use the **Answer on** switch for that channel under **Channels**, which pauses it. Deleting an agent removes the agent and its versions, and its past runs stay in the list.
The agent's page also shows its last seven days (runs, success rate, typical time, estimated cost), its recent runs, and **Run automatically**, which asks it the same question on a timetable. Anything an agent wants to change waits for your approval.
## Handover to a person [#handover-to-a-person]
On a customer chat (WhatsApp, the website chat window or the API) every agent has one tool, `request_a_person`. The agent calls it when the customer asks for a person, is upset, says the matter is urgent, or when it cannot help or is not sure. When it does:
1. The conversation becomes yours. The agent stays out of it until you hand it back.
2. The reason is recorded, and shown in **Conversations** as "Needs you".
3. You are emailed, and so is everyone else who works the workspace (its Admins and Members), unless each has turned handover alerts off in their own profile. If you have named who handles the channel, only they are alerted (and you, when nobody has taken the chat), and if the conversation is already assigned to someone, the alert goes to that person.
4. The agent tells the customer plainly that a person will reply.
In **Conversations** you can **Take over** at any time (without waiting for a handover), answer as yourself, **Hand back to agent**, **Resolve** and **Reopen**. A Viewer can read a conversation but not answer it. See [Team and workspaces](/docs/team).
Two more things to know:
- On the WhatsApp quick start, if you type in a chat yourself, the agent stays quiet in that chat for eight hours (or until you hand it back).
- On the official WhatsApp connection, Meta does not tell Kumoda when you reply from your own phone, so the agent cannot step back by itself. Pause the channel, or take over in **Conversations**.
When your credits run out, a customer who writes gets one short note that a person will reply, and the conversation is handed to you. See [Plans, credits and billing](/docs/plans-and-credits).
# API reference (/docs/api-reference)
Kumoda has one API you build on: the **API channel**. Your own system sends a customer's message to one of your agents and reads the reply. It is the same conversation as on WhatsApp or the website chat window, with the same credits and the same handover to a person.
The OpenAPI file is at [/openapi.json](/openapi.json). Import it into Postman, Insomnia or any OpenAPI tool.
The API channel is for servers. It gives no browser (CORS) access, so call it from your backend, not from a web page. To put a chat on a web page, use the [website chat window](/docs/channels#website-chat-window).
## Set it up [#set-it-up]
Create the connection in the app: **Channels**, **Add channel**, **API**, choose the agent, **Create the API connection** (see [Channels](/docs/channels#api-channel)). You get two things:
- the **address**, which has the form `https://agents.kumoda.io/api/v1/agents//messages`, where `` is the letter `a` and 24 lowercase hex characters, and
- the **secret**, which starts with `ksk_`. It is shown only once and only a hash is kept. **New secret** replaces it, and the old one stops working at once.
Every call carries the secret as a bearer token: `Authorization: Bearer ksk_…`. A wrong key and a wrong secret get the same answer, so neither can be guessed from it.
An agent has one API connection, and an account can have up to 10. A paused connection refuses new messages (503).
## Send a message [#send-a-message]
`POST /api/v1/agents//messages` with a JSON body.
| Field | Required | What it is |
| --- | :---: | --- |
| `contact` | yes | Your own id for the customer: 3 to 60 letters, numbers, dots, dashes, colons or underscores. Each contact is one conversation. |
| `text` | yes | The customer's message. Over 4,000 characters is refused (413). Only the first 1,500 characters are given to the agent. |
| `name` | no | The customer's name, up to 80 characters. |
| `email` | no | The customer's email. Ignored if it is not a valid address. |
| `phone` | no | The customer's phone number, up to 30 characters. Only digits, `+`, spaces, brackets and dashes are kept. |
| `messageId` | no | Your id for this message (up to 64 letters, numbers, dots, dashes, colons or underscores). Sending the same one again is not answered twice, so a retry is safe. |
| `wait` | no | Seconds to wait for the reply, up to 25. The default is 20. Use `0` to return straight away and read the reply later. |
Give an `email` or `phone` and the customer becomes a contact in Kumoda.
```bash
curl -X POST https://agents.kumoda.io/api/v1/agents/YOUR_KEY/messages \
-H "Authorization: Bearer YOUR_SECRET" -H "Content-Type: application/json" \
-d '{"contact":"customer-123","text":"Hi, are you open today?","name":"Ada","email":"ada@example.com"}'
```
The message is saved before the call answers. The answer is a JSON object with a `status`:
| `status` | Meaning |
| --- | --- |
| `replied` | The reply is in `reply`. `from` says who wrote it (`agent` or `human`), and `id` is its message id. |
| `pending` | No reply yet (the wait ran out). Read it with `GET`. |
| `duplicate` | This `messageId` was already sent. Nothing new was saved. |
| `with_a_person` | A person has taken the conversation over, so the agent will not answer. |
```json
{ "status": "replied", "reply": "Yes, we are open until 6pm today.", "from": "agent", "id": 1042 }
```
## Read a conversation [#read-a-conversation]
`GET /api/v1/agents//messages?contact=customer-123&after=0`
Returns the contact's messages after a message id, oldest first, up to 100. Pass the largest `id` you have seen as `after` to read only what is new.
```json
{
"messages": [
{ "id": 1041, "from": "customer", "text": "Hi, are you open today?", "at": "2026-11-12T09:30:02.114Z" },
{ "id": 1042, "from": "agent", "text": "Yes, we are open until 6pm today.", "at": "2026-11-12T09:30:05.870Z" }
]
}
```
`from` is `customer`, `agent` or `human` (a person from your team).
## Errors and limits [#errors-and-limits]
Errors are a JSON object with a message: `{ "error": "…" }`.
| Status | When |
| --- | --- |
| 400 | A field is wrong or missing (for example `contact`, `text`, `messageId`), or the body is not JSON. |
| 401 | The key or the secret is wrong. |
| 404 | The address is not an API channel address. |
| 405 | A method other than `POST` and `GET`. |
| 413 | The text is over 4,000 characters, or the request body is over 16,000 bytes. |
| 429 | More than 120 requests a minute on this connection (sending and reading share it). |
| 503 | The connection is paused or not connected. |
Beyond these:
- Every reply uses your credits. When credits run out, the agent stops answering and a short note goes to the customer (see [Plans, credits and billing](/docs/plans-and-credits)).
- Each conversation is answered at most 6 times a minute and 150 times a day. After that, messages are saved but not answered, and the channel shows a note.
- You can take over any conversation from **Conversations**. While a person has it, `POST` answers with `with_a_person`.
## The website chat window's endpoints [#the-website-chat-windows-endpoints]
The chat window is one small script that you paste into your site (see [Channels](/docs/channels#website-chat-window)). It talks to these routes, which are listed here so you can see what it does. They are for that script, and you do not need to call them yourself.
| Route | What it does |
| --- | --- |
| `GET /widget.js` | The script itself. |
| `GET /widget//config` | The window's title, greeting, colour, whether it asks for a name, and whether it is online. Public: nothing secret is in it. |
| `POST /widget//messages` | A visitor wrote. Takes `visitor` (a random 32-character hex id the script keeps in the visitor's browser), `text` (up to 1,000 characters), and optionally `name`, `email` and `phone`. Answers `{ "ok": true }`. |
| `GET /widget//messages?visitor=…&after=…` | The visitor's messages after an id, each `from` `visitor`, `team` or `agent`, with `human` (a person has the chat) and `online`. |
The `` here is a letter `w` and 24 hex characters. If you list **Websites that may show it** in the window's settings, a request from any other website is refused (403). A paused window answers 503.
Visitors are limited by address and by conversation, and a window has an hourly cap on messages. The numbers are kept inside the platform and may change, so build on the API channel above if you need to send messages yourself.
# Channels (/docs/channels)
A channel is where customers reach an agent. Open **Channels** and choose **Add channel**, or open an agent and add one there. Each channel is answered by one agent, and you can give a channel to another agent at any time from the list on the **Channels** page.
All channels share the same behaviour:
- Every answer uses your credits, and when credits run out the agent stops answering (see [Plans, credits and billing](/docs/plans-and-credits)).
- Every conversation shows under **Conversations**, and you can take over any of them (see [Agents](/docs/agents#handover-to-a-person)).
- The **Answer on** switch next to a channel pauses it. A paused channel does not answer.
- Each conversation is answered at most 6 times a minute and 150 times a day. Beyond that, messages are saved but not answered, and the channel shows a note.
| Channel | Good for | You need |
| --- | --- | --- |
| WhatsApp, quick start | Trying it in a minute, with any number | A phone with WhatsApp |
| WhatsApp, official | Staying within WhatsApp's terms | A Meta Business account and a number registered for the platform |
| Website chat window | Customers on your site | Access to paste one line into your pages |
| API | Your own app, backend or form | A server that can make HTTPS requests |
## WhatsApp [#whatsapp]
Choose how to connect. You can switch later: disconnect one and connect the other.
If your plan does not include a WhatsApp number, the WhatsApp card says so and offers **See plans**. The number of WhatsApp numbers is set by your plan; the website chat window and the API do not count against it.
### Quick start (scan a code) [#quick-start-scan-a-code]
Scan a code to link a number, like WhatsApp Web. It works for any number, including one that has never been verified as a business.
WhatsApp can restrict numbers that send automated messages. Use a number you can afford to lose, not your only one.
On the agent's WhatsApp card, or under **Channels**, choose **Quick start**, then **Connect a number**.
On your phone open WhatsApp, then **Settings**, **Linked devices**, **Link a device**, and scan the code. You can link with a phone number instead: Kumoda shows a pairing code to enter. The code refreshes every few seconds, and the page notices when the scan works.
Send a message to your number from another phone. The reply, and the conversation, appear in the app.
What to know:
- It answers one-to-one chats only, never groups.
- If you type in a chat yourself, the agent stays quiet in that chat for eight hours, or until you hand the chat back.
- You can set the name, about line and photo customers see from the number's card. WhatsApp does not review these on a number linked this way.
- **Change connection key** replaces the secret in the address WhatsApp reports to. Use it if you think that address was seen by someone else. Messages keep arriving.
- **Pause** stops answering; **Disconnect** removes the link.
### Official WhatsApp Business (your own Meta app) [#official-whatsapp-business-your-own-meta-app]
This runs through your own Meta WhatsApp Business account, so your messages go through Meta's WhatsApp Business Platform under your account. It takes longer to set up: you need a Meta Business account and a number registered for the platform. Check Meta's current rules about using the same number in the WhatsApp phone app.
**1. Connect in Kumoda.** In your Meta app at developers.facebook.com, open **WhatsApp**, then **API setup**. In Kumoda choose **Official WhatsApp Business** and fill in:
| Field | Where to find it |
| --- | --- |
| Phone number ID | The long number under API setup, next to your phone number. Digits only. |
| Access token | A permanent token from a Meta system user with the `whatsapp_business_messaging` permission. A temporary token expires in a day. |
| App secret | In your Meta app, **App settings**, **Basic**. Kumoda uses it to check that a message really came from Meta. |
| WhatsApp Business Account ID (optional) | In WhatsApp Manager, next to your account name. Add it now, or later from a conversation, to send template messages after 24 hours. |
Choose **Connect with Meta**. Meta checks the details before anything is saved. The token and secret are encrypted and never shown again.
**2. One more step, in your Meta app.** Kumoda then shows a **Callback URL** and a **Verify token**:
In your app at developers.facebook.com, open **WhatsApp**, then **Configuration**.
Under **Webhook** choose **Edit**, and paste the Callback URL and the Verify token. Meta checks them as you save.
Subscribe to the **messages** field.
Send a message to your number from another phone. Replies appear in the app.
The verify token is shown only once. If you lose it, use **New verify token** to get another.
What to know:
- WhatsApp's 24-hour rule applies. You can write to a customer yourself within 24 hours of their last message. After that the conversation shows **Template needed**, and you can send an approved template message if you added your WhatsApp Business Account ID.
- Meta does not tell Kumoda when you reply from your own app, so the agent cannot step back by itself. **Pause** the channel when you want to take over, or take over in **Conversations**.
- The name and photo customers see are set in Meta's WhatsApp Manager, where Meta reviews them.
- If Meta stops accepting the token (it may have expired or been revoked), Kumoda says so. Disconnect, then connect again with a new permanent token.
## Website chat window [#website-chat-window]
A bubble on your website that opens a chat with the agent. It uses the same conversations, credits and handover as WhatsApp.
Under **Channels**, choose **Add channel**, then **Website chat**, and pick the agent.
Set how it looks and who may use it:
- **Title** (up to 40 characters), **Colour**, and the **First message the visitor sees** (up to 200 characters).
- **Websites that may show it**: one address per line, like `https://yourshop.com`. Leave it empty to allow any site. Addresses must start with `https://` (plain `http://` is accepted only for `localhost`), and you can list up to 10.
- **Ask for the visitor's name first**.
Choose **Create the chat window**, then copy the line Kumoda shows and paste it just before `