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.1.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.1.0-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_webkit_server-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 b9e4273663f5a9bd4caf2a5de1f51ac327649a0652a74b0a721d1a05e8e764ba
MD5 2ac04e927534d12e6197e9158b484191
BLAKE2b-256 b019c0e08eed6cf0234664742b690ed3025ed8e38795990e1e0b3af9b0b99cbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_webkit_server-0.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_webkit_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f86a92cef43fc534d916019893c992cd0cf38772b9f793672297135ba2dc1202
MD5 553294d2e22fac1002a2e4635334880a
BLAKE2b-256 59078e72a731803d710c3c7ba143e4342ce3f73a97c02f2e950490cbe50c5140

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_webkit_server-0.1.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