Observed since 20 Oct, 23:29 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Python backend utilities for sharing app state with AI agents. v1: {messages, actions, context} model, breaking changes, RAG-ready architecture.
Python backend utilities for sharing app state with AI agents. Works with FastAPI, Flask, Django REST Framework, and any Python web framework.
# Basic installation (FastAPI is recommended)
pip install agent-state-bridge[fastapi]
# Or with Flask
pip install agent-state-bridge[flask]
# Or with Django
pip install agent-state-bridge[django]
# Or install all
pip install agent-state-bridge[all]
from fastapi import FastAPI
from agent_state_bridge.fastapi import create_agent_router
async def my_agent(message: str, state: dict) -> str:
"""Your agent logic here"""
cart_items = state.get("cart", {}).get("items", [])
return f"You have {len(cart_items)} items. You said: {message}"
app = FastAPI()
router = create_agent_router(my_agent, tags=["agent"])
app.include_router(router)
from flask import Flask
from agent_state_bridge.flask import create_agent_blueprint
def my_agent(message: str, state: dict) -> str:
return f"Processed: {message}"
app = Flask(__name__)
bp = create_agent_blueprint(my_agent)
app.register_blueprint(bp)
from agent_state_bridge.django import agent_api_view
@agent_api_view
def my_agent(message: str, state: dict) -> str:
return f"Processed: {message}"
# In urls.py:
# path('chat/', my_agent)
from langchain_openai import ChatOpenAI
from agent_state_bridge.fastapi import create_agent_router
llm = ChatOpenAI(model="gpt-4o-mini")
async def langchain_agent(message: str, state: dict) -> str:
response = await llm.ainvoke([{"role": "user", "content": message}])
return response.content
router = create_agent_router(langchain_agent)
from azure.ai.projects import AIProjectClient
from agent_state_bridge.fastapi import create_agent_router
client = AIProjectClient(...)
agent = client.agents.create_agent(model="gpt-4o-mini")
async def agent_handler(message: str, state: dict) -> str:
# Your Agent Framework logic
return response
router = create_agent_router(agent_handler)
See /examples folder for complete examples with LangChain, Agent Framework, and more.
AgentRequest: Request model with message and state fieldsAgentResponse: Response model with response fieldcreate_agent_router(handler, prefix="", tags=[]): Create router with /chat endpointAgentBridge: Class-based approach with decoratorcreate_agent_blueprint(handler, name="agent", url_prefix=""): Create blueprint@agent_route: Decorator for route handlers@agent_api_view: Decorator for function-based viewsAgentAPIView: Base class for class-based viewsThis package works seamlessly with the npm package agent-state-bridge for React:
npm install agent-state-bridge
MIT
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.0 | 23 Nov 2025 | 4 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 23:29 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:5eb5090a33a1b7fc8659b9a49fe4f70143b89ddb1362fe233ed75f53f49f0ba2