Platform

Context Templates

Define exactly how your memories get formatted when passed to an LLM. Use markers to inject live data into any prompt structure.

What are Context Templates?

Context templates are configurable prompt blocks that define how Tellodb memories are formatted when sent to your LLM. Instead of receiving raw JSON, your agent gets a clean, readable paragraph or structured text block — tailored to your exact use case.

Templates use simple markers like %{facts limit=5} to inject live data from the engine. When a template is rendered, Tellodb queries the relevant memories and replaces each marker with the actual content.

Available Markers

MetricMarkerDescriptionParameters
%{facts}Top relevant factslimit=N — max results (default 10)
%{user_summary}Aggregated user profile factsNone
%{graph_neighbors}Connected entities from graphn=N — neighbor count (default 5)
%{temporal_range}Time-based memory filterdays=N — lookback days (default 7)
%{related_entities}Entity list from graph walkNone

All markers are optional. Unknown markers render as empty strings.

Usage

  1. Navigate to Settings → Context Templates in Mission Control.
  2. Click 'New Template', enter a name, and build your template string with markers.
  3. Or select a built-in preset (Compact, Conversational, Enterprise RAG) and customize it.
  4. Save the template. Use it by calling the /api/context/assemble endpoint with the template_id.
  5. Integrate the assembled context into your LLM system prompt via SDK or API.
Assemble context via API
curl -X POST https://api.tellodb.com/api/context/assemble \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "cluster_id": "YOUR_CLUSTER_ID",
    "template_id": "TEMPLATE_UUID",
    "query": "recent user activity"
  }'
Python SDK
from tellodb import MemoryClient

client = MemoryClient(api_key="sk-...")
context = client.context.assemble(
    cluster_id="cl_abc123",
    template_id="tmpl_user_profile",
    query="recent preferences"
)
print(context.context)
# Output:
# USER PROFILE
# - Alice is a vegetarian
# - Alice prefers outdoor activities
#
# RECENT FACTS
# - Alice went hiking on Saturday
# - Alice bought new hiking boots