Skip to Content
ProductionAuto-extract observability

Auto-extract observability

AutoExtractMemory runs a small LLM extraction pass after every agent.run() to pull structured (subject, predicate, object) facts into the bi-temporal store. It’s on by default for real network adapters, which means it’s also on your bill. This page covers how to see when it fires and what it costs, and how to turn it off.

When it runs

Extraction runs in the background: agent.run() returns once the episode is saved, and the extraction call finishes afterwards. Before reading the facts a run just produced, and at shutdown so pending extractions aren’t lost, wait for it:

from loomflow import Agent agent = Agent("...", model="gpt-4o", memory="sqlite:./bot.db") await agent.run("I'm Alice and I live in Tokyo.", user_id="alice") still_running = await agent.aclose(timeout=30) # 0 = all extractions finished facts = await agent.memory.facts.query(user_id="alice")

aclose() doesn’t close the memory backend, and the agent stays usable. You don’t need it before agent.memory.forget(...): forget stops the extractions of the episodes it erases itself (from 0.17.3; see GDPR ops).

Telemetry signals

Two signals are emitted when Agent(telemetry=...) is wired:

MetricTypeTagsUse
loom.auto_extract.duration_mshistogramstatus (ok/error)Extraction latency
loom.auto_extract.invocationscounterstatusFailure rate; call volume

Neither carries user_id (as of 0.17): a series per user is unbounded cardinality.

Startup notice

A one-time-per-process INFO log notice tells you when the default-on heuristic fires:

INFO loomflow.memory.auto_extract: AutoExtractMemory enabled by default for this model class. Each remembered episode triggers a small extraction call to pull (subject, predicate, object) facts. Pass Agent(auto_extract=False) to disable, or Agent(auto_extract=True) to silence this notice.

Toggling

To disable for cost reasons, pass auto_extract=False:

agent = Agent("...", model="gpt-4o", auto_extract=False)

To enable explicitly (and silence the startup notice):

agent = Agent("...", model="gpt-4o", auto_extract=True)
Last updated on