sdk
Python

Python SDK

Repository: github.com/bissaphq/bissap-python (opens in a new tab)

Install

pip install bissap-sdk

Overview

The Python SDK mounts a standard "agent door" into your FastAPI/Starlette app under /bissap. It handles API key minting, validation, rate limiting, and intent routing.

Key Concepts

  • Intents: typed request handlers with Pydantic input/output validation
  • Scopes: fine-grained permission control per API key
  • Local, hybrid, and cloud modes: run standalone or connect to Bissap Cloud for centralized key management

Quick Example

from fastapi import FastAPI, Request
from pydantic import BaseModel
from bissap_sdk import BissapConfig, IntentDef, enable_agent_access
 
app = FastAPI()
 
class PingIn(BaseModel):
    pass
 
class PingOut(BaseModel):
    ok: bool
 
async def user_resolver(req: Request):
    return "user_123"  # replace with your auth
 
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,
)

See the Python quickstart for a full walkthrough.