Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Augmenting Prompts with Agent Memory

This guide shows how to inject session memory into your prompt hooks so agents carry prior context without manual retrieval or serialization.

How Prompt Hook Augmentation Works

When a prompt hook resolve request includes a session_id, SCHEMABOUND automatically fetches the session’s memory entries and makes them available as {{memory_context}} inside the hook template. The caller does not need to retrieve or serialize prior context manually.

POST /api/prompt-hooks/:id/resolve
Content-Type: application/json

{
  "session_id": "abc-123",
  "context": { "user_id": "alice", "organization_id": "acme" }
}

The resolved template receives {{memory_context}} alongside the standard context variables before rendering.

Managing Memory Entries

List Active Sessions

GET /api/agent-sessions

Returns the list of all active sessions.

Response

{
  "data": [
    {
      "id": "abc-123",
      "created_at": "2026-04-19T10:00:00Z",
      "last_seen_at": "2026-04-19T10:42:00Z"
    }
  ]
}

Retrieve Session Memory

GET /api/agent-memory/:session_id

Returns all memory entries for a session in chronological order.

Response

{
  "data": [
    {
      "entry_type": "tool_call",
      "content": "{ \"tool\": \"query\", \"result\": \"...\" }",
      "created_at": "2026-04-19T10:05:00Z"
    }
  ]
}

Append a Memory Entry

POST /api/agent-memory/:session_id
Content-Type: application/json

{
  "entry_type": "observation",
  "content": "User confirmed the report looked correct."
}

Appends a new entry to the session’s memory store. All responses follow the { data: ... } envelope used by the rest of the SCHEMABOUND API.

Frontend Dashboard

The Agent Memory dashboard provides:

  • Session list — all active sessions with timestamps
  • Memory detail — selecting a session shows its entries in order, with entry type and content