Maniac Docs
Python Runtime

Memory RPC in Python

Call await memory(op=save|search|load|delete) from Python REPL cells with agent-scoped storage and trace events.

Memory RPC in Python

When spec.memory is present, runAgent injects a memory callable into the Python namespace. Python cells call it with top-level await:

saved_id = await memory(op="save", content={"note": "hello"})
matches = await memory(op="search", text="hello")
record = await memory(op="load", id=saved_id)
await memory(op="delete", id=saved_id)

The callable crosses the JSON-RPC worker boundary — the same path TypeScript tools use for injected callables.

Operations

opPurposeKey arguments
"save"Persist a JSON objectcontent, optional scope
"search"Semantic / text searchtext, optional limit
"load"Fetch by idid
"delete"Remove by idid

Scoping and defaults

  • Scoped to agent:<agent-id>/**
  • Saves default to agent:<agent-id>/scratch when no scope is provided
  • Emits kind="memory" trace events for save, load, search, and delete operations

Full REPL example

# Inside a python_exec cell — tools and query are also injected
summary = await summarize({"note": query})
saved_id = await memory(op="save", content={"summary": summary})
matches = await memory(op="search", text="summary")
print(f"{summary} ({len(matches)} saved)")

See packages/agents/examples/repl-quickstart.ts for a runnable TypeScript harness that drives this pattern with a mocked model.

TypeScript-only memory tiers

Observational memory, working memory, and remember(note) are configured on the Maniac app and thread through chat({ memory: { observational, working } }). The Python memory callable covers the agent memory adapter directly — it does not replace working-memory doc updates or the observational reflector pipeline.

For cross-language parity on memory stores and scopes, see Memory and the parity matrix.

On this page