Reference implementation of a 7-stage agentic Video RAG pipeline with:
- Strict YAML config management via OmegaConf + Pydantic.
- Deterministic end-to-end execution for contract validation.
- Evidence-grounded synthesis outputs with uncertainty handling.
This repository is structured for reliable handoff between coding agents and incremental replacement of deterministic adapters with real model/service integrations.
Current implementation is a deterministic, testable reference path with milestones M0.1 through M8.3 marked complete in design/execution_plan.md.
- Product/system contracts:
design/spec_groundtruth.md - Live execution tracker:
design/execution_plan.md - Agent operating rules:
AGENTS.md
uv syncIf you already use the project virtualenv:
.venv/bin/python -V.venv/bin/python scripts/validate_runtime_config.py \
--base config/spec/groundtruth.yaml \
--override config/spec/overrides/dev.yaml.venv/bin/python -m unittest discover -s tests -v.venv/bin/python scripts/run_pipeline_demo.py \
--base config/spec/groundtruth.yamlThe demo returns:
- Validated window IDs.
- Linked entity IDs.
- Grounded claim text.
- Stage timings + cache hit/miss metrics.
| Stage ID | Stage Name | Implementation Anchor |
|---|---|---|
stage_1 |
activity_ingestion |
src/agentic_video_rag/pipeline.py |
stage_2 |
temporal_retrieval |
src/agentic_video_rag/pipeline.py |
stage_3 |
spatial_grounding |
src/agentic_video_rag/pipeline.py |
stage_4 |
entity_resolution |
src/agentic_video_rag/pipeline.py |
stage_5 |
temporal_localization |
src/agentic_video_rag/pipeline.py |
stage_6 |
graph_memory |
src/agentic_video_rag/pipeline.py |
stage_7 |
multimodal_synthesis |
src/agentic_video_rag/pipeline.py |
Core modules:
- Config schema/validation:
src/agentic_video_rag/spec_schema.py - Config merge/load:
src/agentic_video_rag/spec_loader.py - Orchestration contract/runtime:
src/agentic_video_rag/orchestrator_contract.py,src/agentic_video_rag/orchestrator_runtime.py - Deterministic stage adapters:
src/agentic_video_rag/adapters.py - In-memory store abstractions:
src/agentic_video_rag/stores.py - Typed data contracts:
src/agentic_video_rag/types.py - Synthetic fixtures:
src/agentic_video_rag/demo_data.py
Mandatory rules enforced by code:
- YAML config only (
config/spec/groundtruth.yaml+ overrides). - OmegaConf merge order:
base <- overrides. - Pydantic strict validation (
extra="forbid"). stage_catalogis the canonicalstage_id -> stage_namemap.- Stage completeness must include exactly
stage_1..stage_7. - Stage model/datastore/resource references must resolve.
Test files:
tests/test_spec_config.py: config schema and merge behavior.tests/test_orchestrator_contract.py: orchestration contract validation.tests/test_orchestration_runtime.py: transition/hook runtime behavior.tests/test_pipeline_phases.py: stage-level acceptance tests forP2..P8.
Key checks include:
- Stage routing coverage across all 4 ingestion routes.
- Retrieval + cache behavior.
- Grounding fallback.
- ReID ambiguity handling.
- Temporal failure flags.
- Graph evidence completeness.
- Synthesis redaction for insufficient evidence.
- End-to-end red SUV regression flow.
Use this order to reduce risk:
- Keep all tests green with deterministic adapters first.
- Replace one adapter at a time in
src/agentic_video_rag/adapters.py. - Preserve existing data contracts in
src/agentic_video_rag/types.py. - Keep stage outputs evidence-complete before enabling Stage 7.
- Add/adjust tests for each replacement adapter.
Recommended adapter replacement sequence:
SigLIP2AdapterInternVideoNextAdapter+IVNextLiTTextHeadAdapterSAM3AdapterReIDResolverTemporalGroundingAdapterMultimodalSynthesizerAdapter
- Ops runbook:
design/ops_runbook.md - Known limitations:
design/known_limitations.md - Rollback notes:
design/rollback_notes.md - Release sign-off checklist:
design/release_signoff_checklist.md