Skip to main content

Server-side toolkit for the Claude Agent SDK over HTTP+SSE: session lifecycle, permission routing, SDK bridge, plus bundled FastAPI and Postgres adapters.

Project description

agent-webkit-server

Server-side toolkit for exposing the Claude Agent SDK over HTTP+SSE. One Python package; bundled adapters cover the common deployment shapes.

Install

pip install agent-webkit-server                # core only
pip install "agent-webkit-server[fastapi]"     # + FastAPI HTTP adapter
pip install "agent-webkit-server[postgres]"    # + PgSessionStore
pip install "agent-webkit-server[fastapi,postgres]"

Core

Framework-agnostic primitives — no FastAPI, no asyncpg until you opt in.

from agent_webkit_server import PROTOCOL_VERSION
from agent_webkit_server.session import SessionRegistry, SessionConfig
from agent_webkit_server.event_log import EventLog
from agent_webkit_server.sdk_bridge import (
    PermissionRouter,
    build_can_use_tool,
    translate_sdk_messages,
)

These pieces are what you'd otherwise reimplement: per-session inbound queue + receive-loop, append-only event log with multi-subscriber fan-out, permission/AskUserQuestion correlation router, the can_use_tool wiring, and the SDK→wire-event translator.

FastAPI adapter

from agent_webkit_server.adapters.fastapi import create_app
from agent_webkit_server.auth import AuthConfig

app = create_app(auth=AuthConfig.from_env())

Exposes:

  • POST /sessions
  • GET /sessions/{id}/stream (SSE, with Last-Event-ID resume)
  • POST /sessions/{id}/input (every inbound message type)
  • DELETE /sessions/{id}

Postgres adapter (PgSessionStore)

Plug into the SDK directly via ClaudeAgentOptions(session_store=...):

from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient
from agent_webkit_server.adapters.pg_session_store import PgSessionStore

store = await PgSessionStore.connect("postgresql://...")
options = ClaudeAgentOptions(session_store=store, resume=session_id)
client = ClaudeSDKClient(options=options)

Passes the SDK's published run_session_store_conformance suite plus adapter-specific contracts (uuid idempotency, concurrent-append serialization, multi-tenant isolation).

Wire protocol

Documented in docs/wire-protocol.md. The Pydantic models in agent_webkit_server.models are the canonical schema.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_webkit_server-0.2.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_webkit_server-0.2.0-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file agent_webkit_server-0.2.0.tar.gz.

File metadata

  • Download URL: agent_webkit_server-0.2.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agent_webkit_server-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d848a16c70ca6842269a971e6477b3cc431076cd7fe225f3774664ef743cbe92
MD5 aaf3b8228ef2cdb4de880b8e83c338e9
BLAKE2b-256 389ef75f18588591d1e20d03a73b6505a8ece4927545b1b19a3b75a1e48c72bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_webkit_server-0.2.0.tar.gz:

Publisher: release-pypi.yml on BlitzJB/agent-webkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_webkit_server-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_webkit_server-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a37b7ba25622744040d250748f235ee8a71df3b092cbdaa54b0765b41d00a82e
MD5 5680356019422f2babaccb6b1fb7f351
BLAKE2b-256 10f6dc2b07d9ad67fd7e3743c2b322499bdcdf48d945eff0930e2926feefee12

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_webkit_server-0.2.0-py3-none-any.whl:

Publisher: release-pypi.yml on BlitzJB/agent-webkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page