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

# Bring your own model

> Keep your own language model for replies while Priors stores and recalls memories

## Example use case

Your sales agent or inbound support line already runs on your own model, system prompt, and tool-calling loop. You want Priors to handle continual memory extraction and retrieval while your model stays in control of tone, tool execution, and output format.

## Setup

Create an agent and thread as usual, then select the recall verb that matches your learning policy:

* Call [POST`.../observe-and-recall`](https://www.sapientpriors.com/docs/api-reference/v2/threads/learn-and-recall) when the agent should learn from the message (sales agent or team assistant).
* Call [POST`.../recall`](https://www.sapientpriors.com/docs/api-reference/v2/threads/recall-memories) when the agent should only read memory (inbound support line).
* Inject the returned `memories` into your model's system prompt alongside the user message.
* When your model's reply includes commitments or answers future turns depend on, send it back via [POST`.../observe`](https://www.sapientpriors.com/docs/api-reference/v2/threads/learn-messages-or-files) with `speaker` set to your assistant's name.

## Benefit with Priors

* **Full model control:** keep your preferred LLM, latency budget, structured outputs, and custom tools.
* **Structured recall:** each recalled item is the turn it was made from, with its `text`, `timestamp`, `speaker`, `speaker_id`, and `metadata`, so your prompt reasons cleanly over who said what and when.

## What goes wrong

> [!WARNING]
>
> Calling `observe-and-respond` and passing its finished answer into your own model pays for two generations and asks your model to rewrite an existing answer. Conversely, using `observe-and-recall` without sending critical assistant replies back via `observe` leaves the agent remembering what users asked but not what your assistant promised.

## Recommendation

Use `observe-and-respond` or `respond` when Priors should answer end to end. Choose `observe-and-recall` or `recall` when you already run your own model, and explicitly `observe` assistant replies whenever future turns need them.

## Calls used

* Guides: [Answering](https://www.sapientpriors.com/docs/concepts/answering.md), [Walkthrough 2: bring your own model](https://www.sapientpriors.com/docs/walkthroughs/bring-your-own-model.md)
* API reference: [Learn and recall](https://www.sapientpriors.com/docs/api-reference/v2/threads/learn-and-recall.md), [Recall memories](https://www.sapientpriors.com/docs/api-reference/v2/threads/recall-memories.md), [Learn messages or a file](https://www.sapientpriors.com/docs/api-reference/v2/threads/learn-messages-or-files.md)


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