Add memory

Enable memory on an agent and ground calls with the memory placeholder

Memory lets an agent recall durable facts about a caller across calls. For how it works, see Memory.

1

Enable memory on the agent

Toggle memory in the console, or PATCH the agent:

PATCH
/v1/agents/:id
1curl -X PATCH https://api.speechify.ai/v1/agents/id \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{}'

memory_retention_days caps retrieval and the nightly cleanup; 0 means no cap.

2

Reference the placeholder in the prompt

Add {{memory}} where you want the facts grounded. The retrieved block is already a numbered list, so keep the surrounding prompt short.

You are a support agent for Acme. Speak concisely.
{{memory}}
Greet the caller, confirm what they need, and escalate only if you can't resolve it in one turn.

With memory disabled, the placeholder is stripped — no literal braces reach the LLM.

3

Pass a stable caller identity

Memory pivots on caller_identity, taken from the LiveKit participant identity:

  • Console test calls and authenticated SDK starts → user_<firebase-uid>, set for you.
  • Public widget → pass user_identity yourself (a stable ID such as a hashed email).
1<speechify-agent
2 agent-id="agent_01H..."
3 user-identity="acme_user_42">
4</speechify-agent>

The widget’s user-identity attribute becomes the caller_identity on every memory — see Embed. Anonymous sessions — no user-identity — skip memory.

4

Verify it end to end

  1. Give the agent a prompt containing {{memory}} and enable memory.
  2. Place a test call and state something durable — “I can only do mornings; I’m vegetarian.” Hang up.
  3. On the conversation detail page, Memories written this call lists the facts within about ten seconds.
  4. Call again as the same caller and ask an open question — the agent should use the fact without re-asking.

Manage memories

$# List a caller's memories
>curl https://api.speechify.ai/v1/agents/$AGENT_ID/memories \
> -H "Authorization: Bearer $SPEECHIFY_API_KEY"
>
># Delete every memory for one caller
>curl -X POST https://api.speechify.ai/v1/agents/$AGENT_ID/memories/delete \
> -H "Authorization: Bearer $SPEECHIFY_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{"agent_id":"'"$AGENT_ID"'","caller_identity":"acme_user_42"}'

Troubleshooting

Confirm {{memory}} is literally in the prompt. Without the placeholder, facts are stored but never injected.

The caller must be identified. Anonymous widget sessions (no user_identity) aren’t recorded — check the conversation’s caller_identity (empty means anonymous).

Retrieval has a 0.5 confidence floor. Lower-confidence facts show in the admin list but never enter the {{memory}} block.

Both calls need the same caller_identity. A widget embed that passes a different userIdentity counts as a different caller.

Usually fine — the extractor emits zero rather than invent filler, so mundane calls often produce none.