- Save the user’s message to the session.
- Build a SIP.
- Call your model.
- Save the exchange.
- Classify the reply.
- Save a generated statement, when applicable.
- Save the AI response to the session.
session_id for every exchange in the same conversation. EDN creates the session the first time a new session_id is used.
To keep a conversation inside a project, send the same project_id to Build a SIP, Save a conversation turn, Classify an AI response and Save a generated statement.
1. Save the user’s message to the session
Use Add a message to a session to save the user’s message before building context. Send:role: Set touser.content: The user’s message, up to 100,000 characters.
2. Build a SIP
Use Build a SIP to retrieve the memory relevant to the user’s current message. Send:query: The user’s message.session_id: The conversation session.project_id: Optional. The project containing the conversation’s memory.
sip: The context text to place in the model’s prompt, ahead of the user’s message.grounded:truewhenproject_idwas supplied.citations: One entry per numbered item in a project SIP.
3. Call your model
EDN never calls your model and never answers questions for you. Place the returnedsip in your model’s prompt, ahead of the user’s message, and call your model as usual. EDN works with any model.
4. Save the exchange
After receiving the model’s reply, use Save a conversation turn to store the exchange as memory. Send:user_message: The user’s message.assistant_message: The model’s reply.session_id: The conversation session.project_id: The project, when applicable.
ROUND memory and returns its record_id.
EDN also checks the user’s message for new facts and corrections. When it saves a fact, the response includes a fact object containing:
record_id: The ID of the saved fact.replaces: The ID of the older memory it replaced, or null.
fact is null.
5. Classify the reply
Use Classify an AI response to check whether the model’s reply answered a factual question from the user. Send:user_message: The user’s message.assistant_message: The model’s reply.session_id: The conversation session.sip: The context returned in step 2.project_id: The project, when applicable.
sip to check whether specific facts in the reply are supported by the supplied context. Without it, factual claims cannot be verified.
When the reply answers a factual question and is supported by the SIP, EDN saves it as an AI_INFERRED memory. The response contains:
saved:true.provenance:AI_INFERRED.record_id: The ID of the saved memory.
AI_INFERRED memory is not used in SIPs until the user confirms it.
Otherwise, saved is false, and reason explains why:
not_an_answer: The reply does not answer a factual question from the user.abstention: The reply states that it does not know.unsupported_claim: A fact in the reply is not supported by the supplied SIP.
provenance is AI_GENERATED.
6. Save a generated statement
When Classify an AI response returnsAI_GENERATED as the provenance, you can use Save a generated statement to store the reply.
Send:
assistant_message: The model’s reply.session_id: The conversation session.project_id: The project, when applicable.
AI_GENERATED memory. This includes assistant output such as suggestions or drafts.
An AI_GENERATED memory is never used in a SIP until the user confirms it.
Saving a generated statement counts against the daily ingest quota.
7. Save the AI response to the session
Use Add a message to a session again to save the model’s reply to the session transcript. Send:role: Set toassistant.content: The model’s reply.
The complete loop
Next steps: See Build a SIP and Save a conversation turn for the API reference.
