Skip to main content

Firebase for AI Agents - Persistent state management for AI applications

Project description

🤖 AgentState Python SDK

Firebase for AI Agents - Python SDK for persistent agent state management.

PyPI version Python versions License

🚀 Quick Start

Installation

pip install agentstate

Basic Usage

from agentstate import AgentStateClient

# Connect to AgentState server
client = AgentStateClient("http://localhost:8080", namespace="my-app")

# Create an agent
agent = client.create_agent(
    agent_type="chatbot",
    body={"name": "CustomerBot", "status": "active", "conversations": 0},
    tags={"team": "support", "environment": "production"}
)

print(f"Created agent: {agent['id']}")

# Update agent state
updated = client.create_agent(
    agent_type="chatbot", 
    body={"name": "CustomerBot", "status": "busy", "conversations": 5},
    tags={"team": "support", "environment": "production"},
    agent_id=agent['id']  # Update existing agent
)

# Query agents
support_agents = client.query_agents({"team": "support"})
print(f"Found {len(support_agents)} support agents")

# Get specific agent
retrieved = client.get_agent(agent['id'])
print(f"Agent status: {retrieved['body']['status']}")

📚 API Reference

AgentStateClient

__init__(base_url, namespace)

Initialize the client.

  • base_url: AgentState server URL (e.g., "http://localhost:8080")
  • namespace: Namespace for organizing agents (e.g., "production", "staging")

create_agent(agent_type, body, tags=None, agent_id=None)

Create or update an agent.

  • agent_type: Agent category (e.g., "chatbot", "workflow", "classifier")
  • body: Agent state data (dict)
  • tags: Key-value pairs for querying (dict, optional)
  • agent_id: Specific ID for updates (str, optional)

Returns: Agent object with id, type, body, tags, commit_seq, commit_ts

get_agent(agent_id)

Get agent by ID.

  • agent_id: Unique agent identifier

Returns: Agent object

query_agents(tags=None)

Query agents by tags.

  • tags: Tag filters (e.g., {"team": "support", "status": "active"})

Returns: List of matching agent objects

delete_agent(agent_id)

Delete an agent.

  • agent_id: Unique agent identifier

health_check()

Check server health.

Returns: True if healthy, False otherwise

🎯 Usage Examples

Multi-Agent System

from agentstate import AgentStateClient

client = AgentStateClient("http://localhost:8080", "multi-agent-system")

# Create coordinator agent
coordinator = client.create_agent("coordinator", {
    "status": "active",
    "workers": [],
    "tasks_queued": 50
}, {"role": "coordinator"})

# Create worker agents
workers = []
for i in range(3):
    worker = client.create_agent("worker", {
        "status": "idle",
        "processed_today": 0,
        "coordinator_id": coordinator["id"]
    }, {"role": "worker", "coordinator": coordinator["id"]})
    workers.append(worker)

print("Multi-agent system initialized!")

🔗 Links

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

agentstate-1.0.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

agentstate-1.0.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file agentstate-1.0.0.tar.gz.

File metadata

  • Download URL: agentstate-1.0.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for agentstate-1.0.0.tar.gz
Algorithm Hash digest
SHA256 83491555e10d06aedd6912bafea2a36c5ceb72fc854ad57a9cf42dee79ee0b80
MD5 01f9d220b9d6929e40cfdaf231b167d7
BLAKE2b-256 f37edfe4d65f743a29aa80b074ecaf51b1379b19a40f06ca198adb994702ce5c

See more details on using hashes here.

File details

Details for the file agentstate-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: agentstate-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for agentstate-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c1929c926ae41650e1aaf5e26a8e65089ec90adc84b812d7c9b2db5df30ba0a
MD5 01667d6cb81d6777e4bd40510b0eaad2
BLAKE2b-256 b9de404dbffb3f7862dd818339b47ada5d983a92e532f2b72900f1bacb59c2b4

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