> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentline.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge Store

> Mark an answer to be remembered so later callers get it at once, without a lookup.

# Knowledge Store

The knowledge store holds facts the hosted voice answers callers from. A
repeated question is answered at once instead of waiting on your agent or
being guessed.

## Set up

There is nothing to switch on. Every agent has a store, and it is empty until
something is saved to it. Save the answers callers ask for most (hours,
address, prices, policies):

```bash theme={null}
curl -X POST "https://api.agentline.cloud/v1/agents/agt_xxx/knowledge" \
  -H "Authorization: Bearer al_live_..." \
  -H "Content-Type: application/json" \
  -d '{"text":"Open Monday to Friday, 9 AM to 5 PM.","question":"When are you open?","kind":"static"}'
```

The hosted voice answers those questions itself from then on. Your agent can
do this for you: its skill file tells it to ask you for these facts during
setup.

## How it works

1. A caller asks something the hosted voice does not know. It asks your agent
   through [Agent Relay](https://docs.agentline.cloud/guides/relay.md).
2. Your agent answers. If the answer will still be true for the next person,
   it tags the answer `remember`.
3. On later calls the same question is answered from the stored fact, with no
   round trip to your agent.
4. Each fact has a maximum age: about a day when it changes, about a month
   when it is static. After that the question goes back to your agent, and
   its answer stores the fact again.

Your agent manages no keys and no expiry. A corrected fact replaces the old
one.

After an answer is remembered, the hosted voice answers that question itself
and no task reaches your agent for it.

## Remember an answer during a call

Add `remember` to the `done` push:

```bash theme={null}
curl -X POST "https://api.agentline.cloud/v1/calls/call_xxx/context?turn_id=turn_xxx" \
  -H "X-Push-Token: PUSH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"turn_id":"turn_xxx","disposition":"done","context":"Open Monday to Friday, 9 to 5.","remember":"everyone static"}'
```

| `remember` | Use for |
| - | - |
| `"everyone"` | True for any caller, and it changes: stock, prices |
| `"everyone static"` | True for any caller, rarely changes: hours, policies |
| `"caller"` | About this caller only: their appointment, order, preference |
| omitted | A failure, a one-off, or anything about someone else |

Or the agent ends its answer with one extra line instead. This is how it works
with the persistent relay, where the answer is plain text. The line is removed
and never spoken:

```text theme={null}
Open Monday to Friday, 9 to 5.
REMEMBER: everyone static
```

## Two kinds of fact

| | Knowledge facts | Contact facts |
| - | - | - |
| Holds | Products, prices, policies, hours | One person's appointment, order, preferences |
| Heard by | Every caller of the agent | Calls with that phone number only |
| Saved with | `"everyone"`, `remember_fact` | `"caller"`, `set_contact_fact` |

> [!WARNING]
>
> Never save details about one person as a knowledge fact. Every caller of the
> agent can hear knowledge facts.

Answers given on an owner's own call are never shared with other callers.

Both kinds belong to one agent. Your other agents, even on the same account,
do not see them.

Saving a contact fact with the same `key` for the same number replaces it. It
stays until changed or deleted. Up to 400 characters each, 50 per number.

## What the voice already knows about a caller

Nothing needs saving for this. On every call the voice sees, for that number:
the saved contact name and label, a short note on each of the last 3 calls
(90 days) and the last 8 texts (30 days). Your agent does not need to save
those as contact facts. A caller ID can be faked, so the voice treats this as
a hint, not proof of who is speaking.

## Outside a call

| MCP tool | Route | Does |
| - | - | - |
| `remember_fact` | `POST /v1/agents/{agent_id}/knowledge` | Save a fact. `text` is enough; add `question` so it is found more reliably |
| `search_knowledge_facts` | `GET /v1/agents/{agent_id}/knowledge/search?q=` | Search as a live call does. `would_answer` shows what a call would use |
| `list_knowledge_facts` | `GET /v1/agents/{agent_id}/knowledge` | List facts |
| `delete_knowledge_fact` | `DELETE /v1/agents/{agent_id}/knowledge/{key}` | Forget one fact |
| `set_contact_fact` | `PUT /v1/agents/{agent_id}/contact-facts` | Save one detail about a phone number |
| `list_contact_facts` | `GET /v1/agents/{agent_id}/contact-facts?phone_number=` | List a number's details |
| `delete_contact_facts` | `DELETE /v1/agents/{agent_id}/contact-facts?phone_number=&key=` | Forget one detail, or all without `key` |

```bash theme={null}
curl -X POST "https://api.agentline.cloud/v1/agents/agt_xxx/knowledge" \
  -H "Authorization: Bearer al_live_..." \
  -H "Content-Type: application/json" \
  -d '{"text":"Probiotic Plus bird gut powder costs $24.95.","question":"How much is Probiotic Plus?"}'
```

`question` is how a caller would ask. It is used to find the fact and is never
stored or spoken. During a call it is taken from the task automatically.

`kind` is `static` (hours, policies) or `changing` (stock, prices; the
default). One fact per save, up to 1,000 characters; up to 2,000 facts per
agent. The `key` that the delete route needs is in the save response and in
the list.

## What it does not do

* It does not answer from an expired fact, or from one that only loosely
  matches the question. Those questions go to your agent.
* It does not replace the relay. Live data and actions still go to your agent.
* It does not store what a caller said. Only what your agent looked up or did.

> [!NOTE]
>
> A `503` from a knowledge route means the store is switched off. Answers are
> still delivered to the caller.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.