Principle:42 evey Hermes plugins Trace Retrieval
| Knowledge Sources | |
|---|---|
| Domains | Observability, Memory_Consolidation, Trace_Analysis |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
A retrieval pattern that queries an observability platform for recent conversation traces, extracting input/output summaries to feed into memory consolidation pipelines.
Description
Trace Retrieval is the first stage of memory consolidation. It queries the Langfuse traces API for conversations within a time window (default 24h), retrieves up to 20 traces, and extracts brief summaries in the format "{name}: {input} -> {output}" (truncated to 150 chars each). These summaries provide the raw material for fact extraction.
The pattern handles:
- Authentication: Basic auth with public/secret API keys from environment variables.
- Input/output extraction: Traces may have structured input (message arrays) or output (choice arrays); the extraction handles both, falling back to string truncation.
- Fail-safe: Returns
["Memory consolidation unavailable"]on any error, allowing the pipeline to continue without crashing.
Usage
Use this principle when building systems that need to learn from past LLM interactions. The trace summaries serve as raw material for downstream fact extraction. Requires an observability platform (Langfuse) with tracing enabled.
Theoretical Basis
The retrieval pipeline:
Failed to parse (syntax error): {\displaystyle \text{traces} = \text{Query}(\text{from\_timestamp}) \to \text{summaries} = \text{Extract}(\text{traces}[:20]) }
# Abstract pattern (NOT real implementation)
def retrieve_traces(hours_back=24):
from_ts = now() - hours_back * 3600
data = http_get(f"{LANGFUSE_HOST}/api/public/traces?fromTimestamp={from_ts}",
headers=basic_auth())
summaries = []
for trace in data["data"][:20]:
inp = extract_content(trace.get("input"))
out = extract_content(trace.get("output"))
summaries.append(f"{trace['name']}: {inp[:150]} -> {out[:150]}")
return summaries
The 20-trace limit balances coverage with processing cost. The 150-char truncation keeps summaries compact for the downstream LLM prompt.