Skip to content

Episodic Memory in Agentic Frameworks: Suggesting Next Tasks

๐Ÿ•’ Published (v1): 2025-11-21 20:47 UTC ยท Source: Arxiv ยท link

Ask a follow-up

Open an assistant pre-loaded with this paper's context.

๐Ÿ’ฌ Ask ChatGPTโœฆ Ask Claude

TL;DR

This paper proposes an episodic memory architecture for agentic frameworks that stores past workflow executions and uses them to recommend next tasks to users during scientific workflow construction. Rather than relying purely on LLM parametric knowledge (which risks hallucination), it matches the current in-progress workflow against a provenance database of historical workflows to generate grounded suggestions. The system is demonstrated on a PFAS hazard-assessment crew in Materials Science.

Problem

LLM-based agents suggesting next steps in scientific workflows suffer from hallucination and domain-specificity gaps because their suggestions derive from pre-trained parametric memory rather than actual domain workflow history. Fine-tuning on proprietary scientific workflows is impractical due to data scarcity and cost. Prior work on task recommendation in workflows has not been applied in the agentic framework context.

Method

An Episodic Memory (EM) Agent is interposed between the user chat UI and an existing domain agent crew. On each user instruction:

  1. Workflow compilation: The EM Agent extracts the execution trajectory (tool calls + reasoning steps) from the domain crew and compiles it into a structured recursive workflow representation (ordered steps with input/output, distinguishing function calls from user-instruction steps), discarding non-reproducible trace noise.

  2. Similarity-based retrieval: The compiled current workflow \(W_c\) (leaf step sequence \(S_c\)) is matched against memory workflows \(W_i\) (sequences \(S_i\)) in a provenance database (ProvLake/W3C PROV schema). A workflow \(W_i\) is retrieved if \(\text{sim}(S_c, S_i') > T\) for a contiguous subsequence \(S_i' \subseteq S_i\), where similarity is the mean of per-step similarities: cosine similarity on text embeddings for user-instruction steps, and exact function-name matching for tool-call steps. Threshold \(T = 0.65\), max 10 retrieved workflows.

  3. LLM-based suggestion: Retrieved workflows and the current workflow are passed as context to an LLM, which infers the most likely next steps. If no similar workflow is found, a fallback prompt provides the domain crew's capability description instead.

  4. Saving: A \save command triggers the Episodic Memory Saving Tool to persist the current workflow into the database for future retrieval.

Key Contributions

  • Episodic memory architecture that wraps existing agent crews without modifying them, adding workflow-grounded next-task suggestion capability.
  • Workflow compiler that translates agent execution trajectories into structured, reproducible workflow representations stored in a provenance schema.
  • Hybrid retrieval algorithm combining embedding-based cosine similarity for natural-language instruction steps and exact matching for tool calls.
  • Graceful fallback: when no similar historical workflow exists, the system degrades to capability-description-based LLM suggestion rather than failing silently.
  • Bootstrapping strategy using an LLM (Llama 4 Maverick FP8) to synthetically generate initial memory workflows from tool and instruction descriptions.

Results

  • Qualitative demonstration only; no quantitative benchmarks are reported.
  • In the Materials Science PFAS use case (BeeAI framework, Chemist Agent with three tools), the system correctly retrieves relevant prior workflows and suggests plausible next steps (e.g., after SDS extraction โ†’ suggest PFAS classification or hazard assessment).
  • Fallback mode triggers correctly when no matching workflow exists (e.g., a query-type instruction not represented in the memory database).

Limitations

  • No quantitative evaluation of suggestion quality, retrieval precision/recall, or task completion improvement.
  • Performance is highly dependent on the quality and coverage of the curated workflow database.
  • Simple tree-matching with embedding similarity may fail under larger structural changes to agent or tool definitions.
  • Workflow similarity threshold (\(T = 0.65\)) and retrieval cap (10 workflows) are fixed heuristics with no ablation.
  • The \save step is manual; automated workflow ingestion is not addressed.
  • Suggestions for reuse of previous intermediate results and multi-step planning are left as future work.

Relevance to Harnesses / Meta-Harnesses

This paper describes a meta-layer agent that wraps and augments an existing domain agent crew โ€” precisely the architecture pattern central to harness design. The EM Agent acts as a harness component that intercepts traffic between the UI and downstream crew, compiles execution traces into structured representations, queries a persistent memory store, and injects enriched outputs back into the response stream without modifying the wrapped crew. The provenance-database-backed workflow store and trajectory compiler are directly analogous to the logging, replay, and state-tracking subsystems common in meta-harness designs. For researchers building harnesses, the paper offers a concrete pattern for adding stateful, history-aware recommendation atop a stateless base agent crew while preserving composability.