veille-supervisor 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- veille_supervisor-0.3.0/.env.example +49 -0
- veille_supervisor-0.3.0/.github/workflows/ci.yml +39 -0
- veille_supervisor-0.3.0/.gitignore +51 -0
- veille_supervisor-0.3.0/CHANGELOG.md +161 -0
- veille_supervisor-0.3.0/PKG-INFO +167 -0
- veille_supervisor-0.3.0/README.md +131 -0
- veille_supervisor-0.3.0/docker-compose.yml +47 -0
- veille_supervisor-0.3.0/docs/adr/001-langgraph-first-adapter.md +42 -0
- veille_supervisor-0.3.0/docs/adr/002-normalized-event-schema.md +43 -0
- veille_supervisor-0.3.0/docs/adr/003-mock-first-litellm.md +42 -0
- veille_supervisor-0.3.0/docs/adr/004-langgraph-callback-instrumentation.md +38 -0
- veille_supervisor-0.3.0/docs/adr/005-otel-event-mapping.md +37 -0
- veille_supervisor-0.3.0/docs/adr/006-enforcement-model.md +50 -0
- veille_supervisor-0.3.0/docs/adr/007-budget-backend-port.md +25 -0
- veille_supervisor-0.3.0/docs/adr/008-plan-tier-cost-model.md +39 -0
- veille_supervisor-0.3.0/docs/adr/009-model-routing.md +45 -0
- veille_supervisor-0.3.0/docs/adr/010-semantic-dedup-caching.md +49 -0
- veille_supervisor-0.3.0/docs/adr/011-memory-governance.md +50 -0
- veille_supervisor-0.3.0/docs/adr/012-cache-policy.md +71 -0
- veille_supervisor-0.3.0/docs/adr/013-local-integration-console.md +126 -0
- veille_supervisor-0.3.0/docs/architecture.md +189 -0
- veille_supervisor-0.3.0/docs/assumptions.md +27 -0
- veille_supervisor-0.3.0/docs/data-contracts.md +262 -0
- veille_supervisor-0.3.0/docs/design-partner-feedback/README.md +84 -0
- veille_supervisor-0.3.0/docs/design-partner-feedback/capture-template.md +59 -0
- veille_supervisor-0.3.0/docs/design-partner-feedback/runs/matrix-analysis.json +1080 -0
- veille_supervisor-0.3.0/docs/design-partner-feedback/system-signals.md +84 -0
- veille_supervisor-0.3.0/docs/development/AI_DEVELOPER_MASTER_PROMPT.md +521 -0
- veille_supervisor-0.3.0/docs/development/AI_RUNTIME_SUPERVISOR_BLUEPRINT.md +568 -0
- veille_supervisor-0.3.0/docs/development/phase-1-plan.md +163 -0
- veille_supervisor-0.3.0/docs/development/phase-2-plan.md +173 -0
- veille_supervisor-0.3.0/docs/development/phase-3-plan.md +155 -0
- veille_supervisor-0.3.0/docs/development/phase-4-plan.md +160 -0
- veille_supervisor-0.3.0/docs/development/phase-5-plan.md +165 -0
- veille_supervisor-0.3.0/docs/evaluation.md +55 -0
- veille_supervisor-0.3.0/docs/guides/litellm-integration.md +49 -0
- veille_supervisor-0.3.0/docs/guides/mock-demo.md +58 -0
- veille_supervisor-0.3.0/docs/guides/openai-agents-sdk.md +46 -0
- veille_supervisor-0.3.0/docs/guides/openrouter-setup.md +34 -0
- veille_supervisor-0.3.0/docs/guides/real-provider-setup.md +81 -0
- veille_supervisor-0.3.0/docs/guides/safe-local-setup.md +52 -0
- veille_supervisor-0.3.0/docs/integrations.md +197 -0
- veille_supervisor-0.3.0/docs/operations.md +155 -0
- veille_supervisor-0.3.0/docs/policy-engine.md +91 -0
- veille_supervisor-0.3.0/docs/real-world-adoption.md +131 -0
- veille_supervisor-0.3.0/docs/release-notes/0.2.0.md +93 -0
- veille_supervisor-0.3.0/docs/roadmap-to-adoption.md +123 -0
- veille_supervisor-0.3.0/docs/roadmap.md +183 -0
- veille_supervisor-0.3.0/docs/runtime-chain.md +116 -0
- veille_supervisor-0.3.0/docs/security-and-privacy.md +39 -0
- veille_supervisor-0.3.0/examples/__init__.py +0 -0
- veille_supervisor-0.3.0/examples/cited_market_research/__init__.py +1 -0
- veille_supervisor-0.3.0/examples/cited_market_research/agent.py +467 -0
- veille_supervisor-0.3.0/examples/cited_market_research/mock_tools.py +86 -0
- veille_supervisor-0.3.0/examples/cited_market_research/task_contract.yaml +20 -0
- veille_supervisor-0.3.0/examples/cited_market_research/trace_capture.py +58 -0
- veille_supervisor-0.3.0/examples/langgraph_demo/__init__.py +1 -0
- veille_supervisor-0.3.0/examples/langgraph_demo/agent.py +138 -0
- veille_supervisor-0.3.0/examples/real_world_demo/__init__.py +1 -0
- veille_supervisor-0.3.0/examples/real_world_demo/agent.py +212 -0
- veille_supervisor-0.3.0/examples/real_world_demo/api.py +124 -0
- veille_supervisor-0.3.0/fixtures/traces/2881dd90-5e06-40cd-884d-96e7c2ef2398.json +964 -0
- veille_supervisor-0.3.0/fixtures/traces/42ecaba2-3cfd-4be8-aa54-3cbd4769f765.json +964 -0
- veille_supervisor-0.3.0/fixtures/traces/expensive_run.json +2110 -0
- veille_supervisor-0.3.0/fixtures/traces/failed_validation_run.json +916 -0
- veille_supervisor-0.3.0/fixtures/traces/success_run.json +914 -0
- veille_supervisor-0.3.0/pyproject.toml +79 -0
- veille_supervisor-0.3.0/scripts/design_partner_demo.py +429 -0
- veille_supervisor-0.3.0/scripts/dev.ps1 +39 -0
- veille_supervisor-0.3.0/scripts/install.ps1 +52 -0
- veille_supervisor-0.3.0/scripts/install.sh +52 -0
- veille_supervisor-0.3.0/src/supervisor/__init__.py +3 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/__init__.py +11 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/generic.py +52 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/langgraph/__init__.py +20 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/langgraph/adapter.py +132 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/langgraph/port.py +53 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/langgraph/stub.py +26 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/litellm/__init__.py +0 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/litellm/mock.py +50 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/openai_agents/__init__.py +3 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/openai_agents/adapter.py +37 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/openai_responses/__init__.py +3 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/openai_responses/adapter.py +36 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/ports.py +59 -0
- veille_supervisor-0.3.0/src/supervisor/adapters/providers/__init__.py +285 -0
- veille_supervisor-0.3.0/src/supervisor/analytics/__init__.py +19 -0
- veille_supervisor-0.3.0/src/supervisor/analytics/run_summary.py +288 -0
- veille_supervisor-0.3.0/src/supervisor/cli.py +323 -0
- veille_supervisor-0.3.0/src/supervisor/console/__init__.py +10 -0
- veille_supervisor-0.3.0/src/supervisor/console/config.py +70 -0
- veille_supervisor-0.3.0/src/supervisor/console/connections.py +80 -0
- veille_supervisor-0.3.0/src/supervisor/console/doctor.py +59 -0
- veille_supervisor-0.3.0/src/supervisor/console/explorer.py +213 -0
- veille_supervisor-0.3.0/src/supervisor/console/run_registry.py +180 -0
- veille_supervisor-0.3.0/src/supervisor/console/server.py +160 -0
- veille_supervisor-0.3.0/src/supervisor/context/__init__.py +20 -0
- veille_supervisor-0.3.0/src/supervisor/context/diversification.py +107 -0
- veille_supervisor-0.3.0/src/supervisor/context/engine.py +64 -0
- veille_supervisor-0.3.0/src/supervisor/contracts/__init__.py +27 -0
- veille_supervisor-0.3.0/src/supervisor/contracts/events.py +65 -0
- veille_supervisor-0.3.0/src/supervisor/contracts/plan.py +50 -0
- veille_supervisor-0.3.0/src/supervisor/contracts/policy.py +34 -0
- veille_supervisor-0.3.0/src/supervisor/contracts/task.py +36 -0
- veille_supervisor-0.3.0/src/supervisor/contracts/validation.py +23 -0
- veille_supervisor-0.3.0/src/supervisor/io.py +37 -0
- veille_supervisor-0.3.0/src/supervisor/memory/__init__.py +23 -0
- veille_supervisor-0.3.0/src/supervisor/memory/governor.py +99 -0
- veille_supervisor-0.3.0/src/supervisor/memory/scoring.py +55 -0
- veille_supervisor-0.3.0/src/supervisor/memory/store.py +111 -0
- veille_supervisor-0.3.0/src/supervisor/optimize/__init__.py +30 -0
- veille_supervisor-0.3.0/src/supervisor/optimize/cache.py +164 -0
- veille_supervisor-0.3.0/src/supervisor/optimize/dedup.py +66 -0
- veille_supervisor-0.3.0/src/supervisor/optimize/keys.py +48 -0
- veille_supervisor-0.3.0/src/supervisor/optimize/policy.py +96 -0
- veille_supervisor-0.3.0/src/supervisor/planning/__init__.py +7 -0
- veille_supervisor-0.3.0/src/supervisor/planning/planner.py +129 -0
- veille_supervisor-0.3.0/src/supervisor/policy/__init__.py +41 -0
- veille_supervisor-0.3.0/src/supervisor/policy/budgets.py +75 -0
- veille_supervisor-0.3.0/src/supervisor/policy/enforcement.py +108 -0
- veille_supervisor-0.3.0/src/supervisor/policy/engine.py +356 -0
- veille_supervisor-0.3.0/src/supervisor/routing/__init__.py +17 -0
- veille_supervisor-0.3.0/src/supervisor/routing/router.py +98 -0
- veille_supervisor-0.3.0/src/supervisor/sdk/__init__.py +8 -0
- veille_supervisor-0.3.0/src/supervisor/sdk/collector.py +73 -0
- veille_supervisor-0.3.0/src/supervisor/sdk/supervisor.py +785 -0
- veille_supervisor-0.3.0/src/supervisor/telemetry/__init__.py +17 -0
- veille_supervisor-0.3.0/src/supervisor/telemetry/exporter.py +150 -0
- veille_supervisor-0.3.0/templates/baseline_report.md +64 -0
- veille_supervisor-0.3.0/tests/adapters/test_langgraph_adapter.py +25 -0
- veille_supervisor-0.3.0/tests/adapters/test_langgraph_stub.py +49 -0
- veille_supervisor-0.3.0/tests/adapters/test_litellm_mock.py +19 -0
- veille_supervisor-0.3.0/tests/analytics/test_run_summary.py +85 -0
- veille_supervisor-0.3.0/tests/cli/test_cli.py +9 -0
- veille_supervisor-0.3.0/tests/console/test_config.py +66 -0
- veille_supervisor-0.3.0/tests/console/test_connections.py +26 -0
- veille_supervisor-0.3.0/tests/console/test_explorer.py +93 -0
- veille_supervisor-0.3.0/tests/console/test_generic_adapter.py +29 -0
- veille_supervisor-0.3.0/tests/console/test_providers.py +61 -0
- veille_supervisor-0.3.0/tests/context/test_context_engine.py +51 -0
- veille_supervisor-0.3.0/tests/contract/__init__.py +1 -0
- veille_supervisor-0.3.0/tests/contract/test_events.py +22 -0
- veille_supervisor-0.3.0/tests/contract/test_fixtures.py +48 -0
- veille_supervisor-0.3.0/tests/contract/test_plan_policy_validation.py +51 -0
- veille_supervisor-0.3.0/tests/contract/test_task_contract.py +29 -0
- veille_supervisor-0.3.0/tests/examples/test_market_research_agent.py +77 -0
- veille_supervisor-0.3.0/tests/examples/test_real_world_demo.py +60 -0
- veille_supervisor-0.3.0/tests/memory/test_governor.py +63 -0
- veille_supervisor-0.3.0/tests/memory/test_scoring.py +36 -0
- veille_supervisor-0.3.0/tests/memory/test_store.py +69 -0
- veille_supervisor-0.3.0/tests/optimize/test_cache.py +36 -0
- veille_supervisor-0.3.0/tests/optimize/test_dedup.py +46 -0
- veille_supervisor-0.3.0/tests/optimize/test_keys.py +22 -0
- veille_supervisor-0.3.0/tests/planning/test_planner.py +38 -0
- veille_supervisor-0.3.0/tests/policy/test_budgets.py +33 -0
- veille_supervisor-0.3.0/tests/policy/test_enforcement.py +69 -0
- veille_supervisor-0.3.0/tests/policy/test_engine.py +80 -0
- veille_supervisor-0.3.0/tests/policy/test_evaluate.py +98 -0
- veille_supervisor-0.3.0/tests/routing/test_router.py +64 -0
- veille_supervisor-0.3.0/tests/sdk/test_cache_policy.py +142 -0
- veille_supervisor-0.3.0/tests/sdk/test_file_cache.py +58 -0
- veille_supervisor-0.3.0/tests/sdk/test_supervisor.py +91 -0
- veille_supervisor-0.3.0/tests/sdk/test_supervisor_enforce.py +81 -0
- veille_supervisor-0.3.0/tests/sdk/test_supervisor_memory.py +75 -0
- veille_supervisor-0.3.0/tests/sdk/test_supervisor_optimize.py +110 -0
- veille_supervisor-0.3.0/tests/sdk/test_supervisor_plan.py +90 -0
- veille_supervisor-0.3.0/tests/telemetry/test_exporter.py +18 -0
- veille_supervisor-0.3.0/tests/telemetry/test_exporter_mapping.py +26 -0
- veille_supervisor-0.3.0/tests/test_io.py +9 -0
- veille_supervisor-0.3.0/ui/index.html +12 -0
- veille_supervisor-0.3.0/ui/package-lock.json +1813 -0
- veille_supervisor-0.3.0/ui/package.json +23 -0
- veille_supervisor-0.3.0/ui/src/App.tsx +48 -0
- veille_supervisor-0.3.0/ui/src/api.ts +111 -0
- veille_supervisor-0.3.0/ui/src/main.tsx +9 -0
- veille_supervisor-0.3.0/ui/src/pages/Adapters.tsx +26 -0
- veille_supervisor-0.3.0/ui/src/pages/Connections.tsx +45 -0
- veille_supervisor-0.3.0/ui/src/pages/Overview.tsx +38 -0
- veille_supervisor-0.3.0/ui/src/pages/Policies.tsx +29 -0
- veille_supervisor-0.3.0/ui/src/pages/RunExplorer.tsx +49 -0
- veille_supervisor-0.3.0/ui/src/pages/Workflows.tsx +43 -0
- veille_supervisor-0.3.0/ui/src/vite-env.d.ts +1 -0
- veille_supervisor-0.3.0/ui/tsconfig.app.json +21 -0
- veille_supervisor-0.3.0/ui/tsconfig.json +6 -0
- veille_supervisor-0.3.0/ui/vite.config.ts +11 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# AI Runtime Supervisor / Veille Console — local development configuration
|
|
2
|
+
# Copy to .env and fill in only if you opt in to real providers.
|
|
3
|
+
|
|
4
|
+
# --- Infrastructure (Docker Compose environment) ---
|
|
5
|
+
# DATABASE_URL=postgresql://supervisor:supervisor_dev@localhost:5432/supervisor
|
|
6
|
+
# REDIS_URL=redis://localhost:6379/0
|
|
7
|
+
# S3_ENDPOINT=http://localhost:9000
|
|
8
|
+
# S3_ACCESS_KEY=minioadmin
|
|
9
|
+
# S3_SECRET_KEY=minioadmin
|
|
10
|
+
# S3_BUCKET=supervisor-artifacts
|
|
11
|
+
|
|
12
|
+
# --- Runtime opt-in flags (SUPERVISOR_* namespace, read by the SDK) ---
|
|
13
|
+
# SUPERVISOR_ENFORCE=true
|
|
14
|
+
# SUPERVISOR_PLAN=1
|
|
15
|
+
# SUPERVISOR_OPTIMIZE=1
|
|
16
|
+
# SUPERVISOR_OPTIMIZE_MODE=active
|
|
17
|
+
# SUPERVISOR_CACHE_APPROVED=1
|
|
18
|
+
# SUPERVISOR_MEMORY=1
|
|
19
|
+
|
|
20
|
+
# --- Console mode (VEILLE_* namespace, read by the ``veille`` CLI) ---
|
|
21
|
+
# Default (off) runs everything in mock mode — no API keys, no external calls.
|
|
22
|
+
VEILLE_REAL_MODE=false
|
|
23
|
+
# VEILLE_PROVIDER=openai
|
|
24
|
+
# VEILLE_MODEL=gpt-4o
|
|
25
|
+
# VEILLE_TOOL_API_BASE_URL=http://localhost:8001
|
|
26
|
+
|
|
27
|
+
# --- Model provider keys (opt-in; mock is default) ---
|
|
28
|
+
# OPENAI_API_KEY=
|
|
29
|
+
# OPENROUTER_API_KEY=
|
|
30
|
+
# ANTHROPIC_API_KEY=
|
|
31
|
+
# GEMINI_API_KEY=
|
|
32
|
+
# LITELLM_MODEL=gpt-4o-mini
|
|
33
|
+
|
|
34
|
+
# --- Cache ---
|
|
35
|
+
VEILLE_CACHE_BACKEND=memory
|
|
36
|
+
# VEILLE_CACHE_APPROVED=true
|
|
37
|
+
|
|
38
|
+
# --- Policy overrides ---
|
|
39
|
+
# VEILLE_OPTIMIZE=true
|
|
40
|
+
# VEILLE_ENFORCE=true
|
|
41
|
+
|
|
42
|
+
# --- Context optimization ---
|
|
43
|
+
# VEILLE_CONTEXT_COMPRESSION=true
|
|
44
|
+
# VEILLE_CONTEXT_DIVERSIFICATION=true
|
|
45
|
+
|
|
46
|
+
# --- Observability ---
|
|
47
|
+
# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
|
|
48
|
+
# OTEL_SERVICE_NAME=veille-dev
|
|
49
|
+
LOG_LEVEL=INFO
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.12"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Ruff lint
|
|
30
|
+
run: ruff check src tests examples
|
|
31
|
+
|
|
32
|
+
- name: Ruff format check
|
|
33
|
+
run: ruff format --check src tests examples
|
|
34
|
+
|
|
35
|
+
- name: Mypy
|
|
36
|
+
run: mypy src/supervisor
|
|
37
|
+
|
|
38
|
+
- name: Pytest
|
|
39
|
+
run: pytest -v
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
.eggs/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
.mypy_cache/
|
|
12
|
+
.ruff_cache/
|
|
13
|
+
.pytest_cache/
|
|
14
|
+
htmlcov/
|
|
15
|
+
.coverage
|
|
16
|
+
|
|
17
|
+
# Environment
|
|
18
|
+
.env
|
|
19
|
+
.env.local
|
|
20
|
+
|
|
21
|
+
# IDE
|
|
22
|
+
.idea/
|
|
23
|
+
.vscode/
|
|
24
|
+
*.swp
|
|
25
|
+
*.swo
|
|
26
|
+
|
|
27
|
+
# OS
|
|
28
|
+
.DS_Store
|
|
29
|
+
Thumbs.db
|
|
30
|
+
|
|
31
|
+
# Project artifacts
|
|
32
|
+
*.log
|
|
33
|
+
.mypy_cache/
|
|
34
|
+
|
|
35
|
+
# Local databases
|
|
36
|
+
*.db
|
|
37
|
+
*.sqlite
|
|
38
|
+
*.sqlite3
|
|
39
|
+
*.duckdb
|
|
40
|
+
|
|
41
|
+
# Coverage outputs
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
coverage.xml
|
|
45
|
+
htmlcov/
|
|
46
|
+
|
|
47
|
+
# Node / UI
|
|
48
|
+
node_modules/
|
|
49
|
+
ui/dist/
|
|
50
|
+
ui/node_modules/
|
|
51
|
+
*.tsbuildinfo
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are documented here. This project follows phase-based delivery.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
### Local Integration Console (ADR-013)
|
|
8
|
+
|
|
9
|
+
- **`veille` CLI**: `doctor`, `connections`, `workflows`, `run`, `runs`, `providers`, `adapters`, `demo`, `explore`, `serve` subcommands. Registered as `[project.scripts] veille` in `pyproject.toml`.
|
|
10
|
+
- **Console backend** (`src/supervisor/console/`): `VeilleSettings` (VEILLE_* env namespace), `doctor_payload()`, `WorkflowInfo`/`AdapterInfo`/`ConnectionInfo` run registry, `explore()` multi-view projection over any `RunEventBatch`, `validate_connection()`, FastAPI server (`/api/health`, `/api/doctor`, `/api/connections`, `/api/workflows`, `/api/runs`, `/api/providers`, `/api/adapters`).
|
|
11
|
+
- **Framework adapter ports** (`src/supervisor/adapters/ports.py`): `FrameworkAdapter` + `RunEventHook` protocols.
|
|
12
|
+
- **Provider drivers** (`src/supervisor/adapters/providers/`): `ModelProvider` port + 8 concrete drivers (LiteLLM, OpenAI, Anthropic, Gemini, OpenRouter, Ollama, LM Studio, OpenAI-compatible). All default to mock; real mode gated behind `VEILLE_REAL_MODE=true`.
|
|
13
|
+
- **Generic adapter** (`src/supervisor/adapters/generic.py`): wraps any callable into an `InstrumentedAgent`.
|
|
14
|
+
- **OpenAI Agents SDK adapter** (`src/supervisor/adapters/openai_agents/`): skeleton with generic fallback.
|
|
15
|
+
- **OpenAI Responses API adapter** (`src/supervisor/adapters/openai_responses/`): skeleton with generic fallback.
|
|
16
|
+
- **SDK extensions**: `model()`/`tool()` accept optional `provider`, `prompt_version`; emit `provider`/`model`/`reuse_reason` attributes. `RoutingDecision` carries `provider` field. `_derive_provider()` maps model strings → provider identifiers.
|
|
17
|
+
- **Run summary extensions**: `RunSummary` adds `providers`, `cache_reuse`, `policy_events`, `intervention_events`, `validation_checks`.
|
|
18
|
+
- **Context diversification** (`src/supervisor/context/diversification.py`): `CompressionReport`/`DiversificationReport`, `compression_reports()`/`diversification_reports()` using `ShingleSemanticKey` + Jaccard.
|
|
19
|
+
- **Router updates**: `_default()` seeds real model candidates (`gpt-4o`, `openrouter/gpt-4o`, `claude-3.5-sonnet`, `gemini-1.5-pro`, `ollama/llama3`, `lmstudio/local-model`) after mock candidates.
|
|
20
|
+
- **React+TypeScript+Vite web UI** (`ui/`): 6 pages (Overview, Workflows, Run Explorer, Connections, Adapters, Policies) consuming FastAPI endpoints.
|
|
21
|
+
- **`ui` optional dependency**: `fastapi`, `uvicorn`, `pydantic-settings` for the web server.
|
|
22
|
+
- **Registered workflows**: `cited_market_research` (mock, langgraph), `real_world_demo` (real-capable, sdk), `langgraph_demo` (mock, langgraph with normalized events).
|
|
23
|
+
- Tests: 34 new console tests (config, providers, adapters, explorer, connections); 165 total passing.
|
|
24
|
+
|
|
25
|
+
### Approved cache policy (post-0.2.0, ADR-012)
|
|
26
|
+
|
|
27
|
+
- **`supervisor/optimize/policy.py`**: `CachePolicy` + `build_cache_key` encode the
|
|
28
|
+
three partner-validated cache rules. `search_competitors` is cacheable only for
|
|
29
|
+
**identical normalized inputs** (exact); semantic/near-duplicate matches are
|
|
30
|
+
recommended, never served. Cache keys include **tenant/project, tool version,
|
|
31
|
+
policy version, and authorization/context boundaries**. Default **300s TTL**;
|
|
32
|
+
expired/uncertain results re-execute. Serving is gated behind partner
|
|
33
|
+
confirmation (`SUPERVISOR_CACHE_APPROVED` override or `SUPERVISOR_CACHE_CONFIRMATIONS >= 3`).
|
|
34
|
+
- **SDK wiring** (`src/supervisor/sdk/supervisor.py`): `tool()`/`model()` serve only
|
|
35
|
+
when approved, allowlisted, idempotent, and exact; composite key + TTL applied.
|
|
36
|
+
- **Adaptive rerouting remains advisory-only** (unchanged).
|
|
37
|
+
- Tests: `tests/sdk/test_cache_policy.py` (6 rules/gate tests); 125 total passing.
|
|
38
|
+
|
|
39
|
+
### Cross-run (durable) caching
|
|
40
|
+
|
|
41
|
+
- **`supervisor/optimize/cache.py`**: new pluggable `CacheBackend` (port) with an
|
|
42
|
+
in-memory `InMemoryCache` (per-run) and a durable `FileCacheBackend` (JSON on
|
|
43
|
+
disk, wall-clock TTL, tenant-scoped by the composite key). `make_backend(...)`
|
|
44
|
+
constructs by kind (`memory`|`file`).
|
|
45
|
+
- **SDK wiring** (`src/supervisor/sdk/supervisor.py`): `Supervisor` accepts a
|
|
46
|
+
`cache_backend` and selects `FileCacheBackend` when `SUPERVISOR_CACHE_BACKEND=file`
|
|
47
|
+
(`SUPERVISOR_CACHE_DIR`). Cross-run cache lookup is by exact composite key and is
|
|
48
|
+
independent of the in-run dedup detector, so a fresh `Supervisor` still reads
|
|
49
|
+
prior runs' cached results (and the same approved `CachePolicy` gates serving).
|
|
50
|
+
- **Real-world demo** (`examples/real_world_demo`): `--cross-run` flag shares a
|
|
51
|
+
durable backend across two runs; under approval the second run serves all
|
|
52
|
+
identical searches (cost $0.008 → $0.004). Tests: `tests/sdk/test_file_cache.py`.
|
|
53
|
+
- 131 total passing (ruff + mypy clean).
|
|
54
|
+
|
|
55
|
+
## [0.2.0] — Phases 1–5 (2026-07-14)
|
|
56
|
+
|
|
57
|
+
### Phase 5 — Memory lifecycle & retrieval governance (implemented)
|
|
58
|
+
|
|
59
|
+
- **Memory store** (`src/supervisor/memory/store.py`): `MemoryBackend` port + `InMemoryMemoryStore` (tenant-isolated, no deps); `MemoryRecord` with tier (working/short/long/archive), provenance, confidence, TTL, and baseline hash for drift; `content_hash` util. Mem0/Letta/customer RAG attach behind the port.
|
|
60
|
+
- **Scoring** (`src/supervisor/memory/scoring.py`): `score(record, now, role_weights)` combines recency (exponential decay), usage, provenance quality, and confidence; metadata-driven, no embeddings by default. `default_role_weights` nudge tier preference by role.
|
|
61
|
+
- **Governor** (`src/supervisor/memory/governor.py`): `MemoryManifest` + `MemoryGovernor.retrieve(...)` scores candidates, flags `stale` (recency/confidence) and `drift` (content hash vs baseline), and emits an included/excluded/stale/drift/scores/reason manifest. `expire_due(...)` surfaces TTL-elapsed records for **audited** removal — no automatic deletion.
|
|
62
|
+
- **Event schema 0.2.0 (additive):** `memory.retrieved` carries the governance manifest; new `memory.expired` records expiry candidates and explicit removals.
|
|
63
|
+
- **SDK wiring** (`src/supervisor/sdk/supervisor.py`): `Supervisor.remember`, `retrieve_memory`, `expire_memory`, `forget_memory`; gated by `SUPERVISOR_MEMORY=1`. Off-mode `retrieve_memory` is a no-op passthrough (identical to Phase 4).
|
|
64
|
+
- **Run summary** (`src/supervisor/analytics/run_summary.py`): `memories_retrieved`, `memories_stale`, `memories_drift`, `memories_expired`.
|
|
65
|
+
- **Demo:** researcher node stores a working memory and retrieves it on subsequent calls when `SUPERVISOR_MEMORY=1`.
|
|
66
|
+
- **Tests:** store, scoring, governor, SDK memory, demo memory — 119 total.
|
|
67
|
+
- **Docs:** ADR-011 (memory governance), data-contracts / architecture / runtime-chain / integrations / operations / roadmap / README updates.
|
|
68
|
+
|
|
69
|
+
### Phase 4 — Semantic dedup and adaptive caching (implemented)
|
|
70
|
+
|
|
71
|
+
- **Semantic key** (`src/supervisor/optimize/keys.py`): `ShingleSemanticKey` tokenizes input into word-shingles and compares with Jaccard similarity (default threshold 0.85). Embedding backend is a future `SemanticKey` port.
|
|
72
|
+
- **Near-duplicate detector** (`src/supervisor/optimize/dedup.py`): `DuplicateDetector` returns `DuplicateMatch` (`exact` | `semantic`, `similarity`, `cache_key`) for in-run `(tool, input)` calls.
|
|
73
|
+
- **Cache backend** (`src/supervisor/optimize/cache.py`): `CacheBackend` port with `InMemoryCache` (bounded LRU-ish FIFO + per-entry TTL). Redis is a later backend behind the same port.
|
|
74
|
+
- **Event schema 0.2.0** (`src/supervisor/contracts/events.py`): new `optimization.recommended` / `optimization.applied`; `tool.requested` / `model.requested` gain `match_type` + `similarity`; `optimization.*` carry `cache_key`, `cache_hit`, `estimated_savings_usd`. Additive over 0.1.0.
|
|
75
|
+
- **SDK wiring** (`src/supervisor/sdk/supervisor.py`): `Supervisor.tool(idempotent=)` / `model(cacheable=)` consult detector + cache. Dry-run recommends; active serves idempotent cache hits and skips re-execution. Gated by `SUPERVISOR_OPTIMIZE` (`dry_run` default, `SUPERVISOR_OPTIMIZE_MODE=active`).
|
|
76
|
+
- **Run summary** (`src/supervisor/analytics/run_summary.py`): `cache_hits`, `cache_served`, `semantic_duplicates`, `estimated_savings_usd`.
|
|
77
|
+
- **Demo:** idempotent tool calls are cached when optimization is enabled; expensive scenario serves the duplicate `search_competitors` from cache in active mode.
|
|
78
|
+
- **Tests:** keys, dedup, cache, SDK dry-run/active, demo optimization — 99 total.
|
|
79
|
+
- **Docs:** ADR-010 (semantic dedup + caching + dry-run opt-in), data-contracts / architecture / runtime-chain / integrations / operations / roadmap / README updates.
|
|
80
|
+
|
|
81
|
+
### Phase 3 — Planner, context, routing (implemented)
|
|
82
|
+
|
|
83
|
+
- **Plan tiers** (`src/supervisor/contracts/plan.py`): `PlanTier` (minimum / balanced /
|
|
84
|
+
high_quality / maximum_assurance), `TierEstimate`, `PlanStep`, `ExecutionPlan`.
|
|
85
|
+
- **Planner** (`src/supervisor/planning/planner.py`): deterministic `select_tier(task)`
|
|
86
|
+
(risk baseline, cost bump, critical clamp) and `Planner.build_plan` → `ExecutionPlan`
|
|
87
|
+
with tier options (cost/latency multipliers) and steps; one option marked `recommended`.
|
|
88
|
+
- **Context engine** (`src/supervisor/context/engine.py`): `ContextEngine.build_manifest`
|
|
89
|
+
builds a role-sensitive `ContextManifest` (included / excluded / compressed slices +
|
|
90
|
+
estimated tokens) deterministically from a master context.
|
|
91
|
+
- **Model routing** (`src/supervisor/routing/router.py`): `ModelRegistry` + `ModelRouter.select`
|
|
92
|
+
returns a tier-aware `RoutingDecision` (capability + tier + allowed_models; deterministic;
|
|
93
|
+
safe static fallback for empty registries).
|
|
94
|
+
- **SDK wiring** (`src/supervisor/sdk/supervisor.py`): `Supervisor.plan()`, `route_model()`,
|
|
95
|
+
`model(routing=)`, `context(master_context=)`; `start_run` records the planned `tier`.
|
|
96
|
+
- **Run summary** (`src/supervisor/analytics/run_summary.py`): `RunSummary.plan_tier` and
|
|
97
|
+
`routing[]` derived from routed `model.requested` events (`routing_tier` /
|
|
98
|
+
`routing_capability` / `routing_reason`).
|
|
99
|
+
- **Advisory by default:** gated behind `SUPERVISOR_PLAN=1` (mirroring `SUPERVISOR_ENFORCE`);
|
|
100
|
+
never blocks or rewrites execution.
|
|
101
|
+
- **Demo:** `examples/cited_market_research/agent.py` wires researcher/analyst/writer through
|
|
102
|
+
the planner, router, and context engine when `SUPERVISOR_PLAN=1`.
|
|
103
|
+
- **Tests:** planning, context, routing, SDK integration — 79 total.
|
|
104
|
+
- **Docs:** ADR-008 (tier/cost model), ADR-009 (routing), data-contracts / architecture /
|
|
105
|
+
runtime-chain / integrations / operations / roadmap / README updates.
|
|
106
|
+
|
|
107
|
+
### Phase 2 — Deterministic protection (implemented)
|
|
108
|
+
|
|
109
|
+
- **Enforcement engine** (`src/supervisor/policy/enforcement.py`): `Enforcer` +
|
|
110
|
+
`GuardDecision`; exceptions `InterventionError` / `StopRun` / `PauseForApproval` /
|
|
111
|
+
`BlockedByPolicy`. Detection (`evaluate`) separated from action.
|
|
112
|
+
- **Deterministic policies** (`src/supervisor/policy/engine.py`): `duplicate_tool_protection`
|
|
113
|
+
(block/dedupe), `retry_budget` (stop), `cost_budget` (stop), `stall_protection` (stop),
|
|
114
|
+
`loop_protection` (stop). Default mode `enforce`; gated by `Supervisor(enforce=True)`
|
|
115
|
+
or `SUPERVISOR_ENFORCE=true`.
|
|
116
|
+
- **Budgets** (`src/supervisor/policy/budgets.py`): `BudgetTracker` behind a
|
|
117
|
+
`CounterBackend` port (in-memory default, Redis optional).
|
|
118
|
+
- **SDK guards** (`src/supervisor/sdk/supervisor.py`): `tool()` dedupes blocked duplicates,
|
|
119
|
+
`retry()` stops on budget exhaustion; `emit_intervention` / `consult` / `act` helpers.
|
|
120
|
+
- **Audit:** every action emits `intervention.applied` with `action`, `policy_id`, `reason`,
|
|
121
|
+
and `human_review_required`.
|
|
122
|
+
- **Safe default:** observe mode is byte-for-byte identical to Phase 1.
|
|
123
|
+
- **Demo:** opt-in enforcement via `SUPERVISOR_ENFORCE`; the expensive scenario is stopped
|
|
124
|
+
on retry-budget exhaustion.
|
|
125
|
+
- **Tests:** policy evaluate, enforcement, budgets, SDK enforcement, adapter — 60 total.
|
|
126
|
+
- **Docs:** ADR-006 (enforcement model), ADR-007 (budget backend), policy-engine /
|
|
127
|
+
data-contracts / roadmap updates.
|
|
128
|
+
|
|
129
|
+
### Phase 1 — Observe and explain (implemented)
|
|
130
|
+
|
|
131
|
+
- **Python SDK** (`src/supervisor/sdk/`): `Supervisor` emission helpers
|
|
132
|
+
(`start_run`, `finish_run`, `model`, `tool`, `retry`, `context`, `node`,
|
|
133
|
+
`emit_validation`) and `RunCollector` aggregation.
|
|
134
|
+
- **LangGraph adapter** (`src/supervisor/adapters/langgraph/adapter.py`): callback-based
|
|
135
|
+
automatic instrumentation; agent authors call `adapter.attach(graph)` only.
|
|
136
|
+
- **Run summary analytics** (`src/supervisor/analytics/run_summary.py`): `summarize()`
|
|
137
|
+
produces a `RunSummary` (tool call counts, duplicates, retries, cost, timeline,
|
|
138
|
+
policy observations, validation result).
|
|
139
|
+
- **Observe-only policy engine** (`src/supervisor/policy/engine.py`): `evaluate_observe`
|
|
140
|
+
detects duplicate tool calls, retry storms (budget 5), cost overruns, and validation
|
|
141
|
+
failures; emits `policy.triggered` events. Never alters execution.
|
|
142
|
+
- **OTel exporter** (`src/supervisor/telemetry/exporter.py`): `ConsoleOTelExporter`
|
|
143
|
+
(default) and `OtlpExporter` (OTLP/gRPC) via `event_to_span`.
|
|
144
|
+
- **Run-explorer CLI** (`src/supervisor/cli.py`): `explore` subcommand for fixtures
|
|
145
|
+
(`--run`) or live runs (`--live --scenario`) with `--policy` and `--otel` flags.
|
|
146
|
+
- **Demo refactor** (`examples/cited_market_research/agent.py`): now uses the SDK;
|
|
147
|
+
`trace_capture.py` reduced to `validate_brief` input validation only.
|
|
148
|
+
- **Tests:** sdk, analytics, policy, telemetry mapping, langgraph adapter, cli, and
|
|
149
|
+
demo smoke — 39 tests passing.
|
|
150
|
+
- **Docs:** ADR-004 (LangGraph callbacks), ADR-005 (OTel mapping), event attributes
|
|
151
|
+
registry in `data-contracts.md`, updated architecture/runtime-chain/policy-engine/
|
|
152
|
+
integrations/operations/roadmap.
|
|
153
|
+
- **Quality gates:** `ruff`, `mypy --strict`, `pytest` all green on Python 3.14.
|
|
154
|
+
|
|
155
|
+
## [0.1.0] — Phase 0 baseline (2026-07-14)
|
|
156
|
+
|
|
157
|
+
- Data contracts v0.1: task contract, run events, validation report.
|
|
158
|
+
- Adapter ports: LangGraph (interface), LiteLLM mock, OTel interface.
|
|
159
|
+
- Synthetic cited market-research LangGraph workflow.
|
|
160
|
+
- Trace fixtures (success, expensive, failed_validation).
|
|
161
|
+
- Documentation system, docker compose, CI, dev scripts.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: veille-supervisor
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Control plane for production AI-agent work: plan, govern, and verify agent runs.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Raphel6969/Veille
|
|
6
|
+
Project-URL: Repository, https://github.com/Raphel6969/Veille
|
|
7
|
+
Project-URL: Documentation, https://github.com/Raphel6969/Veille/tree/main/docs
|
|
8
|
+
Project-URL: Issues, https://github.com/Raphel6969/Veille/issues
|
|
9
|
+
Author: AI Runtime Supervisor Team
|
|
10
|
+
License: MIT
|
|
11
|
+
Keywords: agents,ai,control-plane,llm,observability,supervisor
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Requires-Python: >=3.12
|
|
19
|
+
Requires-Dist: langchain-core<1,>=0.3
|
|
20
|
+
Requires-Dist: langgraph<1,>=0.2
|
|
21
|
+
Requires-Dist: pydantic-settings<3,>=2.6
|
|
22
|
+
Requires-Dist: pydantic<3,>=2.10
|
|
23
|
+
Requires-Dist: pyyaml<7,>=6.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: mypy<2,>=1.13; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest-asyncio<1,>=0.24; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest<9,>=8.3; extra == 'dev'
|
|
28
|
+
Requires-Dist: ruff<1,>=0.8; extra == 'dev'
|
|
29
|
+
Requires-Dist: types-pyyaml<7,>=6.0; extra == 'dev'
|
|
30
|
+
Provides-Extra: litellm
|
|
31
|
+
Requires-Dist: litellm<2,>=1.55; extra == 'litellm'
|
|
32
|
+
Provides-Extra: ui
|
|
33
|
+
Requires-Dist: fastapi<1,>=0.110; extra == 'ui'
|
|
34
|
+
Requires-Dist: uvicorn<1,>=0.30; extra == 'ui'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# AI Runtime Supervisor / Veille Console
|
|
38
|
+
|
|
39
|
+
Control plane for production AI-agent work. The Supervisor plans, contextualizes, routes, governs, and verifies each agent run—reducing wasted spend and unreliable outcomes without requiring teams to rebuild their applications.
|
|
40
|
+
|
|
41
|
+
**Current release:** [0.2.0](docs/release-notes/0.2.0.md) — Phases 1–5 + **Local Integration Console**. Event schema `0.2.0`. All capabilities are opt-in and off by default.
|
|
42
|
+
|
|
43
|
+
## What exists today
|
|
44
|
+
|
|
45
|
+
- Versioned data contracts (task, events, plan, policy, validation)
|
|
46
|
+
- Python SDK (`Supervisor` + `RunCollector`) for zero-touch event emission
|
|
47
|
+
- LangGraph adapter with automatic callback-based instrumentation
|
|
48
|
+
- **OpenAI Agents SDK adapter** and **OpenAI Responses API adapter** (skeleton)
|
|
49
|
+
- **Model provider port** with 8 provider drivers (LiteLLM, OpenAI, Anthropic, Gemini, OpenRouter, Ollama, LM Studio, OpenAI-compatible)
|
|
50
|
+
- Synthetic cited market-research LangGraph demo workflow with mock tools
|
|
51
|
+
- Representative trace fixtures for success, expensive, and failed-validation runs
|
|
52
|
+
- Observe-only policy engine (duplicate detection, retry budget, cost overrun, validation)
|
|
53
|
+
- **Opt-in enforcement** (Phase 2): block / retry / pause / stop with full audit trail
|
|
54
|
+
- Budget tracking (`BudgetTracker`, in-memory default, Redis backend port)
|
|
55
|
+
- Run-explorer CLI and OpenTelemetry export (Console + OTLP)
|
|
56
|
+
- **Advisory planning** (Phase 3): tier selection, per-step context manifests, capability+tier model routing
|
|
57
|
+
- **Adaptive optimization** (Phase 4): semantic near-duplicate detection + idempotent result caching (`SUPERVISOR_OPTIMIZE`, dry-run default)
|
|
58
|
+
- **Memory governance** (Phase 5): memory store + scoring + governor (`memory.retrieved`/`memory.expired` manifest) with audited expiry, no automatic deletion (`SUPERVISOR_MEMORY`)
|
|
59
|
+
- **Local Integration Console** (`veille` CLI + FastAPI + React web UI) — register workflows, connect providers, run live, inspect execution
|
|
60
|
+
- Local development environment (Docker Compose + pytest)
|
|
61
|
+
|
|
62
|
+
## Quickstart
|
|
63
|
+
|
|
64
|
+
### Prerequisites
|
|
65
|
+
|
|
66
|
+
- Python 3.12+
|
|
67
|
+
- Docker Desktop (optional, for Postgres/Redis/MinIO scaffold)
|
|
68
|
+
|
|
69
|
+
### Setup (Windows)
|
|
70
|
+
|
|
71
|
+
```powershell
|
|
72
|
+
.\scripts\dev.ps1
|
|
73
|
+
.\.venv\Scripts\Activate.ps1
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Run tests
|
|
77
|
+
|
|
78
|
+
```powershell
|
|
79
|
+
pytest -v
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Use the console
|
|
83
|
+
|
|
84
|
+
```powershell
|
|
85
|
+
# Doctor — environment + safe-config report
|
|
86
|
+
veille doctor
|
|
87
|
+
|
|
88
|
+
# List provider connections
|
|
89
|
+
veille connections
|
|
90
|
+
veille connections validate openai
|
|
91
|
+
|
|
92
|
+
# List registered workflows
|
|
93
|
+
veille workflows
|
|
94
|
+
|
|
95
|
+
# Run the mock demo
|
|
96
|
+
veille demo mock
|
|
97
|
+
|
|
98
|
+
# Run the real-world demo
|
|
99
|
+
veille demo real-world
|
|
100
|
+
|
|
101
|
+
# List saved runs
|
|
102
|
+
veille runs
|
|
103
|
+
|
|
104
|
+
# Run an arbitrary registered workflow
|
|
105
|
+
veille run cited_market_research --input '{"scenario":"success"}'
|
|
106
|
+
|
|
107
|
+
# Start the web UI (then open http://127.0.0.1:8000)
|
|
108
|
+
veille serve
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Run the classic demo workflow
|
|
112
|
+
|
|
113
|
+
```powershell
|
|
114
|
+
# Successful run
|
|
115
|
+
python -m examples.cited_market_research.agent --scenario success
|
|
116
|
+
|
|
117
|
+
# All scenarios + write trace fixtures
|
|
118
|
+
python -m examples.cited_market_research.agent --scenario all --write-fixtures
|
|
119
|
+
|
|
120
|
+
# Phase 1 run explorer (inspect a captured run)
|
|
121
|
+
python -m supervisor.cli explore --run fixtures/traces/expensive_run.json --policy
|
|
122
|
+
|
|
123
|
+
# Live run with policy observations and OTel export
|
|
124
|
+
python -m supervisor.cli explore --live --scenario expensive --policy --otel
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
No API keys required. Mock models and tools are used by default.
|
|
128
|
+
|
|
129
|
+
## Repository layout
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
src/supervisor/ Core contracts, SDK, adapters, analytics, policy, telemetry, CLI, console
|
|
133
|
+
examples/ Runnable demo workflows
|
|
134
|
+
fixtures/traces/ Synthetic trace JSON for tests and baselines
|
|
135
|
+
docs/ Architecture, contracts, roadmap, ADRs
|
|
136
|
+
docs/development/ Source master prompt, blueprint, phase plans
|
|
137
|
+
ui/ React+TypeScript+Vite web UI (veille console frontend)
|
|
138
|
+
templates/ Baseline measurement templates
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Documentation
|
|
142
|
+
|
|
143
|
+
| Document | Description |
|
|
144
|
+
|---|---|
|
|
145
|
+
| [Architecture](docs/architecture.md) | System components and boundaries |
|
|
146
|
+
| [Runtime chain](docs/runtime-chain.md) | Stage-by-stage runtime flow |
|
|
147
|
+
| [Data contracts](docs/data-contracts.md) | Schema reference |
|
|
148
|
+
| [Roadmap](docs/roadmap.md) | Phase status and deferrals |
|
|
149
|
+
| [Integrations](docs/integrations.md) | Adapter contracts + provider drivers |
|
|
150
|
+
| [Operations](docs/operations.md) | Local dev, commands, runbooks |
|
|
151
|
+
| [Policy engine](docs/policy-engine.md) | Policy modes and Phase 1 observe policies |
|
|
152
|
+
| [ADR-013](docs/adr/013-local-integration-console.md) | Local Integration Console design |
|
|
153
|
+
|
|
154
|
+
### Setup guides
|
|
155
|
+
|
|
156
|
+
| Guide | Description |
|
|
157
|
+
|---|---|
|
|
158
|
+
| [Safe local setup](docs/guides/safe-local-setup.md) | Running with mock providers (default) |
|
|
159
|
+
| [Mock demo walkthrough](docs/guides/mock-demo.md) | End-to-end mock demo |
|
|
160
|
+
| [Real provider setup](docs/guides/real-provider-setup.md) | Setting up real model providers |
|
|
161
|
+
| [OpenRouter integration](docs/guides/openrouter-setup.md) | Using OpenRouter as a gateway |
|
|
162
|
+
| [OpenAI Agents SDK](docs/guides/openai-agents-sdk.md) | Running an OpenAI Agents SDK workflow |
|
|
163
|
+
| [LiteLLM integration](docs/guides/litellm-integration.md) | Using LiteLLM for multi-provider access |
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
MIT
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# AI Runtime Supervisor / Veille Console
|
|
2
|
+
|
|
3
|
+
Control plane for production AI-agent work. The Supervisor plans, contextualizes, routes, governs, and verifies each agent run—reducing wasted spend and unreliable outcomes without requiring teams to rebuild their applications.
|
|
4
|
+
|
|
5
|
+
**Current release:** [0.2.0](docs/release-notes/0.2.0.md) — Phases 1–5 + **Local Integration Console**. Event schema `0.2.0`. All capabilities are opt-in and off by default.
|
|
6
|
+
|
|
7
|
+
## What exists today
|
|
8
|
+
|
|
9
|
+
- Versioned data contracts (task, events, plan, policy, validation)
|
|
10
|
+
- Python SDK (`Supervisor` + `RunCollector`) for zero-touch event emission
|
|
11
|
+
- LangGraph adapter with automatic callback-based instrumentation
|
|
12
|
+
- **OpenAI Agents SDK adapter** and **OpenAI Responses API adapter** (skeleton)
|
|
13
|
+
- **Model provider port** with 8 provider drivers (LiteLLM, OpenAI, Anthropic, Gemini, OpenRouter, Ollama, LM Studio, OpenAI-compatible)
|
|
14
|
+
- Synthetic cited market-research LangGraph demo workflow with mock tools
|
|
15
|
+
- Representative trace fixtures for success, expensive, and failed-validation runs
|
|
16
|
+
- Observe-only policy engine (duplicate detection, retry budget, cost overrun, validation)
|
|
17
|
+
- **Opt-in enforcement** (Phase 2): block / retry / pause / stop with full audit trail
|
|
18
|
+
- Budget tracking (`BudgetTracker`, in-memory default, Redis backend port)
|
|
19
|
+
- Run-explorer CLI and OpenTelemetry export (Console + OTLP)
|
|
20
|
+
- **Advisory planning** (Phase 3): tier selection, per-step context manifests, capability+tier model routing
|
|
21
|
+
- **Adaptive optimization** (Phase 4): semantic near-duplicate detection + idempotent result caching (`SUPERVISOR_OPTIMIZE`, dry-run default)
|
|
22
|
+
- **Memory governance** (Phase 5): memory store + scoring + governor (`memory.retrieved`/`memory.expired` manifest) with audited expiry, no automatic deletion (`SUPERVISOR_MEMORY`)
|
|
23
|
+
- **Local Integration Console** (`veille` CLI + FastAPI + React web UI) — register workflows, connect providers, run live, inspect execution
|
|
24
|
+
- Local development environment (Docker Compose + pytest)
|
|
25
|
+
|
|
26
|
+
## Quickstart
|
|
27
|
+
|
|
28
|
+
### Prerequisites
|
|
29
|
+
|
|
30
|
+
- Python 3.12+
|
|
31
|
+
- Docker Desktop (optional, for Postgres/Redis/MinIO scaffold)
|
|
32
|
+
|
|
33
|
+
### Setup (Windows)
|
|
34
|
+
|
|
35
|
+
```powershell
|
|
36
|
+
.\scripts\dev.ps1
|
|
37
|
+
.\.venv\Scripts\Activate.ps1
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Run tests
|
|
41
|
+
|
|
42
|
+
```powershell
|
|
43
|
+
pytest -v
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Use the console
|
|
47
|
+
|
|
48
|
+
```powershell
|
|
49
|
+
# Doctor — environment + safe-config report
|
|
50
|
+
veille doctor
|
|
51
|
+
|
|
52
|
+
# List provider connections
|
|
53
|
+
veille connections
|
|
54
|
+
veille connections validate openai
|
|
55
|
+
|
|
56
|
+
# List registered workflows
|
|
57
|
+
veille workflows
|
|
58
|
+
|
|
59
|
+
# Run the mock demo
|
|
60
|
+
veille demo mock
|
|
61
|
+
|
|
62
|
+
# Run the real-world demo
|
|
63
|
+
veille demo real-world
|
|
64
|
+
|
|
65
|
+
# List saved runs
|
|
66
|
+
veille runs
|
|
67
|
+
|
|
68
|
+
# Run an arbitrary registered workflow
|
|
69
|
+
veille run cited_market_research --input '{"scenario":"success"}'
|
|
70
|
+
|
|
71
|
+
# Start the web UI (then open http://127.0.0.1:8000)
|
|
72
|
+
veille serve
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Run the classic demo workflow
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
# Successful run
|
|
79
|
+
python -m examples.cited_market_research.agent --scenario success
|
|
80
|
+
|
|
81
|
+
# All scenarios + write trace fixtures
|
|
82
|
+
python -m examples.cited_market_research.agent --scenario all --write-fixtures
|
|
83
|
+
|
|
84
|
+
# Phase 1 run explorer (inspect a captured run)
|
|
85
|
+
python -m supervisor.cli explore --run fixtures/traces/expensive_run.json --policy
|
|
86
|
+
|
|
87
|
+
# Live run with policy observations and OTel export
|
|
88
|
+
python -m supervisor.cli explore --live --scenario expensive --policy --otel
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
No API keys required. Mock models and tools are used by default.
|
|
92
|
+
|
|
93
|
+
## Repository layout
|
|
94
|
+
|
|
95
|
+
```text
|
|
96
|
+
src/supervisor/ Core contracts, SDK, adapters, analytics, policy, telemetry, CLI, console
|
|
97
|
+
examples/ Runnable demo workflows
|
|
98
|
+
fixtures/traces/ Synthetic trace JSON for tests and baselines
|
|
99
|
+
docs/ Architecture, contracts, roadmap, ADRs
|
|
100
|
+
docs/development/ Source master prompt, blueprint, phase plans
|
|
101
|
+
ui/ React+TypeScript+Vite web UI (veille console frontend)
|
|
102
|
+
templates/ Baseline measurement templates
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Documentation
|
|
106
|
+
|
|
107
|
+
| Document | Description |
|
|
108
|
+
|---|---|
|
|
109
|
+
| [Architecture](docs/architecture.md) | System components and boundaries |
|
|
110
|
+
| [Runtime chain](docs/runtime-chain.md) | Stage-by-stage runtime flow |
|
|
111
|
+
| [Data contracts](docs/data-contracts.md) | Schema reference |
|
|
112
|
+
| [Roadmap](docs/roadmap.md) | Phase status and deferrals |
|
|
113
|
+
| [Integrations](docs/integrations.md) | Adapter contracts + provider drivers |
|
|
114
|
+
| [Operations](docs/operations.md) | Local dev, commands, runbooks |
|
|
115
|
+
| [Policy engine](docs/policy-engine.md) | Policy modes and Phase 1 observe policies |
|
|
116
|
+
| [ADR-013](docs/adr/013-local-integration-console.md) | Local Integration Console design |
|
|
117
|
+
|
|
118
|
+
### Setup guides
|
|
119
|
+
|
|
120
|
+
| Guide | Description |
|
|
121
|
+
|---|---|
|
|
122
|
+
| [Safe local setup](docs/guides/safe-local-setup.md) | Running with mock providers (default) |
|
|
123
|
+
| [Mock demo walkthrough](docs/guides/mock-demo.md) | End-to-end mock demo |
|
|
124
|
+
| [Real provider setup](docs/guides/real-provider-setup.md) | Setting up real model providers |
|
|
125
|
+
| [OpenRouter integration](docs/guides/openrouter-setup.md) | Using OpenRouter as a gateway |
|
|
126
|
+
| [OpenAI Agents SDK](docs/guides/openai-agents-sdk.md) | Running an OpenAI Agents SDK workflow |
|
|
127
|
+
| [LiteLLM integration](docs/guides/litellm-integration.md) | Using LiteLLM for multi-provider access |
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
MIT
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
services:
|
|
2
|
+
postgres:
|
|
3
|
+
image: postgres:16-alpine
|
|
4
|
+
environment:
|
|
5
|
+
POSTGRES_USER: supervisor
|
|
6
|
+
POSTGRES_PASSWORD: supervisor_dev
|
|
7
|
+
POSTGRES_DB: supervisor
|
|
8
|
+
ports:
|
|
9
|
+
- "5432:5432"
|
|
10
|
+
volumes:
|
|
11
|
+
- postgres_data:/var/lib/postgresql/data
|
|
12
|
+
healthcheck:
|
|
13
|
+
test: ["CMD-SHELL", "pg_isready -U supervisor -d supervisor"]
|
|
14
|
+
interval: 5s
|
|
15
|
+
timeout: 5s
|
|
16
|
+
retries: 5
|
|
17
|
+
|
|
18
|
+
redis:
|
|
19
|
+
image: redis:7-alpine
|
|
20
|
+
ports:
|
|
21
|
+
- "6379:6379"
|
|
22
|
+
healthcheck:
|
|
23
|
+
test: ["CMD", "redis-cli", "ping"]
|
|
24
|
+
interval: 5s
|
|
25
|
+
timeout: 5s
|
|
26
|
+
retries: 5
|
|
27
|
+
|
|
28
|
+
minio:
|
|
29
|
+
image: minio/minio:latest
|
|
30
|
+
command: server /data --console-address ":9001"
|
|
31
|
+
environment:
|
|
32
|
+
MINIO_ROOT_USER: minioadmin
|
|
33
|
+
MINIO_ROOT_PASSWORD: minioadmin
|
|
34
|
+
ports:
|
|
35
|
+
- "9000:9000"
|
|
36
|
+
- "9001:9001"
|
|
37
|
+
volumes:
|
|
38
|
+
- minio_data:/data
|
|
39
|
+
healthcheck:
|
|
40
|
+
test: ["CMD", "mc", "ready", "local"]
|
|
41
|
+
interval: 5s
|
|
42
|
+
timeout: 5s
|
|
43
|
+
retries: 5
|
|
44
|
+
|
|
45
|
+
volumes:
|
|
46
|
+
postgres_data:
|
|
47
|
+
minio_data:
|