Runtime ingestion is asynchronous. The SDK call returns immediately with an
ingestion_id. The content is processed in the background, and memories become available for retrieval shortly after.How it works
The runtime ingestion flow integrates naturally into your agent’s conversation loop:Your agent receives a user message
The user sends a message to your agent through your application’s interface — a chat widget, API, mobile app, or other channel.
Your agent retrieves context from Synap
Before generating a response, the agent calls Synap to fetch relevant memories and context. This step is covered in detail in Agent Interactions.
Your agent generates and delivers a response
The agent calls an LLM with the retrieved context and conversation history, generates a response, and sends it to the user.
Your agent ingests the conversation turn
After the response is delivered, the agent calls
sdk.memories.create() to ingest the conversation turn. This call returns immediately — it does not block the user experience.The SDK call
The core SDK method for runtime ingestion issdk.memories.create():
Parameters
| Parameter | Required | Description |
|---|---|---|
document | Yes | The text content to ingest. For conversations, include both user and assistant messages with speaker labels. |
document_type | Yes | The type of content being ingested. Determines how Synap processes the document. |
user_id | No | The user this content belongs to. Determines user-scope storage. |
customer_id | No | The customer organization. Determines customer-scope storage. |
mode | No | Ingestion mode: fast or long-range. Defaults to fast for runtime ingestion. |
document_id | No | Unique identifier for idempotency. Prevents duplicate ingestion on retry. |
document_created_at | No | Timestamp override. Defaults to current time for runtime ingestion (usually correct). |
Document types
Synap supports a range of document types, each with specialized extraction logic:| Document Type | Description |
|---|---|
ai-chat-conversation | Chat conversations between a user and an AI agent. The most common type for runtime ingestion. |
document | General text documents, articles, or notes. |
email | Email content including headers and body. |
pdf | PDF document content (text extracted). |
image | Image descriptions or OCR-extracted text. |
audio | Transcribed audio content. |
meeting-transcript | Meeting transcriptions with multiple speakers. |
Ingestion modes
Runtime ingestion supports two processing modes that control the depth of extraction:- Fast mode
- Long-range mode
Optimized for speed. Best for real-time chat logging where low latency matters more than extraction depth.Use fast mode for: routine conversations, high-throughput workloads, non-critical context.
Scoping
Theuser_id and customer_id parameters determine where the memory is stored in the scope hierarchy. This directly affects who can retrieve the memory later.
The typical agent loop
Here is how runtime ingestion fits into a standard agent conversation loop:Best practices
Include speaker labels in conversation content
Include speaker labels in conversation content
Always format conversations with clear speaker labels (
User: and Assistant:). Synap uses these labels to correctly attribute statements to each participant, which improves the quality of stored memories.Use consistent user and customer IDs
Use consistent user and customer IDs
Ensure that
user_id and customer_id are consistent across all ingestion calls for the same user and organization. Inconsistent IDs fragment the memory store, creating isolated pockets of context that cannot be retrieved together. Derive these IDs from your application’s auth system.Use fast mode for routine real-time chat
Use fast mode for routine real-time chat
For standard conversational turns,
fast mode provides the best balance of speed and extraction quality. Reserve long-range mode for high-value conversations where deep extraction justifies the additional processing time.Ingest after the response is delivered
Ingest after the response is delivered
Always ingest the conversation turn after your agent has responded, not before. This ensures the ingested content includes both the user message and the agent’s response, providing complete context for future retrieval.
Handle ingestion errors gracefully
Handle ingestion errors gracefully
Runtime ingestion should never block or crash your agent. Wrap ingestion calls in error handling and log failures for later investigation. A missed ingestion is recoverable; a crashed agent is not.
Set document_id for idempotent retries
Set document_id for idempotent retries
If you implement retry logic for failed ingestion calls, always set a
document_id to prevent duplicate memories. Derive the ID from your conversation or message identifier.Next steps
Bootstrap Ingestion
Load historical data in bulk before or alongside runtime operation.
Agent Interactions
The full retrieve-generate-ingest loop for memory-enabled agents.
SDK Ingestion Guide
Detailed SDK reference for all ingestion methods and parameters.
Fast Mode
Understand the tradeoffs of fast vs long-range ingestion modes.