Skip to main content

Python SDK for the 0Latency agent memory API with drop-in wrappers for Anthropic, OpenAI, and Gemini

Reason this release was yanked:

Broken /v1/ prefix — non-functional release, use 0.2.1

Project description

0Latency Python SDK

A lightweight Python client for the 0Latency agent memory API.

Installation

pip install zero-latency

Quick Start

from zero_latency import ZeroLatencyClient

# Initialize the client
client = ZeroLatencyClient(api_key="your_api_key_here")

# Extract memories from a conversation
result = client.extract(
    agent_id="my-agent",
    human_message="I love hiking in the mountains",
    agent_message="That's great! Mountain hiking is wonderful exercise."
)

# Recall relevant memories
memories = client.recall(
    agent_id="my-agent",
    query="What outdoor activities does the user enjoy?",
    limit=5
)

for memory in memories:
    print(f"- {memory['content']} (confidence: {memory['confidence']})")

Features

  • Extract: Automatically extract and store memories from conversations
  • Recall: Semantic search to find relevant memories
  • Search: Keyword-based text search
  • Seed: Bulk import existing facts or notes
  • Graph: Explore memory relationships and connections
  • Entities: Extract and track people, places, concepts
  • Sentiment: Analyze emotional tone across memories
  • Consolidate: Merge and deduplicate similar memories

Usage

Context Manager (Recommended)

with ZeroLatencyClient(api_key="your_api_key") as client:
    memories = client.recall(agent_id="my-agent", query="user preferences")

Direct Instantiation

client = ZeroLatencyClient(api_key="your_api_key")
try:
    memories = client.recall(agent_id="my-agent", query="user preferences")
finally:
    client.close()

Error Handling

from zero_latency import ZeroLatencyClient, AuthenticationError, ValidationError

client = ZeroLatencyClient(api_key="your_api_key")

try:
    result = client.extract(
        agent_id="my-agent",
        human_message="Hello!",
        agent_message="Hi there!"
    )
except AuthenticationError:
    print("Invalid API key")
except ValidationError as e:
    print(f"Invalid request: {e}")

API Methods

extract(agent_id, human_message, agent_message)

Extract and store memories from a conversation turn.

recall(agent_id, query, limit=10)

Recall relevant memories using semantic search.

search(agent_id, q, limit=20)

Search memories by keyword.

list_memories(agent_id, limit=50)

List all memories for an agent.

seed(agent_id, facts)

Bulk import a list of facts.

get_graph(agent_id, memory_id, depth=2)

Get memory graph traversal.

get_entities(agent_id, limit=50)

List extracted entities.

get_sentiment_summary(agent_id)

Get sentiment breakdown.

consolidate(agent_id, auto_merge=False)

Run consolidation to merge similar memories.

delete_memory(memory_id)

Delete a specific memory.

Documentation

Full documentation available at docs.0latency.ai

License

MIT License - see LICENSE file for details.

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zerolatency-0.2.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zerolatency-0.2.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file zerolatency-0.2.0.tar.gz.

File metadata

  • Download URL: zerolatency-0.2.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zerolatency-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b6c8c5511380bca5363873d520f637e2dbefb77253f706dca6d47554cba85b39
MD5 4f78215e6324502c0df8fc71aaff7c1d
BLAKE2b-256 6e3b9cf4c24026eeb5bb8948f1ebb19b789098db0dc942fe56031e7a20535268

See more details on using hashes here.

File details

Details for the file zerolatency-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: zerolatency-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zerolatency-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2232f0c016510df7c0d261522d312dfd634800b93c420fbe65d1f7eda15d599c
MD5 9ba7077aa68031fa81b2398a9f9568b3
BLAKE2b-256 b285c8e8c623fa5779e1cf18a21c7207cdf2f01db35bd97f87c0956459c4fbd1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page