Skip to main content

Memro Python SDK

Verified memory infrastructure for AI agents.

Install

# PyPI (once published via CI):
pip install memro

# Install from source:
pip install .

Quick Example

from memro import Agent

agent = Agent.create()  # Generates sovereign Ed25519 identity
mem = agent.remember("The billing service was rewritten in Go")
results = agent.recall("billing service language")
print(results[0].content)

Connect

from memro import Agent

agent = Agent.from_env()                       # MEMRO_API_KEY (and optional MEMRO_BASE_URL)
agent = Agent.from_api_key("memro_sk_...")     # explicit key, Memro Cloud
agent = Agent.connect("memro_sk_...", base_url="http://localhost:8081")  # self-hosted

Self-owned identity (the private key is generated here and never sent):

agent = Agent.create()                 # registers the public key
agent.save("identity.json")            # keep secret; it can't be recovered
agent = Agent.from_file("identity.json")

Agent.from_env() also accepts MEMRO_AGENT_ID + MEMRO_PRIVATE_KEY.

Memories

m = agent.remember(
    "The billing service was rewritten in Go",
    type="semantic",                     # episodic | semantic | procedural | profile | None (auto)
    visibility="private",
    event_date="2026-03-01T00:00:00Z",   # optional
    session_id=None,                     # optional UUID
    metadata={"source": "standup"},
)
agent.get_recent(limit=20, type="profile")      # list[Memory], newest first
agent.delete_memory(m.id)                       # True, or False if it didn't exist
agent.export()                                  # ExportData(total, memories, ...)
for r in agent.recall("what language is billing in?", limit=5, mode="hybrid", min_score=0.3):
    print(r.score, r.content)                    # SearchResult

agent.recall_temporal("deploy incidents", after_date="2026-09-01T00:00:00Z", temporal_weight=0.6)

mode is hybrid (default), semantic or keyword.

Memory engine

ans = agent.reason("why did 500s spike after the billing release?")
print(ans.answer, ans.confidence, ans.based_on)

agent.evolve()                          # EvolutionResult
agent.resolve_conflict(a_id, b_id)      # {"Resolved": id} or {"Ambiguous": [...]}
agent.memory_chain(m.id)                # MemoryChain
agent.timeline(m.id)                    # MemoryTimeline
agent.stats()                           # TemporalStats
agent.usage()                           # dict

Files and webhooks

up = agent.upload_file("notes.pdf")                    # stores the file and a memory of its text
up = agent.upload_file(("notes.txt", b"...", "text/plain"), remember=False)
agent.upload_image("whiteboard.png")                   # Memory with a description
agent.upload_document("handbook.docx")                 # PDF/Word/PowerPoint/Excel/text -> list[Memory]

agent.add_webhook("https://example.com/memro-hook")
agent.webhooks()
agent.remove_webhook("https://example.com/memro-hook")

Errors and retries

from memro import MemroError, RateLimitError

try:
    agent.remember("...")
except RateLimitError:
    ...                     # 429 after the automatic retries
except MemroError as e:
    print(e.status_code, e.message)

MemroClient(timeout=30, max_retries=2): rate-limited requests are retried (honouring Retry-After); gateway errors are retried only for GET and DELETE, so a memory is never stored twice.

LangChain

from memro.integrations.langchain import MemroMemory   # pip install "memro[langchain]"
memory = MemroMemory(agent=agent)

Low-level client

agent.client is a MemroClient with one method per endpoint (search, search_temporal, reason, upload_file, …) and request(method, path, params=, json_body=, files=) for anything else. Requests are signed with v2 signatures when there is no API key.

See the API reference for response fields.


Repository: github.com/memrohq/memro · Documentation: https://memro.co License: Source available under PolyForm Noncommercial 1.0.0. Free for non-commercial use; commercial use through Memro Cloud or a commercial license.

Metadata

Release files for memro 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memro 0.2.0
File Size Uploaded Provenance Actions
memro-0.2.0.tar.gz 23.8 kB Without provenance Details for memro-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for memro 0.2.0
File Interpreter ABI Platform Actions
memro-0.2.0-py3-none-any.whl Python 3 none any Details for memro-0.2.0-py3-none-any.whl

Total release size: 43.4 kB

Release files / memro-0.2.0.tar.gz

Download URL memro-0.2.0.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a9a2bb789270e86ba7185cb3e4ba0a710e5cee274ac47a80bfedcc5feab9ca9a
BLAKE2b-256 checksum
How to use checksums
3bc93e9c38b78b001aee5132da0076764c78f6be51ceecece7b17d4981af7855
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Release files / memro-0.2.0-py3-none-any.whl

Download URL memro-0.2.0-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
830ae06054688ba75f26205ccdcdd7a2777157cbc344359d077be20c76f32989
BLAKE2b-256 checksum
How to use checksums
4bdf1ab4a9cf8ee8f0b3e57469e995e7effd99f4dd36eda7bde86d19464b37f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Security for memro 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page