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-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-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neura_api-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.12

File hashes

Hashes for neura_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8513da5f66ce10cf524519e945ba1885acb8587ceb5d3072583e0ffc615ea3dd
MD5 1360abf4da9cacfcca61797934a6e4b8
BLAKE2b-256 7e8fa98aef293526d33293b3981a0ac9593fd3793f5dc69705ef422412c61ab5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neura_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for neura_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b263ed170fbe0d2f4d2bb084564e880ebd21e7d5db0fb0c021a995bf44d2a36a
MD5 a9f5f8f067d74b95c55b3141f80e6be8
BLAKE2b-256 22aa5432974a0d4e75f76c20bf14f646c9e65c2539da3de6c84818b8572bc37a

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