Skip to main content
Examples for the v2.4–v2.5 learning-layer features. The running scenario: an AP reconciliation agent that processes vendor invoices and learns from every human correction.

Correction Capture (Programmatic)

Record a human correction through agent.memory.recordCorrection(). The correction is embedded into the vector store and retrieved on future relevant runs — the agent stops repeating the mistake.

Correction Capture (HTTP, from a review UI)

Every agent served via createAgentRouter() with corrections enabled exposes POST /agents/:name/corrections — wire your review UI’s “fix” button straight to it.

Trust Tiers & Grounded Extraction

Learnings carry a provenance source. Context injection marks human-authored knowledge [verified] and AI-extracted knowledge [unverified], with a caveat telling the model not to assert unverified items as fact. Auto-extraction only saves learnings it can anchor to a verbatim quote.

Self-Corrective Memory

Recording a correction automatically invalidates unverified AI-extracted learnings that contradict it. Human-authored learnings are never auto-retired.

Regression Evals from Corrections

Corrections recorded with originalInput become replayable test cases — run them in CI to prove previously-corrected mistakes no longer recur.

Reflection & Confidence-Gated Escalation

With reflection.enabled, every run() gets an LLM-critic pass and bounded revision. The final critique lands on output.critique — use the score to route low-confidence outputs to human review.

Accuracy Metrics

Corrections and critique scores flow into MetricsExporter automatically — correctionRate is the inverse of first-pass accuracy.

External Agents (Any Framework)

Serve a LangGraph graph — or any custom code — through Agentium’s runtime with defineExternalAgent().

Ephemeral Agents (Names Are Labels)

Since v2.3.2, registry names are last-write-wins — creating the same-named agent repeatedly never throws. Per-request and in-loop agents just work.

Memory Maintenance (Reconcile)

Vector-backed stores dual-write to KV + vector index. Run curator.reconcile() on a schedule to repair drift after crashes.