Skip to main content

🤖 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

Metadata

Release files for agentstate 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentstate 1.0.2
File Size Uploaded
agentstate-1.0.2.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentstate 1.0.2
File Interpreter ABI Platform
agentstate-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / agentstate-1.0.2.tar.gz

Download URL agentstate-1.0.2.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2578877862efb692a4f3e467211eeca34b2a1f0a0260301c9577592c5d8c8d0d
BLAKE2b-256 checksum
How to use checksums
068a29332426e1632601b41eeb90c1ec13e3f764d02b772196593dbdb44d5e56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / agentstate-1.0.2-py3-none-any.whl

Download URL agentstate-1.0.2-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48375add0cfee4ecb6bb09bbb37f564d3b027e471cc635b2e354f5d32c6d3bce
BLAKE2b-256 checksum
How to use checksums
fcf9fcd813b63645fd7108ef32741062f826c706af1a960f47564e3cdbad4eb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page