Skip to main content

External brain for AI agents — persistent memory and state via HTTP

Project description

Neura Python SDK

External brain for AI agents — persistent memory and state via HTTP.

from neura import Neura

neura = Neura(api_key="sk-...")

# Store a memory
neura.memory.create(content="User prefers dark mode", tags=["preference"])

# Semantic search
results = neura.memory.search("What are my preferences?")

# Persistent state
neura.state.set("current_goal", {"task": "Build the API"})
goal = neura.state.get("current_goal")

Install

pip install neura-api

Usage

Memory

# Create
mem = neura.memory.create(
    content="The user likes brutalist design",
    tags=["preference", "ui"],
    importance=8,
    metadata={"source": "conversation"},
)

# Semantic search
results = neura.memory.search("design preferences")

# Advanced search with filters
filtered = neura.memory.search_advanced(
    query="user settings",
    filters={"tags": ["preference"], "importance_min": 5},
    limit=20,
)

# Update
neura.memory.update(mem["id"], importance=9)

# Delete
neura.memory.delete(mem["id"])

State

# Set
neura.state.set("risk_level", "conservative")

# Get
risk = neura.state.get("risk_level")
# {"key": "risk_level", "value": "conservative", ...}

# List all
all_state = neura.state.list()

# Delete
neura.state.delete("risk_level")

Error Handling

from neura import NeuraHttpError

try:
    neura.memory.search("something")
except NeuraHttpError as e:
    print(e.code)         # 'rate_limited', 'not_found', etc.
    print(e.message)      # Human-readable
    print(e.action)       # 'wait_and_retry', 'check_api_key', etc.
    print(e.retry_after)  # Seconds to wait

Retries

The SDK automatically retries on network errors and rate limits with exponential backoff.

API

Method Endpoint Description
memory.create() POST /api/memory Store with auto-embedding
memory.search() GET /api/memory?query= Semantic search
memory.search_advanced() POST /api/memory/search Filtered search
memory.update() PATCH /api/memory/:id Update fields
memory.delete() DELETE /api/memory/:id Remove memory
state.set() POST /api/state Upsert key-value
state.get() GET /api/state/:key Get value by key
state.list() GET /api/state List all keys
state.delete() DELETE /api/state/:key Remove key

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

neura_api_python-0.3.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

neura_api_python-0.3.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file neura_api_python-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for neura_api_python-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ccf188e4d28a1aa8624712714cfef0652f353d28e167a7d581e3686f1b4b7a61
MD5 3163c3f09fe8e0904d19db15518b05df
BLAKE2b-256 9fbeb6f37766c446ccc4e5d7213e87f4a767252f193cbc2549b2bc2d8e55a872

See more details on using hashes here.

File details

Details for the file neura_api_python-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for neura_api_python-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9957a92dd7116bfad80e942ed23b73375f82eae1cb3375fb348436a749a84a2f
MD5 ce79d7421aa6b4a464d4f3fba7df203a
BLAKE2b-256 b75ed7f51c051458f7abbf033300b33c0fe238b2179a9e13505d9e101220b068

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