pub async fn remember_entry(
entry: MemoryEntry,
dataset_name: &str,
session_id: &str,
owner_id: Uuid,
_tenant_id: Option<Uuid>,
db: Option<Arc<DatabaseConnection>>,
_session_store: Option<Arc<dyn SessionStore>>,
session_manager: Option<Arc<SessionManager>>,
llm: Option<Arc<dyn Llm>>,
) -> Result<RememberResult, ApiError>Expand description
Dispatch a typed MemoryEntry to the appropriate SessionManager
method.
Mirrors Python’s _dispatch_session_entry at
cognee/api/v1/remember/remember.py:190-313. The entry_type /
entry_id fields on the returned RememberResult are populated for
all three branches; the HTTP DTO at crates/http-server/src/dto/
(E-02) carries them through to the wire.
Behavior:
- Empty
session_idreturnsErr(ApiError::InvalidArgument)(Python parity:ValueError→ HTTP 400 at the handler boundary). - Best-effort pre-upsert via
SessionLifecycleDb::ensure_and_touch_session; any failure is logged atdebuglevel and swallowed (Python parity:try/exceptaround the pre-upsert atremember.py:232-253). MemoryEntry::Qa→SessionManager::save_qa; if any offeedback_text/feedback_score/used_graph_element_idsis set, a follow-upSessionManager::update_qaapplies the partial update.entry_type = "qa",entry_id = qa_id.MemoryEntry::Trace→SessionManager::add_agent_trace_step.method_params.unwrap_or(Value::Null)is passed because the Rust signature requires a non-Optionvalue. Feedback generation happens insideSessionManagerbased ongenerate_feedback_with_llmand whether an LLM is wired.entry_type = "trace",entry_id = trace_id.MemoryEntry::Feedback→SessionManager::add_feedback. OnOk(true)the result reportsRememberStatus::SessionStoredwithentry_id = qa_id. OnOk(false)the result reportsRememberStatus::Erroredwitherror = Some("add_feedback: QA <id> not found in session <sid>").entry_type = "feedback".
LLM feedback: When TraceEntry::generate_feedback_with_llm is true
and llm is Some, the trace entry’s session_feedback is produced by
calling the LLM with the
agent_trace_feedback_summary_system prompt (Python parity); the call is
bounded by an 8-second timeout. On timeout, LLM error, missing llm
handle, or empty method_return_value, the implementation falls back to
the deterministic Python-parity strings ("<origin> succeeded." /
"<origin> failed. Reason: ..." / "<origin> failed."). When
generate_feedback_with_llm is false, the deterministic fallback is
recorded regardless — also Python parity
(session_manager.py:289-294).