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.1.0.tar.gz (7.4 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.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for neura_api_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e946a088214d97866fd4e0205a1bea73d1c0a0ea47b562c9a681cc7181bd97ca
MD5 d31bfbbc17a116e7af4fb8faa279f0b5
BLAKE2b-256 d87f2c10a7e0310ca408303de937883c3d37f9036a1f9f6fb15b8c83a31f88ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neura_api_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9322252f053f25aa4e3ec566dbd31ae0fed38a65deb34b869afa7fcd90a6e73
MD5 ad3df23989d5a7cdceaddb9b574da07b
BLAKE2b-256 bdaaee1f5ded2e7d1127524d9774a6a10c1f57257a9f8a74b653cc65b803e466

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