Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
669f54c
add verdict dataclasses and canonical sentence renderer
furyfist Jul 22, 2026
4af3c5f
implement calibrated signal
furyfist Jul 22, 2026
c348316
add verdict config and contract additions
furyfist Jul 22, 2026
1f05359
implement sqlite verdict store
furyfist Jul 22, 2026
2771d2f
plumb input PSI and output length through quality engine and add cost…
furyfist Jul 22, 2026
a9714e7
implement ScopeState and RollingWindow
furyfist Jul 22, 2026
8a84f9a
add unit tests for ScopeState and detection substrate
furyfist Jul 22, 2026
56b73ef
implement attribution logic and unit tests
furyfist Jul 22, 2026
7e29dc2
implement evaluator aggregation, guards, state machine, and exemplar …
furyfist Jul 22, 2026
06e8cd6
wire evaluator daemon thread into main pipeline with health counters …
furyfist Jul 22, 2026
ae7528d
add verdict metric gauges and provider callback to emitter
furyfist Jul 22, 2026
09a6c7e
implement emit_verdict_log with trace-linked worst exemplar
furyfist Jul 22, 2026
e0808dc
wire verdict metric provider and log emitter in main pipeline
furyfist Jul 22, 2026
9f4dd05
add verdict-changed alert rule and remove retired V1 rules
furyfist Jul 22, 2026
c2080c0
retarget release-compare dashboard to vitals.verdict metrics
furyfist Jul 22, 2026
d642c1c
add unit tests for verdict metrics, log record emission, and alerts
furyfist Jul 22, 2026
8159574
implement console HTML renderer with dark terminal theme and 3-zone l…
furyfist Jul 22, 2026
11a4662
implement stdlib HTTP console server and API routes
furyfist Jul 22, 2026
a8b672c
implement JSONL fixture reader writer and replay runner
furyfist Jul 22, 2026
ad65ffd
wire console server and record replay subcommands into main CLI
furyfist Jul 22, 2026
1778d75
add unit tests for console rendering, API endpoints, and replay runner
furyfist Jul 22, 2026
c72a2bf
add second topic set to corpus and scenario traffic generators
furyfist Jul 22, 2026
060e950
generate 4 golden JSONL replay fixtures for demo scenarios
furyfist Jul 22, 2026
18011cb
add test_replay_golden integration test suite for 4 replay scenarios
furyfist Jul 22, 2026
0ea6a2f
create agent skills documentation for vitals integration
furyfist Jul 22, 2026
b370d98
update demo README with replay scenarios and console guide
furyfist Jul 22, 2026
023395b
create docs/blind-spots.md technical analysis document
furyfist Jul 22, 2026
9def26d
verify full milestone M5 test suite and project completion
furyfist Jul 22, 2026
1a76664
add tick-level exception handling to EvaluatorThread
furyfist Jul 22, 2026
b8e769e
fix replay virtual time propagation for speed 0
furyfist Jul 22, 2026
a6a5514
verify full verdict state sequence in golden replay tests
furyfist Jul 22, 2026
72f6963
calculate per-exemplar behavior sigma values
furyfist Jul 22, 2026
4937850
add pipeline safety test for store failure resilience
furyfist Jul 22, 2026
22f934d
add link to blind-spots.md in console health strip footer
furyfist Jul 22, 2026
fba216f
docs: add frontend engineering specification for the vitals console
furyfist Jul 22, 2026
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
1 change: 1 addition & 0 deletions agent/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Agent skills package — documentation and guidelines for AI agent integration (spec §11)."""
103 changes: 103 additions & 0 deletions agent/skills.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Vitals Agent Skills Guide

This document defines how AI coding agents and automated remediation workflows consume, interpret, and act upon Vitals Verdicts.

---

## 1. Overview of Vitals Verdicts

Vitals is an AI signal sidecar that continuously monitors GenAI span telemetry (`gen_ai.system`, `gen_ai.request.model`, `service.name`, `service.version`) to deliver deterministic **Verdicts** on AI application health.

Verdicts unify quality drift (ResponseDriftMetric / PSI), spend rate (USD/min velocity), release attribution, and guard checks into a single actionable record.

### Verdict Data Model (`Verdict`)

| Field | Type | Description |
|---|---|---|
| `verdict_id` | `str` | Canonical hex string identifying the verdict record |
| `state` | `VerdictState` | `WARMING` (0), `STEADY` (1), `CHANGED` (2), `INCONCLUSIVE` (3) |
| `subject` | `Subject` | `RELEASE` (version vs version) or `TIME` (current vs lookback) |
| `cause` | `Cause` | `RELEASE` (deploy within 300s of onset) or `UNATTRIBUTED` |
| `behavior_sigma` | `float \| None` | Signed delta in sigma units relative to baseline behavior variance |
| `cost_sigma` | `float \| None` | Signed delta in sigma units relative to baseline cost variance |
| `velocity_ratio` | `float \| None` | Ratio of current USD/min velocity to baseline expected USD/min |
| `runaway` | `bool` | True if cost velocity ratio exceeds 5.0x (overrides hysteresis) |
| `sentence` | `str` | Human-readable canonical verdict sentence |
| `falsifier` | `str` | Explicit metric condition required to transition back to `STEADY` |
| `exemplars` | `tuple[Exemplar]` | Evidence exemplars containing worst and median outputs |

---

## 2. Interpreting Verdict States

### `WARMING` (State 0)
- **Meaning**: Insufficient sample count (collecting reference baseline window).
- **Agent Action**: No action required. Wait for baseline to finish warming.

### `STEADY` (State 1)
- **Meaning**: Monitored signals remain within normal baseline variance (±3σ).
- **Agent Action**: System is healthy. Proceed with planned deployment or monitoring.

### `CHANGED` (State 2)
- **Meaning**: Sustained regression detected in behavior drift (≥3.0σ) or runaway cost spend-rate (≥5.0x).
- **Agent Action**: High priority remediation required. See Section 4.

### `INCONCLUSIVE` (State 3)
- **Meaning**: Detection guard suspended evaluation:
- `low_sample`: Insufficient samples in current window (`n < min_samples`).
- `input_shift`: Both input prompt drift and behavior drift shift concurrently (≥3.0σ).
- **Agent Action**: Do **not** trigger a code rollback for `input_shift`. The change is driven by external user query shifts, not model regression.

---

## 3. Parsing Telemetry & Log Records

Vitals emits OTLP log records for each verdict. Trace correlation is natively linked via the worst exemplar's `trace_id` and `span_id`.

### Log Attributes

```json
{
"service.name": "ragapp",
"service.version": "v2",
"gen_ai.system": "openai",
"gen_ai.request.model": "gpt-4o",
"vitals.verdict_id": "c0123456789abcde",
"vitals.state": "changed",
"vitals.subject": "release",
"vitals.cause": "release",
"vitals.behavior_sigma": 4.2,
"vitals.cost_sigma": 0.3,
"vitals.velocity_ratio": 1.0,
"vitals.runaway": false,
"vitals.falsifier": "would flip to STEADY if behavior drift < 3.0σ (now 4.2σ)",
"vitals.exemplars": "[{\"kind\":\"worst\",\"trace_id\":\"...\",\"excerpt\":\"...\"}]"
}
```

---

## 4. Remediation Decision Tree

When a `CHANGED` verdict is emitted, agents must follow this decision procedure:

```mermaid
flowchart TD
A[Verdict CHANGED Emitted] --> B{Cause == RELEASE?}
B -- Yes --> C[Rollback Version to Baseline]
B -- No --> D{Runaway == True?}
D -- Yes --> E[Throttle Agent Loop / Rate Limit Endpoint]
D -- No --> F[Inspect Output Exemplars & Prompt Templates]
```

### Action 1: Cause == `RELEASE`
- **Root Cause**: Regression caused by newly deployed release version (e.g. `v2`).
- **Remediation**: Execute immediate version rollback to `baseline_version` (e.g. `v1`).

### Action 2: `runaway == True`
- **Root Cause**: Runaway loop rapidly burning tokens (velocity ratio ≥ 5.0x).
- **Remediation**: Terminate or rate-limit the agent thread loop; enforce max recursion limits.

### Action 3: `INCONCLUSIVE(input_shift)`
- **Root Cause**: User traffic topic shifted (e.g., queries changed from Observability to Database internals).
- **Remediation**: Do not rollback code. If desired, register a separate scope key or update baseline reference.
66 changes: 0 additions & 66 deletions assets/alerts/cost-velocity.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"alert": "Vitals: quality drift onset",
"alert": "Vitals: verdict changed",
"alertType": "METRIC_BASED_ALERT",
"description": "CUSUM flagged the onset of sustained quality drift from the healthy baseline. Deviation-from-good, not absolute correctness (see docs/honesty.md).",
"description": "{{service.name}} {{service.version}} — VERDICT CHANGED\nbehavior {{vitals.behavior_sigma}}σ · cost {{vitals.cost_sigma}}σ\ncause: {{vitals.cause}} · subject: {{vitals.subject}} · n={{vitals.samples}}\nrunaway: {{vitals.runaway}}\nFull record: vitals verdict log, trace-linked.",
"ruleType": "threshold_rule",
"evalWindow": "5m0s",
"evalWindow": "1m0s",
"frequency": "1m0s",
"condition": {
"compositeQuery": {
Expand All @@ -18,13 +18,13 @@
"disabled": false,
"aggregateOperator": "max",
"aggregateAttribute": {
"key": "gen_ai.evaluation.drift_onset",
"key": "vitals.verdict.state",
"dataType": "float64",
"type": "Gauge",
"isColumn": true
},
"timeAggregation": "max",
"spaceAggregation": "avg",
"spaceAggregation": "max",
"filters": {
"op": "AND",
"items": []
Expand All @@ -51,16 +51,16 @@
}
},
"op": ">=",
"target": 1,
"target": 2,
"matchType": "1",
"targetUnit": ""
},
"labels": {
"severity": "critical",
"severity": "warning",
"source": "vitals"
},
"annotations": {
"description": "CUSUM flagged the onset of sustained quality drift from the healthy baseline. Deviation-from-good, not absolute correctness (see docs/honesty.md).",
"summary": "Vitals: quality drift onset"
"description": "{{service.name}} {{service.version}} — VERDICT CHANGED\nbehavior {{vitals.behavior_sigma}}σ · cost {{vitals.cost_sigma}}σ\ncause: {{vitals.cause}} · subject: {{vitals.subject}} · n={{vitals.samples}}\nrunaway: {{vitals.runaway}}\nFull record: vitals verdict log, trace-linked.",
"summary": "{{service.name}} {{service.version}} — VERDICT CHANGED"
}
}
}
66 changes: 0 additions & 66 deletions assets/alerts/version-regression.json

This file was deleted.

Loading
Loading