BookbagBookbag
Client SDK · @bookbag/sdk · bookbag

Drop-in governance for your own agent code.

Zero-dependency Python and Node SDK. Five methods, two framework wrappers shipped, three in beta, a CLI, and a GitHub Action for CI. MIT licensed.

Install, point, gate

Two commands to install. One environment variable. Start running gated calls.

install.sh
# pip install bookbag
pip install bookbag

export BOOKBAG_API_KEY="bk_key_..."

# Minimal loop: start_run → tool_call → end_run
python -c "
from bookbag import BookbagClient
c = BookbagClient()
r = c.agent.start_run(agent_id='test-agent')
d = c.agent.tool_call(run_uid=r['run_uid'], tool='shell',
                       arguments={'cmd':'rm -rf /'})
print(d)  # → {'decision': 'block', ...}
c.agent.end_run(run_uid=r['run_uid'], outcome='success')
"

Framework wrappers

For Anthropic and OpenAI SDKs, one `wrap(client)` call gates every tool use. Your agent code is unchanged.

wrapper.py
# bookbag.anthropic.wrap intercepts every tool_use block.
# Zero agent code change.
import anthropic
from bookbag import BookbagClient
from bookbag.anthropic import wrap

client = anthropic.Anthropic()
bookbag = BookbagClient()
wrap(client, bookbag=bookbag, agent_id="support-agent")

# Normal Anthropic call. Every tool_use is gated before it executes.
resp = client.messages.create(
    model="claude-sonnet-4-6",
    tools=[refund_tool, email_tool],
    messages=[{"role": "user", "content": "Refund order FF-4210"}],
)

Framework coverage

Honest labels — shipped, in beta, or drop-in via Gateway.

Anthropic SDK
bookbag.anthropic.wrap(client)
Shipped
OpenAI SDK
bookbag.openai.wrap(client)
Shipped
Claude Desktop
bookbag-mcp-server (stdio)
Shipped
Cursor
bookbag-mcp-server (streamable-http)
Shipped
LangGraph
bookbag.langgraph.instrument(graph)
In beta
CrewAI
bookbag.crewai.instrument(agent)
In beta
AutoGen
bookbag.autogen.instrument(group)
In beta
LangChain / LCEL
bookbag-gateway-sdk (MCP proxy)
Via Gateway
LlamaIndex
bookbag-gateway-sdk (MCP proxy)
Via Gateway
Custom agent
bookbag-qa-sdk direct calls
Shipped

What you get

Zero deps

Python stdlib + Node built-in fetch. No transitive bloat.

Typed errors

AuthenticationError, RateLimitError, InsufficientCreditsError, BookbagError. Catch what you need.

CLI included

bookbag quickstart for an end-to-end demo. bookbag eval for CI regression runs.

GitHub Action

bookbaghq/bookbag-eval-action@v1 — fail a PR when eval regressions appear.

SDK FAQs

Frequently Asked Questions

Drop three lines of Python into your agent. Get the gate.

Join the teams shipping safer AI with real-time evaluation, audit trails, and continuous improvement.