Metadata-Version: 2.4
Name: abstractgateway
Version: 0.2.4
Summary: AbstractGateway: deployable Run Gateway host for AbstractRuntime (commands + ledger).
Project-URL: GitHub, https://github.com/lpalbou/abstractgateway
Project-URL: Documentation, https://www.lpalbou.info/AbstractGateway/
Project-URL: Changelog, https://github.com/lpalbou/abstractgateway/blob/main/CHANGELOG.md
Author: Laurent-Philippe Albou
License: MIT
Requires-Python: >=3.10
Requires-Dist: abstractruntime>=0.4.8
Provides-Extra: all
Requires-Dist: abstractagent>=0.3.5; extra == 'all'
Requires-Dist: abstractcore[audio,compression,media,remote,tokens,tools,vision,voice]>=2.13.12; extra == 'all'
Requires-Dist: abstractflow>=0.3.7; extra == 'all'
Requires-Dist: abstractmemory[lancedb]>=0.2.6; extra == 'all'
Requires-Dist: abstractruntime[multimodal]>=0.4.8; extra == 'all'
Requires-Dist: abstractvision>=0.3.3; extra == 'all'
Requires-Dist: abstractvoice>=0.9.2; extra == 'all'
Requires-Dist: fastapi>=0.100.0; extra == 'all'
Requires-Dist: python-multipart>=0.0.6; extra == 'all'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'all'
Provides-Extra: all-apple
Requires-Dist: abstractagent[all-apple]>=0.3.5; extra == 'all-apple'
Requires-Dist: abstractcore[all-apple]>=2.13.12; extra == 'all-apple'
Requires-Dist: abstractflow>=0.3.7; extra == 'all-apple'
Requires-Dist: abstractmemory[all-apple]>=0.2.6; extra == 'all-apple'
Requires-Dist: abstractmusic[all-apple]>=0.1.1; extra == 'all-apple'
Requires-Dist: abstractruntime[all-apple,multimodal]>=0.4.8; extra == 'all-apple'
Requires-Dist: abstractvision[all-apple]>=0.3.3; extra == 'all-apple'
Requires-Dist: abstractvoice[all-apple]>=0.9.2; extra == 'all-apple'
Requires-Dist: fastapi>=0.100.0; extra == 'all-apple'
Requires-Dist: python-multipart>=0.0.6; extra == 'all-apple'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'all-apple'
Provides-Extra: all-gpu
Requires-Dist: abstractagent[all-gpu]>=0.3.5; extra == 'all-gpu'
Requires-Dist: abstractcore[all-gpu]>=2.13.12; extra == 'all-gpu'
Requires-Dist: abstractflow>=0.3.7; extra == 'all-gpu'
Requires-Dist: abstractmemory[all-gpu]>=0.2.6; extra == 'all-gpu'
Requires-Dist: abstractmusic[all-gpu]>=0.1.1; extra == 'all-gpu'
Requires-Dist: abstractruntime[all-gpu,multimodal]>=0.4.8; extra == 'all-gpu'
Requires-Dist: abstractvision[all-gpu]>=0.3.3; extra == 'all-gpu'
Requires-Dist: abstractvoice[all-gpu]>=0.9.2; extra == 'all-gpu'
Requires-Dist: fastapi>=0.100.0; extra == 'all-gpu'
Requires-Dist: python-multipart>=0.0.6; extra == 'all-gpu'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'all-gpu'
Provides-Extra: apple
Requires-Dist: abstractagent[all-apple]>=0.3.5; extra == 'apple'
Requires-Dist: abstractcore[all-apple]>=2.13.12; extra == 'apple'
Requires-Dist: abstractflow>=0.3.7; extra == 'apple'
Requires-Dist: abstractmemory[all-apple]>=0.2.6; extra == 'apple'
Requires-Dist: abstractmusic[all-apple]>=0.1.1; extra == 'apple'
Requires-Dist: abstractruntime[all-apple,multimodal]>=0.4.8; extra == 'apple'
Requires-Dist: abstractvision[all-apple]>=0.3.3; extra == 'apple'
Requires-Dist: abstractvoice[all-apple]>=0.9.2; extra == 'apple'
Requires-Dist: fastapi>=0.100.0; extra == 'apple'
Requires-Dist: python-multipart>=0.0.6; extra == 'apple'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'apple'
Provides-Extra: dev
Requires-Dist: abstractagent>=0.3.5; extra == 'dev'
Requires-Dist: abstractcore[audio,compression,media,remote,tokens,tools,vision,voice]>=2.13.12; extra == 'dev'
Requires-Dist: abstractmemory[lancedb]>=0.2.6; extra == 'dev'
Requires-Dist: abstractruntime[multimodal]>=0.4.8; extra == 'dev'
Requires-Dist: abstractvision>=0.3.3; extra == 'dev'
Requires-Dist: abstractvoice>=0.9.2; extra == 'dev'
Requires-Dist: fastapi>=0.100.0; extra == 'dev'
Requires-Dist: httpx>=0.27.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: python-multipart>=0.0.6; extra == 'dev'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.0.0; extra == 'docs'
Requires-Dist: mkdocs>=1.6.0; extra == 'docs'
Provides-Extra: gpu
Requires-Dist: abstractagent[all-gpu]>=0.3.5; extra == 'gpu'
Requires-Dist: abstractcore[all-gpu]>=2.13.12; extra == 'gpu'
Requires-Dist: abstractflow>=0.3.7; extra == 'gpu'
Requires-Dist: abstractmemory[all-gpu]>=0.2.6; extra == 'gpu'
Requires-Dist: abstractmusic[all-gpu]>=0.1.1; extra == 'gpu'
Requires-Dist: abstractruntime[all-gpu,multimodal]>=0.4.8; extra == 'gpu'
Requires-Dist: abstractvision[all-gpu]>=0.3.3; extra == 'gpu'
Requires-Dist: abstractvoice[all-gpu]>=0.9.2; extra == 'gpu'
Requires-Dist: fastapi>=0.100.0; extra == 'gpu'
Requires-Dist: python-multipart>=0.0.6; extra == 'gpu'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'gpu'
Provides-Extra: http
Requires-Dist: fastapi>=0.100.0; extra == 'http'
Requires-Dist: python-multipart>=0.0.6; extra == 'http'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'http'
Provides-Extra: memory
Requires-Dist: abstractmemory[lancedb]>=0.2.6; extra == 'memory'
Provides-Extra: multimodal
Requires-Dist: abstractcore[audio,compression,media,remote,tokens,tools,vision,voice]>=2.13.12; extra == 'multimodal'
Requires-Dist: abstractruntime[multimodal]>=0.4.8; extra == 'multimodal'
Requires-Dist: abstractvision>=0.3.3; extra == 'multimodal'
Requires-Dist: abstractvoice>=0.9.2; extra == 'multimodal'
Provides-Extra: server
Requires-Dist: abstractagent>=0.3.5; extra == 'server'
Requires-Dist: abstractcore[audio,compression,media,remote,tokens,tools,vision,voice]>=2.13.12; extra == 'server'
Requires-Dist: abstractflow>=0.3.7; extra == 'server'
Requires-Dist: abstractruntime[multimodal]>=0.4.8; extra == 'server'
Requires-Dist: abstractvision>=0.3.3; extra == 'server'
Requires-Dist: abstractvoice>=0.9.2; extra == 'server'
Requires-Dist: fastapi>=0.100.0; extra == 'server'
Requires-Dist: python-multipart>=0.0.6; extra == 'server'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'server'
Provides-Extra: server-nvidia
Requires-Dist: abstractagent>=0.3.5; extra == 'server-nvidia'
Requires-Dist: abstractcore[all-gpu,vision-diffusers]>=2.13.12; extra == 'server-nvidia'
Requires-Dist: abstractflow>=0.3.7; extra == 'server-nvidia'
Requires-Dist: abstractmemory[lancedb]>=0.2.6; extra == 'server-nvidia'
Requires-Dist: abstractruntime[multimodal]>=0.4.8; extra == 'server-nvidia'
Requires-Dist: abstractvision[diffusers]>=0.3.3; extra == 'server-nvidia'
Requires-Dist: abstractvoice[local]>=0.9.2; extra == 'server-nvidia'
Requires-Dist: fastapi>=0.100.0; extra == 'server-nvidia'
Requires-Dist: python-multipart>=0.0.6; extra == 'server-nvidia'
Requires-Dist: uvicorn[standard]>=0.23.0; extra == 'server-nvidia'
Provides-Extra: telegram
Requires-Dist: abstractruntime[abstractcore]>=0.4.8; extra == 'telegram'
Provides-Extra: vision
Requires-Dist: abstractcore[vision]>=2.13.12; extra == 'vision'
Requires-Dist: abstractruntime[multimodal]>=0.4.8; extra == 'vision'
Requires-Dist: abstractvision>=0.3.3; extra == 'vision'
Provides-Extra: visualflow
Requires-Dist: abstractflow>=0.3.7; extra == 'visualflow'
Provides-Extra: voice
Requires-Dist: abstractcore[audio,voice]>=2.13.12; extra == 'voice'
Requires-Dist: abstractruntime[multimodal]>=0.4.8; extra == 'voice'
Requires-Dist: abstractvoice>=0.9.2; extra == 'voice'
Description-Content-Type: text/markdown

# AbstractGateway

AbstractGateway is a **deployable Run Gateway host** for AbstractRuntime runs:
- start durable runs
- accept a durable command inbox
- replay/stream a durable ledger (replay-first)
- enforce a security baseline (token + origin allowlist + limits)

This decouples the gateway service from any specific UI (AbstractFlow, AbstractCode, web/PWA thin clients).

Start here: [docs/getting-started.md](docs/getting-started.md)

## AbstractFramework ecosystem

AbstractGateway is part of the **AbstractFramework** ecosystem:

- **AbstractRuntime** (required): durable run model + workflow registry + stores (`pyproject.toml`, `src/abstractgateway/runner.py`)
- **AbstractCore / AbstractVoice / AbstractVision** (optional via `abstractgateway[multimodal]` / `[server]`): LLM/tool execution, provider-level prompt-cache controls, and workflow-backed/direct generated image/voice/audio capabilities used by many bundles (`src/abstractgateway/hosts/bundle_host.py`)
- Higher-level UIs (optional): AbstractFlow (authoring/bundling), AbstractCode / AbstractObserver / thin clients (rendering + operations)

Related repos:
- AbstractFramework: https://github.com/lpalbou/AbstractFramework
- AbstractCore: https://github.com/lpalbou/abstractcore
- AbstractRuntime: https://github.com/lpalbou/abstractruntime

## Quickstart (HTTP server, bundle mode)

```bash
pip install "abstractgateway[http]"

export ABSTRACTGATEWAY_FLOWS_DIR="/path/to/bundles"   # *.flow dir (or a single .flow file)
export ABSTRACTGATEWAY_DATA_DIR="$PWD/runtime/gateway"

# Required by default: the server refuses to start without a token.
export ABSTRACTGATEWAY_AUTH_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
# Browser-origin allowlist (glob patterns). Default allows localhost; customize when exposing remotely.
export ABSTRACTGATEWAY_ALLOWED_ORIGINS="http://localhost:*,http://127.0.0.1:*"

abstractgateway serve --host 127.0.0.1 --port 8080
```

OpenAPI docs (Swagger UI): `http://127.0.0.1:8080/docs`

Smoke checks:

```bash
curl -sS "http://127.0.0.1:8080/api/health"

curl -sS -H "Authorization: Bearer $ABSTRACTGATEWAY_AUTH_TOKEN" \
  "http://127.0.0.1:8080/api/gateway/bundles"
```

## Docker server

Release images are published to GHCR. The default image is the light,
portable server image:

```bash
docker pull ghcr.io/lpalbou/abstractgateway-server:0.2.4
```

NVIDIA hosts can try the experimental full GPU image when local
vLLM/HuggingFace/Diffusers engines are wanted. This image is published
best-effort until it has a real CUDA build and smoke gate:

```bash
docker pull ghcr.io/lpalbou/abstractgateway-server-nvidia:0.2.4
```

The image installs `abstractgateway[server,memory]`: HTTP server,
`AbstractRuntime[multimodal]`, AbstractCore remote/commercial provider support,
OpenAI-compatible text providers, workflow-backed and direct image generation
through Runtime/Core/AbstractVision, direct Gateway voice/audio endpoints
through AbstractVoice, provider/session prompt-cache helpers, media/tool
helpers, token counting, compression, AbstractMemory/LanceDB KG support,
AbstractAgent, and AbstractFlow compatibility.

```bash
export ABSTRACTGATEWAY_AUTH_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"

docker run --rm --name abstractgateway-server \
  -p 127.0.0.1:8080:8080 \
  -e ABSTRACTGATEWAY_AUTH_TOKEN="$ABSTRACTGATEWAY_AUTH_TOKEN" \
  -e ABSTRACTGATEWAY_PROVIDER="openai-compatible" \
  -e ABSTRACTGATEWAY_MODEL="your-model" \
  -e OPENAI_COMPATIBLE_BASE_URL="http://host.docker.internal:1234/v1" \
  -v "$PWD/runtime/gateway:/data/gateway" \
  -v "$PWD/flows/bundles:/data/flows:ro" \
  ghcr.io/lpalbou/abstractgateway-server:0.2.4
```

On Apple Silicon, keep Metal/MLX inference native on macOS and run the
lightweight Gateway container as the transport/control plane. Point
`OPENAI_COMPATIBLE_BASE_URL` at a host-native OpenAI-compatible endpoint such
as Docker Model Runner (`http://model-runner.docker.internal/engines/v1`), LM
Studio (`http://host.docker.internal:1234/v1`), Ollama
(`http://host.docker.internal:11434/v1`), or `mlx_lm.server` on a host port.
For native non-Docker installs with local engines, use
`pip install "abstractgateway[apple]"` or `pip install "abstractgateway[all-apple]"`
on Apple Silicon, and `pip install "abstractgateway[gpu]"` or
`pip install "abstractgateway[all-gpu]"` on GPU workstations.

Compose and deployment details: [docs/deployment.md](docs/deployment.md).

## 0.2.4 capability scope

Direct Gateway APIs in this release:
- `POST /api/gateway/runs/{run_id}/voice/tts`
- `POST /api/gateway/runs/{run_id}/audio/transcribe`
- `POST /api/gateway/runs/{run_id}/images/generate`
- `GET /api/gateway/voice/voices`
- `GET /api/gateway/audio/speech/models`
- `GET /api/gateway/vision/provider_models`
- `/api/gateway/prompt_cache/*` provider/model operator controls
- `/api/gateway/sessions/{session_id}/prompt_cache/*` session lifecycle controls
- `/api/gateway/kg/query` with configurable `lancedb` or in-memory AbstractMemory stores, plus `sqlite` when the installed AbstractMemory build exposes `SQLiteTripleStore`
- `/api/gateway/discovery/capabilities` package, plugin, and thin-client contract discovery

Workflow/Core-backed capabilities:
- Generated images are available to Runtime/Core workflows through
  AbstractVision when installed and configured, and the direct Gateway image
  route uses the same Runtime/Core image-generation contract.
- Prompt-cache support depends on the active provider/model. Session lifecycle
  routes provide Gateway-owned naming and orchestration, not a provider-
  independent local KV cache.

## Client contract (replay-first)

- Clients **start runs**: `POST /api/gateway/runs/start`
- Clients can **schedule runs** (bundle mode): `POST /api/gateway/runs/schedule`
- Clients **act** by submitting durable commands: `POST /api/gateway/commands`
  - supported types: `pause|resume|cancel|emit_event|update_schedule|compact_memory`
- Clients **render** by replaying/streaming the durable ledger:
  - replay: `GET /api/gateway/runs/{run_id}/ledger?after=...`
  - stream (SSE): `GET /api/gateway/runs/{run_id}/ledger/stream?after=...`

See [docs/api.md](docs/api.md) for curl examples and the live OpenAPI spec (`/openapi.json`).

## Install

### Base (runner + stores + CLI)

Requires Python `>=3.10` (see `pyproject.toml`).

```bash
pip install abstractgateway
```

### HTTP API/SSE server (FastAPI + Uvicorn)

```bash
pip install "abstractgateway[http]"
```

### Optional extras

- `abstractgateway[visualflow]`: run VisualFlow JSON from a directory of `*.json` files (requires `abstractflow`)
- `abstractgateway[server]`: container/server profile with AbstractRuntime multimodal support, AbstractCore remote providers, OpenAI-compatible text providers, workflow-backed/direct AbstractVision image generation, direct Gateway voice/audio/image endpoints, provider/session prompt-cache helpers, media/tool helpers, tokens, and compression
- `abstractgateway[memory]`: AbstractMemory TripleStore KG support with LanceDB as the default durable vector-capable backend; in-memory is a runtime config choice, and SQLite is supported when the installed AbstractMemory build exposes `SQLiteTripleStore`
- `abstractgateway[apple]` / `abstractgateway[all-apple]`: full native macOS Python profiles with Apple-local engines and all non-NVIDIA framework capabilities
- `abstractgateway[gpu]` / `abstractgateway[all-gpu]`: full native GPU Python profiles with local GPU engines and all relevant framework capabilities
- `abstractgateway[server-nvidia]`: experimental full NVIDIA profile with vLLM/HuggingFace, local Diffusers image generation, and local voice engines; used by the best-effort `abstractgateway-server-nvidia` image
- `abstractgateway[telegram]`: Telegram bridge dependencies
- `abstractgateway[voice]`: explicit voice/audio profile for TTS/STT via AbstractVoice and AbstractCore's voice/audio plugin extras
- `abstractgateway[vision]`: explicit generative vision profile via AbstractCore's AbstractVision plugin
- `abstractgateway[multimodal]`: Runtime/Core multimodal profile without the HTTP server deps
- `abstractgateway[all]`: batteries-included install (HTTP + tools + voice/audio + vision + media + visualflow)
- `abstractgateway[docs]`: MkDocs site tooling
- `abstractgateway[dev]`: local test/dev deps

### Bundle-dependent dependencies (only if your workflows need them)

- LLM/tool nodes in bundle mode require AbstractRuntime’s AbstractCore integration.
  - Install `abstractgateway[multimodal]`, `abstractgateway[server]`, or `abstractgateway[all]`.

Visual Agent nodes require `abstractagent` (also included by `abstractgateway[server]` and `abstractgateway[all]`):

```bash
pip install abstractagent
```

KG memory nodes use Gateway's memory resolver:

```bash
pip install "abstractgateway[memory]"
export ABSTRACTGATEWAY_MEMORY_STORE_BACKEND=lancedb  # lancedb|memory; sqlite if available
```

Use `memory` for process-local dev/test stores. `sqlite` is supported when the
installed AbstractMemory build exposes `SQLiteTripleStore`.

Gateway has a first-class config helper:

```bash
abstractgateway-config status
abstractgateway config init --env-file .env
```

For details on `ABSTRACTGATEWAY_PROVIDER`/`MODEL`, store backends, and workflow sources, see [docs/configuration.md](docs/configuration.md).

## Creating a `.flow` bundle (authoring)

Use AbstractFlow to pack a bundle:

```bash
abstractflow bundle pack /path/to/root.json --out /path/to/bundles/my.flow --flows-dir /path/to/flows
```

See [docs/getting-started.md](docs/getting-started.md) for running, split API/runner, and file→SQLite migration.

## Docs

Published docs site: https://www.lpalbou.info/AbstractGateway/

### Project docs

- Changelog: [CHANGELOG.md](CHANGELOG.md) (compat: `CHANGELOD.md`)
- Contributing: [CONTRIBUTING.md](CONTRIBUTING.md)
- Security policy (vulnerability reporting): [SECURITY.md](SECURITY.md)
- Acknowledgments: [ACKNOWLEDGMENTS.md](ACKNOWLEDGMENTS.md) (compat: `ACKNOWLEDMENTS.md`)

### Package docs

- Docs index: [docs/README.md](docs/README.md)
- Getting started: [docs/getting-started.md](docs/getting-started.md)
- FAQ: [docs/faq.md](docs/faq.md)
- Architecture: [docs/architecture.md](docs/architecture.md)
- Configuration: [docs/configuration.md](docs/configuration.md)
- Deployment: [docs/deployment.md](docs/deployment.md)
- API overview: [docs/api.md](docs/api.md)
- Security: [docs/security.md](docs/security.md)
- Operator tooling (optional): [docs/maintenance.md](docs/maintenance.md)
