Python quickstart
1) Install
pip install bissap-sdk2) Mount the agent door
from fastapi import FastAPI, Request
from pydantic import BaseModel
from bissap_sdk import enable_agent_access, IntentDef
from bissap_sdk.config import BissapConfig
app = FastAPI()
class PingIn(BaseModel):
pass
class PingOut(BaseModel):
ok: bool
async def user_resolver(req: Request):
# Replace with your real auth.
return "user_123"
async def ping(inp: PingIn, user_id: str, ctx: dict):
return PingOut(ok=True)
intents = {
"ping": IntentDef(
name="ping",
required_scopes=["read"],
input_model=PingIn,
output_model=PingOut,
handler=ping,
)
}
cfg = BissapConfig(mode="local")
await enable_agent_access(
app,
cfg,
user_resolver=user_resolver,
on_agent_intent=lambda *_: (_ for _ in ()).throw(Exception("Unknown intent")),
scopes=["read", "write"],
intents=intents,
strict_intents=True,
)