AMP Python Client SDK
amp-client is the official Python SDK client for the Agent Memory Protocol (AMP). It provides standard synchronous and asynchronous clients to interact with an AMP memory server, as well as native integrations with LangChain.
Installation
Not yet on PyPI, so install from a clone of the repo:
pip install -e sdk/
To include LangChain support:
pip install -e "sdk/[langchain]"
Quickstart
Store and retrieve memories with the synchronous client in under 5 lines:
from amp_client import AMPClient
client = AMPClient("http://localhost:8765", agent_id="agent_assistant")
# Only when the server runs with AMP_API_KEYS_FILE; without it the agent id is
# accepted on its own, which is the binding the spec describes.
client = AMPClient("http://localhost:8765", agent_id="agent_assistant", api_key="...")
client.remember(content="User prefers email correspondence.", owner_id="user_123")
memories = client.recall(query="communication preferences", owner_id="user_123")
print(memories[0]["content"]["text"])
Reading one cell
cell = client.get_memory("mem_01J5A3B7K9M2N4P6Q8R0S1T3V5")
Reading is what resets a cell's decay clock server-side: the response carries the
bumped scoring.access_count and lifecycle.last_accessed_at.
Paging
recall and list_memories take an offset, which skips that many results the
agent may read - so page 2 is page 2 of what it can see, not of what the store
holds:
page = client.list_memories(owner_id="user_123", limit=20, offset=20)
A page shorter than limit is the last one. The HTTP response also carries
has_more; these methods return the cells, so use client.session (or
client._client on the async client) if you need it.
Full API Reference
AMPClient (Sync)
__init__(server_url: str, agent_id: str)
Initializes the client. Auto-normalizes the server_url to append /amp/v1.
server_url: Base URL of the AMP server.agent_id: Identifier of the client agent (maps toX-AMP-Agent-IDheader).
remember(content: str | dict, owner_id: str, type: str = "semantic", importance: float = 0.5, readable_by: list[str] | None = None) -> dict
Store a piece of information.
content: Memory content (either a string, or a dict withtextandmetadata).owner_id: ID of the owner entity (e.g. user ID).type: Memory type ("semantic","episodic", or"procedural").importance: Float score in range[0.0, 1.0].readable_by: Optional list of agent ID patterns permitted to read this cell.- Returns: Dictionary representation of the created
MemoryCell.
recall(query: str, owner_id: str, limit: int = 5, include_stale: bool = False) -> list[dict]
Perform semantic search for memories.
query: Natural language query.owner_id: Owner ID of target memories.limit: Maximum results to return.include_stale: IfTrue, includes stale cells in search.- Returns: List of matching
MemoryCelldictionaries.
forget(memory_id: str) -> bool
Archive and delete a memory.
memory_id: The ID of the memory cell.- Returns:
Trueif successfully deleted.
list_memories(owner_id: str, type: str | None = None, limit: int = 20) -> list[dict]
Filter active memories by structured criteria (no semantic search).
owner_id: Owner ID.type: Optional memory type filter.limit: Maximum results to return.- Returns: List of active
MemoryCelldictionaries.
health() -> bool
Check server health status.
- Returns:
Trueif healthy.
Async Client (AsyncAMPClient)
The asynchronous client has the exact same API surface as AMPClient, but all network calls must be awaited. It also implements async context manager support:
import asyncio
from amp_client import AsyncAMPClient
async def main():
async with AsyncAMPClient("http://localhost:8765", "agent_assistant") as client:
await client.remember("User likes dark mode.", "user_123")
results = await client.recall("UI preferences", "user_123")
print(results)
asyncio.run(main())
LangChain Integration
AMPMemory is a LangChain BaseChatMessageHistory backed by AMP, so a chain
can persist conversation turns as memory cells and read them back. The example
below is exactly what the test suite runs and what a live server was verified
with; note that langchain-core 1.x removed BaseMemory and ConversationChain,
so this uses the current chat-history interface.
from amp_client import AMPClient
from amp_client.integrations.langchain import AMPMemory
from langchain_core.messages import HumanMessage, AIMessage
client = AMPClient("http://localhost:8765", agent_id="chatbot_agent")
memory = AMPMemory(client=client, owner_id="user_john", memory_key="history")
memory.add_message(HumanMessage(content="Hi, my name is John and I write Python."))
memory.add_message(AIMessage(content="Nice to meet you, John."))
for message in memory.messages:
print(message.type, message.content)
Any LangChain component that accepts a chat message history works with it
directly. If you want the older string form instead of message objects, use
return_messages=False and read memory.load_memory_variables({})["history"].
Error Handling
All client errors resulting from non-2xx responses or connection issues raise AMPError.
from amp_client import AMPClient, AMPError
client = AMPClient("http://localhost:8765", agent_id="agent_test")
try:
client.remember(content="", owner_id="user_123") # Invalid schema
except AMPError as e:
print(f"Error occurred: {e} (Status: {e.status_code})")
Metadata
Release files for amp-client 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| amp_client-0.1.0.tar.gz | 28.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| amp_client-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.5 kB
Release files / amp_client-0.1.0.tar.gz
| Download URL | amp_client-0.1.0.tar.gz |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
561363924ab4b29d9c52e7be9fcff2d26ebfec6799288bf9d219e9e66fbf040a
|
|
BLAKE2b-256 checksum How to use checksums |
e9ad8aabaad4a5640d7200257dbc1ad98eebca01ece525d25679278e3991d055
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logRelease files / amp_client-0.1.0-py3-none-any.whl
| Download URL | amp_client-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9be7b1d7525deafe15972fd21ac7cadbdf8a5d66041f5b1131346de67188312
|
|
BLAKE2b-256 checksum How to use checksums |
4476a41782dad6a776cf1b61a6f327f800af2f4c14455221ce2e798525e52f01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency log