Skip to main content

The Reliability Layer for Production AI Agents

Project description

StateBase Python SDK

The official Python client for StateBase - The Reliability Layer for Production AI Agents.

PyPI version

📦 Installation

pip install statebase

🚀 Quick Start

1. Initialize

from statebase import StateBase

sb = StateBase(api_key="sb_live_...")

2. Sessions (The Interaction Loop)

# Create a session
session = sb.sessions.create(
    agent_id="coding-assistant",
    user_id="user_123"
)

# ... inside your chat loop ...
user_input = "How do I fix this bug?"

# Get Context (RAG + State + History)
ctx = sb.sessions.get_context(session.id, query=user_input)

# Generate with LLM
# ... call openai ...
ai_response = "You should check the stack trace."

# Log the Turn
sb.sessions.add_turn(
    session_id=session.id,
    input=user_input,
    output=ai_response
)

3. Memory (Long-term Knowledge)

# Add a fact
sb.memory.add(
    user_id="user_123",
    content="User prefers TypeScript over JavaScript",
    tags=["preference", "coding"]
)

# Search
facts = sb.memory.search(
    user_id="user_123",
    query="coding preferences"
)

📚 Documentation

Full docs: docs.statebase.org

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

statebase-0.2.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

statebase-0.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for statebase-0.2.0.tar.gz
Algorithm Hash digest
SHA256 405c69ced43f7011e604048de1bcec9ddfb194d99dbe469fadeecbe0e16949ec
MD5 939a671d038d3a89bd870765b0699d47
BLAKE2b-256 632f19e448ff8293487c1f37d35d1a10e4556ef5ff2a5ef03804181e560ede38

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for statebase-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf39744a8970ac62038e3f18a3039c893e8ef62b1d0961facc125c9d30d3c034
MD5 ff70638c7aa0710cdfdf4d9ffadca4a5
BLAKE2b-256 f378af010a7fa801c55a37ca49b0e6bc4e88577cae43b735f0afb17c5477a93d

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