Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Docs

on:
pull_request:
push:
branches: [ main ]

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-24.04
steps:
- name: Check out the repository
uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install Node
uses: actions/setup-node@v6
with:
node-version: 22

# Ubuntu 24.04 blocks the Chrome sandbox for unprivileged users.
- name: Write the puppeteer config
run: echo '{"args":["--no-sandbox"]}' > "$RUNNER_TEMP/puppeteer.json"

- name: Run the docs check
env:
PUPPETEER_CONFIG: ${{ runner.temp }}/puppeteer.json
run: bash scripts/docs/check.sh

deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: check
runs-on: ubuntu-24.04
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: pages
cancel-in-progress: false
steps:
- name: Check out the repository
uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Configure Pages
uses: actions/configure-pages@v6

- name: Build the site
env:
NO_MKDOCS_2_WARNING: "1"
run: uvx --with mkdocs-material mkdocs build --strict -d site

- name: Upload the site
uses: actions/upload-pages-artifact@v5
with:
path: site

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
54 changes: 54 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# vCon Server

Open source pipeline for vCon conversation records: a FastAPI service, a worker that runs chains of links, and plain Redis between them. Human docs start at `docs/index.md`. Developer setup is in `docs/contributing.md`.

## Layout

- `api/api.py`: the REST API
- `conserver/main.py`: the worker. `conserver/links/` holds links, `conserver/tracers/` holds tracers
- `common/`: shared code. `vcon.py`, `lib/`, `storage/`, `settings.py`, `config.py`
- `tests/`, `common/tests/`, `conserver/tests/`, and tests inside each link folder
- `docker/`: `Dockerfile` for dev and CI, `Dockerfile.api` and `Dockerfile.conserver` for production
- `scripts/docs/`: doc generators and `check.sh`

## Commands

The toolchain is uv with `uv.lock`, never Poetry.

```bash
uv sync --group conserver --group api --group storage-milvus # plain uv sync cannot import the services
uv lock # after a dependency change
uv run pytest conserver/links/tag # host, tests that mock Redis
docker compose run --rm conserver pytest # everything, as CI does
uv run black path/to/changed_file.py # line length 120, changed files only
```

Many tests need Redis, and `-m "not integration"` does not exclude them. `docker compose` needs `.env`, `config.yml` and the `conserver` network: see `docs/getting-started/quick-start.md`.

## Docs check

```bash
bash scripts/docs/check.sh
```

It runs the generators, renders the diagrams and runs `mkdocs build --strict`. Never hand edit `docs/reference/environment.md`, `ports.md`, `api-routes.md` or `metrics.md`.

## Import path trap

The path holds the repo root, `common`, `conserver` and `api` (`pytest.ini`, `docker/Dockerfile`). So:

- `import vcon` resolves to `common/vcon.py`, not the `vcon` package in `pyproject.toml`. Check that file before you call a method.
- Import shared code as `lib.*`: `from lib.vcon_redis import VconRedis`. Use `lib.queue.VconQueue` for queue work.
- Links live in `conserver/links`, not `server/links`, and load as `links.<name>`.
- Vendor transcribe modules are deprecated. Use `links.transcribe`.
- Redis is plain Redis. RedisJSON and Redis Stack appear only in the migration path.

## Consent boundary

Active consent management is outside this repo. The server carries and preserves `lawful_basis` attachments. It never creates, validates, enforces or manages consent, and it does not make a deployment compliant. A missing consent feature here is by design and not a bug. Do not add one, and do not document one. See `docs/concepts/lawful-basis.md`.

## Rules

- Example vCons use `"vcon": "0.4.0"`.
- Keep personal and company names out of issues, commits and pull requests.
- There is no product version. `pyproject.toml` holds a placeholder.
52 changes: 25 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
# vCon Server (Conserver)

vCon Server is a pipeline-based conversation processing and storage system. It ingests [vCon](https://datatracker.ietf.org/doc/draft-ietf-vcon-vcon-container/) (Voice Conversation) records, routes them through configurable processing chains — transcription, AI analysis, tagging, webhooks — and writes results to one or more storage backends.
vCon Server is a pipeline for [vCon](https://datatracker.ietf.org/doc/draft-ietf-vcon-vcon-core/) conversation records. It takes them in, runs them through configurable chains of links (transcription, AI analysis, tagging, routing, webhooks) and writes the results to one or more storage backends.

**Full documentation:** https://vcon-dev.github.io/vcon-server/
**Documentation:** start at [docs/index.md](docs/index.md). The `Docs` workflow publishes the same pages to https://vcon-dev.github.io/vcon-server/.

## Quick Start
## Start the server

```bash
git clone https://github.com/vcon-dev/vcon-server.git
cd vcon-server
cp example_docker-compose.yml docker-compose.yml
cp .env.example .env # edit CONSERVER_API_TOKEN at minimum
docker network create conserver
docker compose up -d --build
curl http://localhost:8000/api/health
```
You need Docker with the Compose plugin. The [quick start](docs/getting-started/quick-start.md) takes you from a fresh clone to a processed vCon. It sets three values in `.env`, writes a small `config.yml`, and starts the stack.

## Documentation by Audience
## Find the docs for your role

| Audience | Start here |
|----------|-----------|
| **New users** | [Getting Started](https://vcon-dev.github.io/vcon-server/getting-started/) |
| **Operators / DevOps** | [Installation](https://vcon-dev.github.io/vcon-server/installation/) · [Configuration](https://vcon-dev.github.io/vcon-server/configuration/) · [Operations](https://vcon-dev.github.io/vcon-server/operations/) |
| **Developers** | [Contributing](https://vcon-dev.github.io/vcon-server/contributing/) · [Extending](https://vcon-dev.github.io/vcon-server/extending/) · [Reference](https://vcon-dev.github.io/vcon-server/reference/) |
| **New users** | [Getting Started](docs/getting-started/index.md) |
| **Operators** | [Installation](docs/installation/index.md), [Configuration](docs/configuration/index.md), [Operations](docs/operations/index.md) |
| **Developers** | [Contributing](docs/contributing.md), [Extending](docs/extending/index.md), [Reference](docs/reference/index.md) |

## Check the main features

## Key Features
- **Chain-based processing:** compose reusable links into pipelines driven by Redis queues
- **Processing links:** [transcription, AI analysis, tagging, routing, webhooks, SCITT and DataTrails records](docs/reference/links/index.md)
- **Storage backends:** [PostgreSQL, MongoDB, S3, Elasticsearch, Milvus, Redis, SFTP and more](docs/reference/storage-adapters/index.md)
- **Multi-worker scaling:** parallel workers, per-worker concurrency and parallel storage writes
- **External ingress:** scoped API keys let third-party systems submit vCons to specific queues
- **OpenTelemetry:** built-in tracing and metrics export

- **Chain-based processing** — compose reusable links into pipelines driven by Redis queues
- **20+ processing links** — transcription (Deepgram, Whisper), AI analysis (OpenAI, Groq), tagging, routing, webhooks, compliance (SCITT, DataTrails)
- **10+ storage backends** — PostgreSQL, MongoDB, S3, Elasticsearch, Milvus, Redis, SFTP, and more
- **Multi-worker scaling** — parallel workers with configurable process count and parallel storage writes
- **External ingress** — scoped API keys let third-party systems submit vCons to specific queues
- **OpenTelemetry** — built-in tracing and metrics export
The server carries `lawful_basis` attachments through the pipeline. It does not create, validate or enforce consent. See [lawful basis](docs/concepts/lawful-basis.md).

## Running Tests
## Run the tests

With the stack running:

```bash
docker compose run --rm conserver pytest conserver/links/analyze/tests/ -v
docker compose run --rm conserver pytest
```

## License
[Contributing](docs/contributing.md) covers local setup with uv.

## Read the license

See [LICENSE](LICENSE).
MIT. See [LICENSE](LICENSE).
36 changes: 23 additions & 13 deletions common/README_CORE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Overview

The vCon Server is a robust processing pipeline designed to handle vCon objects through configurable processing chains. It implements a Redis-based queue system for managing the flow of vCons through various processing stages.
The vCon Server is a processing pipeline that runs vCon objects through configurable chains. Redis lists carry the vCons between stages. The operator manual in `docs/` covers each topic in more depth.

## Core Components

### 1. Main Processing Pipeline (`main.py`)
### 1. Main Processing Pipeline (`conserver/main.py`)

The main processing pipeline is the heart of the vCon server, responsible for:
- Managing processing chains
Expand Down Expand Up @@ -38,7 +38,7 @@ The system uses a `ChainConfig` TypedDict to define processing chains with:
- Processing timeout
- Enable/disable status

### 2. Configuration Management (`config.py`)
### 2. Configuration Management (`common/config.py`)

The configuration system provides:
- YAML-based configuration loading
Expand All @@ -48,7 +48,7 @@ The configuration system provides:
- Import configuration management
- Ingress authentication configuration for external API access

### 3. API Layer (`api.py`)
### 3. API Layer (`api/api.py`)

The API layer provides HTTP endpoints for vCon submission and management:
- RESTful API endpoints using FastAPI
Expand All @@ -62,17 +62,27 @@ The API layer provides HTTP endpoints for vCon submission and management:
- **Multi-tier Authentication**: Different API keys for internal vs external access
- **Scoped Authorization**: External API keys limited to specific ingress lists
- **Input Validation**: Automatic vCon schema validation
- **Error Handling**: Comprehensive HTTP error responses
- **Error Handling**: HTTP error responses
- **Logging**: Detailed request and processing logging

### 4. Redis Queue Management (`redis_mgr.py`)
### 4. Redis Connection Factory (`common/redis_mgr.py`)

The Redis management system provides:
- Connection pool management
- Synchronous and asynchronous client support
- JSON-based key-value operations
- Pattern-based key searching
- Connection lifecycle management
`redis_mgr.py` creates Redis clients and reads and writes JSON documents. It does no queue work.

- `redis`: the shared synchronous client, created from `REDIS_URL` at import. `get_client()` returns it
- `get_async_client()`: returns a new asynchronous client. The API calls it at startup, so the client binds to the running event loop
- `json_set`, `json_get`, `json_set_async`, `json_get_async`, `json_mget_async`: store whole documents as JSON strings in plain Redis keys
- `set_key`, `get_key`, `delete_key`, `show_keys`: key helpers on the shared client

### 5. Queue Management (`common/lib/queue.py`)

`VconQueue` is the entry point for moving vCon ids between lists. Redis stays the implementation, and this is not a pluggable backend.

- `enqueue` appends with RPUSH and `dequeue` pops with BLPOP, which gives FIFO order
- `enqueue_front` prepends with LPUSH, for a worker that must hand back a vCon it popped
- `enqueue_dlq` and `enqueue_storage_dlq` write to the dead letter queues
- `queue_length` and `set_vcon_ttl` read a list length and set a vCon's expiry
- Methods suffixed `_async` take the async client as their first argument

## Processing Flow

Expand Down Expand Up @@ -123,7 +133,7 @@ The system implements multi-tier authentication and authorization:

## Error Handling

The system implements comprehensive error handling:
The system handles errors at these points:
- Link-level error tracking
- Storage operation error handling
- API authentication and authorization errors
Expand Down
6 changes: 3 additions & 3 deletions conserver/links/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ A specialized link that helps reduce the size and content of vCon objects by sel
A simple but effective link that sets an expiration time for vCon objects in Redis, enabling automatic cleanup after a specified period. Useful for data retention policy enforcement and storage optimization.

### @groq_whisper
A specialized link that performs speech-to-text transcription on audio recordings in vCon dialogs using Groq's implementation of the Whisper ASR service, with support for various audio formats and robust error handling.
A specialized link that performs speech-to-text transcription on audio recordings in vCon dialogs using Groq's implementation of the Whisper ASR service, with support for various audio formats and error handling.

### @hugging_face_whisper
A specialized link that performs speech-to-text transcription on audio recordings in vCon dialogs using Hugging Face's implementation of the Whisper ASR service, with support for various audio formats and robust error handling.
A specialized link that performs speech-to-text transcription on audio recordings in vCon dialogs using Hugging Face's implementation of the Whisper ASR service, with support for various audio formats and error handling.

### @hugging_llm_link
A specialized link that performs AI-powered analysis on vCon transcripts using Hugging Face's language models, supporting both API-based and local model inference with configurable parameters and robust error handling.
A specialized link that performs AI-powered analysis on vCon transcripts using Hugging Face's language models, supporting both API-based and local model inference with configurable parameters and error handling.

### @jq_link
A specialized link that filters vCon objects using jq expressions, allowing for complex content-based filtering with configurable forwarding rules for matching or non-matching vCons.
Expand Down
2 changes: 2 additions & 0 deletions conserver/links/analyze/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Analyze Link

Reference: [`links.analyze`](../../../docs/reference/links/analyze.md)

The Analyze link is a powerful plugin that performs AI-powered analysis on vCon transcripts using OpenAI's GPT models. It can generate various types of analysis, such as summaries, sentiment analysis, or any custom analysis based on the provided prompt.

## Features
Expand Down
10 changes: 6 additions & 4 deletions conserver/links/analyze_and_label/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Analyze and Label Link

Reference: [`links.analyze_and_label`](../../../docs/reference/links/analyze-and-label.md)

## Overview

The `analyze_and_label` link is a powerful component of the vCon server that automatically analyzes dialog content and generates relevant labels/tags for categorization. It uses OpenAI's language models to process various dialog formats (transcripts, messages, chats, emails) and extract meaningful labels that are then applied as tags to the vCon.
Expand Down Expand Up @@ -44,7 +46,7 @@ The link accepts the following configuration options:
## Usage Example

```python
from server.links.analyze_and_label import run
from links.analyze_and_label import run

# Run with default options (requires OPENAI_API_KEY in the options)
run(
Expand All @@ -71,23 +73,23 @@ Example specialized prompts:

## Error Handling

The link includes robust error handling:
The link handles errors as follows:

- Exponential backoff retry mechanism for API calls
- JSON parsing error handling
- Logging of errors and performance metrics

## Testing

The link includes comprehensive tests for all functionality. To run the tests with actual OpenAI API calls (optional):
The link has tests for all functionality. To run the tests with actual OpenAI API calls (optional):

```bash
# Set environment variables
export OPENAI_API_KEY="your-api-key"
export RUN_OPENAI_ANALYZE_LABEL_TESTS=1

# Run the tests
pytest server/links/analyze_and_label/tests/test_analyze_and_label.py
pytest conserver/links/analyze_and_label/tests/test_analyze_and_label.py
```

Without setting `RUN_OPENAI_ANALYZE_LABEL_TESTS=1`, tests will run with mocked API responses.
Expand Down
2 changes: 2 additions & 0 deletions conserver/links/analyze_vcon/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Analyze vCon Link

Reference: [`links.analyze_vcon`](../../../docs/reference/links/analyze-vcon.md)

The Analyze vCon link is a specialized plugin that performs AI-powered analysis on entire vCon objects using OpenAI's GPT models. Unlike the standard analyze link that processes individual dialogs, this link analyzes the complete vCon structure and returns structured JSON output.

## Features
Expand Down
10 changes: 6 additions & 4 deletions conserver/links/check_and_tag/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Check and Tag Link

Reference: [`links.check_and_tag`](../../../docs/reference/links/check-and-tag.md)

## Overview

The `check_and_tag` link is a specialized component of the vCon server that evaluates dialog content against a specific question to determine if a particular tag should be applied. It uses OpenAI's language models to process various dialog formats (transcripts, messages, chats, emails) and makes a binary decision about whether a specific tag applies based on an evaluation question.
Expand Down Expand Up @@ -45,7 +47,7 @@ The link accepts the following configuration options:
## Usage Example

```python
from server.links.check_and_tag import run
from links.check_and_tag import run

# Run with required tag_name and evaluation_question
run(
Expand Down Expand Up @@ -73,7 +75,7 @@ Example evaluation questions:

## Error Handling

The link includes robust error handling:
The link handles errors as follows:

- Exponential backoff retry mechanism for API calls
- JSON parsing error handling for evaluation responses
Expand All @@ -82,15 +84,15 @@ The link includes robust error handling:

## Testing

The link includes comprehensive tests for all functionality. To run the tests with actual OpenAI API calls (optional):
The link has tests for all functionality. To run the tests with actual OpenAI API calls (optional):

```bash
# Set environment variables
export OPENAI_API_KEY="your-api-key"
export RUN_OPENAI_CHECK_TAG_TESTS=1

# Run the tests
pytest server/links/check_and_tag/tests/test_check_and_tag.py
pytest conserver/links/check_and_tag/tests/test_check_and_tag.py
```

Without setting `RUN_OPENAI_CHECK_TAG_TESTS=1`, tests will run with mocked API responses.
Expand Down
Loading