Skip to main content
The SDK offers two ways to wire xysq memory into your LLM calls:
  1. XysqAgent — a turn-based wrapper that handles memory retrieval and capture automatically on every chat() call
  2. Tool calling integrations — expose xysq operations as LLM tools (function-calling), letting the model decide when to capture and recall

XysqAgent

XysqAgent wraps any LiteLLM-compatible model. On every chat() call it:
  1. Runs the configured context strategy to fetch relevant memories
  2. Injects retrieved context into the system prompt
  3. Calls the LLM
  4. Optionally captures the exchange
Memory persists across instances — a fresh XysqAgent in a new session will have access to everything captured by previous sessions.

Context strategies

A context strategy controls what memory context is injected into each turn’s system prompt.

Custom strategy

Implement the ContextStrategy protocol — any callable with this signature:
Example — adaptive strategy:

XysqAgent parameters


Tool calling integrations

Tool calling lets the LLM decide when to invoke memory operations — you pass the tool definitions to your LLM call, execute any tool calls the model returns, and feed results back.

LiteLLM

Anthropic

Available tools

Both integrations expose the same five tools to the LLM: To file an external source (link, quote, code snippet), the model calls xysq_capture with source tags, the same as any other memory.

Examples


Memory operations

Full reference for capture, surface, and synthesize

Team Vaults

Scope agent memory to a shared team vault