Skip to main content

Agent Knowledge

Your agent's AI answers from its knowledge bases: your prices, opening hours, policies and product details. With the Public API you can keep that knowledge in sync with the system where it already lives, so the agent never answers from yesterday's price list. Everything lives under /v1/agents/{agentId}/knowledge-bases.

How does knowledge reach the AI?​

Each knowledge base is a named block of text linked to one or more agents. When you add, replace or remove one, Mojeeb rebuilds the AI context of every agent that uses it in the background, so new answers reflect the change usually within a minute. See Knowledge base for how it works in the dashboard.

How do I add knowledge?​

POST a name and the text. It is linked to the agent and the AI starts using it.

curl -X POST https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/knowledge-bases \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "name": "Opening hours", "content": "We are open Sunday to Thursday, 9:00 to 17:00 Cairo time.", "tags": ["hours"] }'

For the size limits, see the Create knowledge base reference. Knowledge size counts toward message usage: up to 40,000 words of active knowledge on an agent, each AI reply is one message; up to 80,000, two; and so on. See Knowledge base.

How do I keep a knowledge base up to date?​

PUT the new name and content to replace them. Send tags only when you want to change them.

curl -X PUT https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/knowledge-bases/KNOWLEDGE_BASE_ID \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "name": "Opening hours", "content": "From November we open on Saturdays too, 10:00 to 14:00." }'

A nightly sync from your own system is a good fit: read your source, then replace the matching knowledge base. The list endpoint returns names and ids without the content, and Get knowledge base returns one with its content.

Content comes back exactly as stored, so an entry last saved in the dashboard's editor returns as HTML. To decide whether to replace, compare your source with what you last sent (for example a hash you keep), not with the returned content, or simply replace it every time.

What happens when a knowledge base is shared?​

One knowledge base can serve several agents, and a change reaches all of them. A key may change or delete it only when it can act on every agent that uses it. Otherwise the API returns 403 shared_with_other_agents and nothing changes. This stops a key made for one agent from rewriting what another agent says.

Common questions​

How do I stop the AI using a knowledge base?​

Delete it. The API has no on/off switch for knowledge, because the AI reads every knowledge base linked to the agent.

Can I upload a PDF or Word file?​

Not through the API yet. Upload documents in the dashboard, where Mojeeb extracts their text. The API takes text, which most systems can export directly.

Why does some content come back as HTML?​

The API returns content exactly as stored, which is what the AI reads. Content sent through the API, typed when adding knowledge in the dashboard, or extracted from an uploaded document is plain text. An entry last saved from the dashboard's edit dialog is stored as the editor's HTML: paragraph, list, bold and italic tags, with characters such as the ampersand written as HTML entities. Send plain text. The dashboard shows content as rich text, so text shaped like an HTML tag, such as a placeholder in angle brackets, doesn't appear there and is lost if someone edits the entry in the dashboard.

What does delete remove?​

The knowledge base itself, from every agent that uses it. It is subject to the same shared-knowledge rule as replacing.

How long until the AI uses my change?​

Usually within a minute. The rebuild starts as soon as the change is saved and runs in the background.