golive-gate 0.1.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.
- golive_gate-0.1.0/.github/workflows/action-selftest.yml +32 -0
- golive_gate-0.1.0/.github/workflows/ci.yml +73 -0
- golive_gate-0.1.0/.github/workflows/release.yml +41 -0
- golive_gate-0.1.0/.gitignore +9 -0
- golive_gate-0.1.0/CHANGELOG.md +20 -0
- golive_gate-0.1.0/LICENSE +21 -0
- golive_gate-0.1.0/PKG-INFO +231 -0
- golive_gate-0.1.0/README.md +205 -0
- golive_gate-0.1.0/action.yml +88 -0
- golive_gate-0.1.0/docs/.nojekyll +0 -0
- golive_gate-0.1.0/docs/index.html +177 -0
- golive_gate-0.1.0/docs/results.json +1653 -0
- golive_gate-0.1.0/docs/spec/index.html +177 -0
- golive_gate-0.1.0/docs/spec/results.json +1530 -0
- golive_gate-0.1.0/examples/field_service_booking/README.md +17 -0
- golive_gate-0.1.0/examples/field_service_booking/agent.py +18 -0
- golive_gate-0.1.0/examples/field_service_booking/booking/__init__.py +0 -0
- golive_gate-0.1.0/examples/field_service_booking/booking/agents.py +209 -0
- golive_gate-0.1.0/examples/field_service_booking/booking/fsm.py +58 -0
- golive_gate-0.1.0/examples/field_service_booking/booking/grader.py +109 -0
- golive_gate-0.1.0/examples/field_service_booking/cases.json +720 -0
- golive_gate-0.1.0/examples/field_service_booking/checks.py +36 -0
- golive_gate-0.1.0/examples/field_service_booking/data/fsm.json +344 -0
- golive_gate-0.1.0/examples/field_service_booking/gate.yml +15 -0
- golive_gate-0.1.0/examples/field_service_booking/golive.yml +5 -0
- golive_gate-0.1.0/examples/refund_agent/agent.py +51 -0
- golive_gate-0.1.0/examples/refund_agent/cases.yml +14 -0
- golive_gate-0.1.0/examples/refund_agent/checks.py +37 -0
- golive_gate-0.1.0/examples/refund_agent/gate.yml +13 -0
- golive_gate-0.1.0/examples/refund_agent/golive.judge.yml +6 -0
- golive_gate-0.1.0/examples/refund_agent/golive.yml +5 -0
- golive_gate-0.1.0/examples/refund_agent/judge_checks.py +41 -0
- golive_gate-0.1.0/examples/voice_screening/README.md +14 -0
- golive_gate-0.1.0/examples/voice_screening/agent.py +23 -0
- golive_gate-0.1.0/examples/voice_screening/cases.json +334 -0
- golive_gate-0.1.0/examples/voice_screening/checks.py +134 -0
- golive_gate-0.1.0/examples/voice_screening/data/recorded_calls.json +6260 -0
- golive_gate-0.1.0/examples/voice_screening/gate.yml +12 -0
- golive_gate-0.1.0/examples/voice_screening/golive.yml +5 -0
- golive_gate-0.1.0/pyproject.toml +52 -0
- golive_gate-0.1.0/scripts/build_demo.sh +23 -0
- golive_gate-0.1.0/src/golive_gate/__init__.py +41 -0
- golive_gate-0.1.0/src/golive_gate/agents.py +31 -0
- golive_gate-0.1.0/src/golive_gate/analysis.py +98 -0
- golive_gate-0.1.0/src/golive_gate/cases.py +74 -0
- golive_gate-0.1.0/src/golive_gate/checks.py +90 -0
- golive_gate-0.1.0/src/golive_gate/cli.py +109 -0
- golive_gate-0.1.0/src/golive_gate/config.py +105 -0
- golive_gate-0.1.0/src/golive_gate/gates.py +190 -0
- golive_gate-0.1.0/src/golive_gate/html.py +105 -0
- golive_gate-0.1.0/src/golive_gate/judge.py +121 -0
- golive_gate-0.1.0/src/golive_gate/report.py +124 -0
- golive_gate-0.1.0/src/golive_gate/runner.py +118 -0
- golive_gate-0.1.0/tests/conftest.py +32 -0
- golive_gate-0.1.0/tests/test_agents.py +45 -0
- golive_gate-0.1.0/tests/test_analysis.py +54 -0
- golive_gate-0.1.0/tests/test_cases.py +41 -0
- golive_gate-0.1.0/tests/test_checks.py +55 -0
- golive_gate-0.1.0/tests/test_cli.py +107 -0
- golive_gate-0.1.0/tests/test_gates.py +86 -0
- golive_gate-0.1.0/tests/test_html.py +13 -0
- golive_gate-0.1.0/tests/test_judge.py +83 -0
- golive_gate-0.1.0/tests/test_runner.py +46 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Action self-test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
go:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- id: gate
|
|
14
|
+
uses: ./
|
|
15
|
+
with:
|
|
16
|
+
config: examples/refund_agent/golive.yml
|
|
17
|
+
- run: test "${{ steps.gate.outputs.decision }}" = "go"
|
|
18
|
+
|
|
19
|
+
no-go-is-blocked:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- id: gate
|
|
24
|
+
uses: ./
|
|
25
|
+
continue-on-error: true
|
|
26
|
+
with:
|
|
27
|
+
config: examples/refund_agent/golive.yml
|
|
28
|
+
agent: agent:naive_agent
|
|
29
|
+
runs: "1"
|
|
30
|
+
- run: |
|
|
31
|
+
test "${{ steps.gate.outcome }}" = "failure"
|
|
32
|
+
test "${{ steps.gate.outputs.decision }}" = "no-go"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.12"
|
|
16
|
+
- run: pip install ruff
|
|
17
|
+
- run: ruff check .
|
|
18
|
+
- run: ruff format --check .
|
|
19
|
+
|
|
20
|
+
test:
|
|
21
|
+
# ubuntu-24.04: the newest runner image no longer ships Python 3.9
|
|
22
|
+
runs-on: ubuntu-24.04
|
|
23
|
+
strategy:
|
|
24
|
+
fail-fast: false
|
|
25
|
+
matrix:
|
|
26
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
- uses: actions/setup-python@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: ${{ matrix.python-version }}
|
|
32
|
+
- run: pip install -e ".[dev]"
|
|
33
|
+
- run: pytest -q
|
|
34
|
+
|
|
35
|
+
example-gate:
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
env:
|
|
38
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- uses: actions/setup-python@v5
|
|
42
|
+
with:
|
|
43
|
+
python-version: "3.12"
|
|
44
|
+
- run: pip install ".[claude]"
|
|
45
|
+
- name: Reference agent must pass the gate
|
|
46
|
+
run: golive run examples/refund_agent/golive.yml --out reports/spec
|
|
47
|
+
- name: Naive agent must be blocked by the gate
|
|
48
|
+
run: |
|
|
49
|
+
set +e
|
|
50
|
+
golive run examples/refund_agent/golive.yml --agent agent:naive_agent --out reports/naive
|
|
51
|
+
code=$?
|
|
52
|
+
if [ "$code" -ne 1 ]; then echo "expected no-go (exit 1), got $code"; exit 1; fi
|
|
53
|
+
- name: Field-service booking example
|
|
54
|
+
run: |
|
|
55
|
+
golive run examples/field_service_booking/golive.yml --runs 1 --out reports/booking
|
|
56
|
+
set +e; golive run examples/field_service_booking/golive.yml --agent agent:naive_agent --runs 1 --out reports/booking-naive
|
|
57
|
+
test $? -eq 1
|
|
58
|
+
- name: Voice screening example (prompt fix takes it from no-go to go)
|
|
59
|
+
run: |
|
|
60
|
+
golive run examples/voice_screening/golive.yml --agent agent:candidate_v2 --out reports/voice-v2
|
|
61
|
+
set +e; golive run examples/voice_screening/golive.yml --agent agent:candidate_v1 --out reports/voice-v1
|
|
62
|
+
test $? -eq 1
|
|
63
|
+
set -e; golive diff reports/voice-v1/results.json reports/voice-v2/results.json
|
|
64
|
+
- name: Ablation against the naive agent
|
|
65
|
+
run: golive ablate examples/refund_agent/golive.yml --agent agent:naive_agent --runs 1 --out reports/ablation
|
|
66
|
+
- name: LLM judge example (runs only when the ANTHROPIC_API_KEY secret is set)
|
|
67
|
+
if: env.ANTHROPIC_API_KEY != ''
|
|
68
|
+
run: golive run examples/refund_agent/golive.judge.yml --out reports/judge
|
|
69
|
+
- name: Gate summary
|
|
70
|
+
if: always()
|
|
71
|
+
run: |
|
|
72
|
+
cat reports/spec/report.md >> "$GITHUB_STEP_SUMMARY"
|
|
73
|
+
if [ -f reports/judge/report.md ]; then cat reports/judge/report.md >> "$GITHUB_STEP_SUMMARY"; fi
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Release to PyPI
|
|
2
|
+
|
|
3
|
+
# Publishes with PyPI trusted publishing: no API token is stored in this repo.
|
|
4
|
+
# One-time setup on pypi.org: add a pending publisher for project "golive-gate",
|
|
5
|
+
# owner pg2342-hub, repository golive-gate, workflow release.yml, environment pypi.
|
|
6
|
+
# Runs when a version tag (v0.1.0) is pushed, a GitHub release is published, or by hand.
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags: ["v*"]
|
|
11
|
+
release:
|
|
12
|
+
types: [published]
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
- run: pip install build
|
|
24
|
+
- run: python -m build
|
|
25
|
+
- uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: dist
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
publish:
|
|
31
|
+
needs: build
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
environment: pypi
|
|
34
|
+
permissions:
|
|
35
|
+
id-token: write
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/download-artifact@v4
|
|
38
|
+
with:
|
|
39
|
+
name: dist
|
|
40
|
+
path: dist/
|
|
41
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-11-23)
|
|
4
|
+
|
|
5
|
+
- Cases from YAML, JSON, JSONL or Python lists, with groups, titles and tags.
|
|
6
|
+
- Checks as plain Python functions returning pass, fail or na; critical checks block the gate on one failure.
|
|
7
|
+
- Runner that calls any Python agent N times per case and records latency and cost.
|
|
8
|
+
- Gates written as YAML: overall and per-group minimums (count, "all" or a rate), critical-failure allowance, and rules that only hold rollout at partial. Every rule must hold on every run.
|
|
9
|
+
- `golive run` CLI with markdown and JSON reports and CI-friendly exit codes.
|
|
10
|
+
- LLM judge checks: one yes/no criterion per call, with the judge's reason and cost; `ClaudeJudge` built in, any callable works. Unreadable replies and refusals fail.
|
|
11
|
+
- HTTP agents (`agent: https://...`, headers from the environment) and agent-reported cost.
|
|
12
|
+
- `golive ablate`: which checks the gate depends on, from stored outputs.
|
|
13
|
+
- `golive diff` and `golive run --baseline`: regressions exit 1.
|
|
14
|
+
- Self-contained HTML report (`index.html`) for GitHub Pages, and a demo page for this repo.
|
|
15
|
+
- Composite GitHub Action with a `decision` output, tested on this repo.
|
|
16
|
+
- Release workflow for PyPI trusted publishing.
|
|
17
|
+
- Gate rules can cover several groups (`groups: [T1, T2]`).
|
|
18
|
+
- Projects that share module names (agent.py, checks.py) load side by side.
|
|
19
|
+
- Field-service booking and voice screening examples.
|
|
20
|
+
- Refund agent example: a policy-following agent that passes and a naive one the gate blocks.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pranav Gudise
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: golive-gate
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Turn agent eval cases, checks and go-live gates into one command and a GitHub Action: go, partial or no-go, with the reason.
|
|
5
|
+
Project-URL: Homepage, https://github.com/pg2342-hub/golive-gate
|
|
6
|
+
Author: Pranav Gudise
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: agents,ci,evals,evaluation,go-live,llm
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Testing
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Requires-Dist: pyyaml>=6.0
|
|
20
|
+
Provides-Extra: claude
|
|
21
|
+
Requires-Dist: anthropic>=2.12; (python_version >= '3.10') and extra == 'claude'
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
24
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# golive-gate
|
|
28
|
+
|
|
29
|
+
[](https://github.com/pg2342-hub/golive-gate/actions/workflows/ci.yml)
|
|
30
|
+
|
|
31
|
+
Demo page: https://pg2342-hub.github.io/golive-gate/ (a naive refund agent blocked by the gate, every case and check, no install needed)
|
|
32
|
+
|
|
33
|
+
Turn agent eval cases, checks and go-live gates into one command: **go, partial or no-go, with the reason.**
|
|
34
|
+
|
|
35
|
+
Before an AI agent acts on its own for a customer, someone has to decide it is ready. That decision usually lives in a spreadsheet or in someone's head. golive-gate writes it down as three files you can review and run in CI:
|
|
36
|
+
|
|
37
|
+
- **cases**: the inputs the agent will see, what a correct answer is, and a group (routine, edge, risky)
|
|
38
|
+
- **checks**: yes/no tests on each answer, written as small Python functions; a *critical* check blocks go-live on a single failure
|
|
39
|
+
- **gate**: the rule for going live, as YAML, such as "11 of 12 cases, every risky case, no critical failures, on all 3 runs"
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
$ golive run examples/refund_agent/golive.yml
|
|
43
|
+
Refund agent go-live gate: GO
|
|
44
|
+
every rule held on all 3 run(s), no critical failures
|
|
45
|
+
|
|
46
|
+
$ golive run examples/refund_agent/golive.yml --agent agent:naive_agent
|
|
47
|
+
Refund agent go-live gate: NO-GO
|
|
48
|
+
all 3 runs: 4 critical failure(s): auto_limit on case k01, auto_limit on case k02, fraud_handoff on case k03, fraud_handoff on case k04
|
|
49
|
+
all 3 runs: overall passed 6 of 12, needs 11 (no-go)
|
|
50
|
+
all 3 runs: risky cases passed 0 of 4, needs 4 (no-go)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The naive agent refunds everything. It passes every routine case, which is exactly why a pass rate alone is not a go-live decision.
|
|
54
|
+
|
|
55
|
+
## Examples
|
|
56
|
+
|
|
57
|
+
| Example | What it shows |
|
|
58
|
+
|---|---|
|
|
59
|
+
| [refund_agent](examples/refund_agent) | The smallest complete project: 12 cases, five checks (two critical), a gate with a partial rule, and an optional LLM judge check |
|
|
60
|
+
| [field_service_booking](examples/field_service_booking) | 25 booking calls for a home-services company, a full grader with six error codes, and tiered gate rules (T1-T2 15 of 16, every T3 and T4) |
|
|
61
|
+
| [voice_screening](examples/voice_screening) | Recorded calls from three setups graded as-is: the candidate is blocked by one promise of a shift, then passes after a prompt fix, and `golive diff` shows what changed |
|
|
62
|
+
|
|
63
|
+
## Install
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
pip install golive-gate
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Python 3.9 or newer. The only dependency is PyYAML; `pip install "golive-gate[claude]"` adds the Anthropic SDK for LLM judge checks (Python 3.10+).
|
|
70
|
+
|
|
71
|
+
## A project in four files
|
|
72
|
+
|
|
73
|
+
`golive.yml` says where everything lives (paths and modules are relative to this file):
|
|
74
|
+
|
|
75
|
+
```yaml
|
|
76
|
+
cases: cases.yml
|
|
77
|
+
checks: checks:checks # module:attribute holding a CheckSet
|
|
78
|
+
agent: agent:spec_agent # called with each case's input
|
|
79
|
+
gate: gate.yml
|
|
80
|
+
runs: 3
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`cases.yml` (YAML, JSON or JSONL):
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
cases:
|
|
87
|
+
- {id: r01, group: routine, title: "Day 3, $42 sweater", input: {amount: 42.00, days_since_delivery: 3}, expected: {action: refund}}
|
|
88
|
+
- {id: k03, group: risky, title: "Fraud flag, $25", input: {amount: 25.00, days_since_delivery: 1, fraud_flag: true}, expected: {action: handoff}}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`checks.py`:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from golive_gate import NA, CheckSet
|
|
95
|
+
|
|
96
|
+
checks = CheckSet()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@checks.check("action", text="The agent takes the expected action.")
|
|
100
|
+
def action(case, out):
|
|
101
|
+
return out["action"] == case.expected["action"]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@checks.check("fraud_handoff", text="Every order flagged for fraud goes to a person.", critical=True)
|
|
105
|
+
def fraud_handoff(case, out):
|
|
106
|
+
if not case.input.get("fraud_flag"):
|
|
107
|
+
return NA # the behavior had no chance to occur
|
|
108
|
+
return out["action"] == "handoff"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
A check returns `True`/`False`, `"pass"`/`"fail"`/`"na"`, `None` (na), a `(result, reason)` pair, or a `Verdict`. A check that raises counts as a failure, with the error kept as the reason.
|
|
112
|
+
|
|
113
|
+
`gate.yml`:
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
gate:
|
|
117
|
+
name: Refund agent go-live gate
|
|
118
|
+
max_critical_failures: 0
|
|
119
|
+
rules:
|
|
120
|
+
- name: overall
|
|
121
|
+
min_pass: 11 # cases that must pass, on every run
|
|
122
|
+
- name: risky cases
|
|
123
|
+
group: risky
|
|
124
|
+
min_pass: all
|
|
125
|
+
- name: edge cases
|
|
126
|
+
group: edge
|
|
127
|
+
min_pass_rate: 0.75 # rounds up: 3 of 4
|
|
128
|
+
on_fail: partial # a miss holds rollout at partial instead of no-go
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The decision is **no-go** if critical failures exceed the allowance or any `no-go` rule breaks on any run, **partial** if only `partial` rules break, and **go** otherwise.
|
|
132
|
+
|
|
133
|
+
## Output
|
|
134
|
+
|
|
135
|
+
`golive run` writes three files to `reports/` next to `golive.yml`, or to `--out`:
|
|
136
|
+
|
|
137
|
+
- `report.md`, for people and pull request summaries
|
|
138
|
+
- `results.json`, for tools, diffs and dashboards
|
|
139
|
+
- `index.html`, one self-contained page with every case and check verdict. Put it in `docs/` and GitHub Pages serves it as a demo (`scripts/build_demo.sh` builds this repo's).
|
|
140
|
+
|
|
141
|
+
| Exit code | Meaning |
|
|
142
|
+
|---|---|
|
|
143
|
+
| 0 | go (or partial, unless `--strict`) |
|
|
144
|
+
| 1 | no-go, or a regression against `--baseline` |
|
|
145
|
+
| 2 | partial with `--strict` |
|
|
146
|
+
| 3 | config error |
|
|
147
|
+
|
|
148
|
+
So a CI step that runs `golive run` fails the build when the agent is not ready. This repo's own CI does exactly that with the example: the reference agent must pass and the naive one must be blocked.
|
|
149
|
+
|
|
150
|
+
## GitHub Action
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
- uses: actions/checkout@v4
|
|
154
|
+
- id: gate
|
|
155
|
+
uses: pg2342-hub/golive-gate@main
|
|
156
|
+
with:
|
|
157
|
+
config: evals/golive.yml
|
|
158
|
+
baseline: evals/baseline/results.json # optional: fail on any regression
|
|
159
|
+
extras: claude # optional: for LLM judge checks
|
|
160
|
+
env:
|
|
161
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
162
|
+
- run: echo "decision was ${{ steps.gate.outputs.decision }}"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The job fails on no-go (or on partial with `strict: "true"`), the markdown report lands on the job summary page, and the `decision` output is go, partial or no-go. This repo tests the action on itself in `.github/workflows/action-selftest.yml`.
|
|
166
|
+
|
|
167
|
+
## LLM judge checks
|
|
168
|
+
|
|
169
|
+
Rules catch what a rule can state exactly. For the rest (tone, whether a reply explains itself, whether an answer is grounded), a judge check asks a model one yes/no criterion per call and keeps its reason and cost:
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
from golive_gate import ClaudeJudge, judge_check
|
|
173
|
+
|
|
174
|
+
tone = judge_check(
|
|
175
|
+
"decline_tone",
|
|
176
|
+
"If the agent declines, its reply is polite, says why in plain words, and does not blame the customer.",
|
|
177
|
+
judge=ClaudeJudge(), # pip install "golive-gate[claude]", reads ANTHROPIC_API_KEY
|
|
178
|
+
render_output=lambda out: out["reply"],
|
|
179
|
+
)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The judge must answer `VERDICT: PASS|FAIL|NA - reason`. A reply it cannot read, or a judge that declines to grade, counts as a **fail**, never a silent pass. A judge is any callable that takes a prompt and returns text, so another provider or a recorded-reply lookup drops in the same way. Judge cost is reported separately from agent cost. See `examples/refund_agent/golive.judge.yml`.
|
|
183
|
+
|
|
184
|
+
## Agents behind an API
|
|
185
|
+
|
|
186
|
+
Point `agent` at a URL instead of a Python function:
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
agent: https://my-agent.internal/respond
|
|
190
|
+
agent_headers:
|
|
191
|
+
Authorization: Bearer ${AGENT_TOKEN} # read from the environment
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Each case is sent as `POST {"input": ...}`. If the JSON reply has an `output` key, that is the output and an optional `cost_usd` is recorded; otherwise the whole body is the output.
|
|
195
|
+
|
|
196
|
+
## Which checks does the gate depend on?
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
$ golive ablate examples/refund_agent/golive.yml --agent agent:naive_agent --runs 1
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Ablation switches off each check in turn and re-grades the stored outputs (no extra agent or judge calls). It shows what the gate would have said without that check, and which cases only that check catches. A check that never catches anything on its own is either redundant or not tested by your cases. Run it against a weak agent: against an agent that passes everything, every row is trivially GO.
|
|
203
|
+
|
|
204
|
+
## Regressions
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
$ golive run golive.yml --baseline reports/last-release/results.json
|
|
208
|
+
$ golive diff before/results.json after/results.json
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
A case counts as passing only if it passed on every run. Any case that passed before and fails now, or a worse gate decision, exits 1, so a prompt or model change that breaks a case that used to work fails CI even if the overall gate still holds.
|
|
212
|
+
|
|
213
|
+
## Use it from Python
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
from golive_gate import Gate, Response, evaluate, load_cases, run_eval
|
|
217
|
+
|
|
218
|
+
result = run_eval(my_agent, load_cases("cases.yml"), checks, runs=3)
|
|
219
|
+
outcome = evaluate(Gate.load("gate.yml"), result)
|
|
220
|
+
print(outcome.decision, outcome.reasons)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
An agent can return `Response(output, cost_usd=...)` to have cost recorded; latency is always measured.
|
|
224
|
+
|
|
225
|
+
## Roadmap
|
|
226
|
+
|
|
227
|
+
- More worked examples: field-service booking, text-message ordering, voice screening
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
MIT
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# golive-gate
|
|
2
|
+
|
|
3
|
+
[](https://github.com/pg2342-hub/golive-gate/actions/workflows/ci.yml)
|
|
4
|
+
|
|
5
|
+
Demo page: https://pg2342-hub.github.io/golive-gate/ (a naive refund agent blocked by the gate, every case and check, no install needed)
|
|
6
|
+
|
|
7
|
+
Turn agent eval cases, checks and go-live gates into one command: **go, partial or no-go, with the reason.**
|
|
8
|
+
|
|
9
|
+
Before an AI agent acts on its own for a customer, someone has to decide it is ready. That decision usually lives in a spreadsheet or in someone's head. golive-gate writes it down as three files you can review and run in CI:
|
|
10
|
+
|
|
11
|
+
- **cases**: the inputs the agent will see, what a correct answer is, and a group (routine, edge, risky)
|
|
12
|
+
- **checks**: yes/no tests on each answer, written as small Python functions; a *critical* check blocks go-live on a single failure
|
|
13
|
+
- **gate**: the rule for going live, as YAML, such as "11 of 12 cases, every risky case, no critical failures, on all 3 runs"
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
$ golive run examples/refund_agent/golive.yml
|
|
17
|
+
Refund agent go-live gate: GO
|
|
18
|
+
every rule held on all 3 run(s), no critical failures
|
|
19
|
+
|
|
20
|
+
$ golive run examples/refund_agent/golive.yml --agent agent:naive_agent
|
|
21
|
+
Refund agent go-live gate: NO-GO
|
|
22
|
+
all 3 runs: 4 critical failure(s): auto_limit on case k01, auto_limit on case k02, fraud_handoff on case k03, fraud_handoff on case k04
|
|
23
|
+
all 3 runs: overall passed 6 of 12, needs 11 (no-go)
|
|
24
|
+
all 3 runs: risky cases passed 0 of 4, needs 4 (no-go)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The naive agent refunds everything. It passes every routine case, which is exactly why a pass rate alone is not a go-live decision.
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
| Example | What it shows |
|
|
32
|
+
|---|---|
|
|
33
|
+
| [refund_agent](examples/refund_agent) | The smallest complete project: 12 cases, five checks (two critical), a gate with a partial rule, and an optional LLM judge check |
|
|
34
|
+
| [field_service_booking](examples/field_service_booking) | 25 booking calls for a home-services company, a full grader with six error codes, and tiered gate rules (T1-T2 15 of 16, every T3 and T4) |
|
|
35
|
+
| [voice_screening](examples/voice_screening) | Recorded calls from three setups graded as-is: the candidate is blocked by one promise of a shift, then passes after a prompt fix, and `golive diff` shows what changed |
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
pip install golive-gate
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Python 3.9 or newer. The only dependency is PyYAML; `pip install "golive-gate[claude]"` adds the Anthropic SDK for LLM judge checks (Python 3.10+).
|
|
44
|
+
|
|
45
|
+
## A project in four files
|
|
46
|
+
|
|
47
|
+
`golive.yml` says where everything lives (paths and modules are relative to this file):
|
|
48
|
+
|
|
49
|
+
```yaml
|
|
50
|
+
cases: cases.yml
|
|
51
|
+
checks: checks:checks # module:attribute holding a CheckSet
|
|
52
|
+
agent: agent:spec_agent # called with each case's input
|
|
53
|
+
gate: gate.yml
|
|
54
|
+
runs: 3
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`cases.yml` (YAML, JSON or JSONL):
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
cases:
|
|
61
|
+
- {id: r01, group: routine, title: "Day 3, $42 sweater", input: {amount: 42.00, days_since_delivery: 3}, expected: {action: refund}}
|
|
62
|
+
- {id: k03, group: risky, title: "Fraud flag, $25", input: {amount: 25.00, days_since_delivery: 1, fraud_flag: true}, expected: {action: handoff}}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`checks.py`:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from golive_gate import NA, CheckSet
|
|
69
|
+
|
|
70
|
+
checks = CheckSet()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@checks.check("action", text="The agent takes the expected action.")
|
|
74
|
+
def action(case, out):
|
|
75
|
+
return out["action"] == case.expected["action"]
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@checks.check("fraud_handoff", text="Every order flagged for fraud goes to a person.", critical=True)
|
|
79
|
+
def fraud_handoff(case, out):
|
|
80
|
+
if not case.input.get("fraud_flag"):
|
|
81
|
+
return NA # the behavior had no chance to occur
|
|
82
|
+
return out["action"] == "handoff"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
A check returns `True`/`False`, `"pass"`/`"fail"`/`"na"`, `None` (na), a `(result, reason)` pair, or a `Verdict`. A check that raises counts as a failure, with the error kept as the reason.
|
|
86
|
+
|
|
87
|
+
`gate.yml`:
|
|
88
|
+
|
|
89
|
+
```yaml
|
|
90
|
+
gate:
|
|
91
|
+
name: Refund agent go-live gate
|
|
92
|
+
max_critical_failures: 0
|
|
93
|
+
rules:
|
|
94
|
+
- name: overall
|
|
95
|
+
min_pass: 11 # cases that must pass, on every run
|
|
96
|
+
- name: risky cases
|
|
97
|
+
group: risky
|
|
98
|
+
min_pass: all
|
|
99
|
+
- name: edge cases
|
|
100
|
+
group: edge
|
|
101
|
+
min_pass_rate: 0.75 # rounds up: 3 of 4
|
|
102
|
+
on_fail: partial # a miss holds rollout at partial instead of no-go
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The decision is **no-go** if critical failures exceed the allowance or any `no-go` rule breaks on any run, **partial** if only `partial` rules break, and **go** otherwise.
|
|
106
|
+
|
|
107
|
+
## Output
|
|
108
|
+
|
|
109
|
+
`golive run` writes three files to `reports/` next to `golive.yml`, or to `--out`:
|
|
110
|
+
|
|
111
|
+
- `report.md`, for people and pull request summaries
|
|
112
|
+
- `results.json`, for tools, diffs and dashboards
|
|
113
|
+
- `index.html`, one self-contained page with every case and check verdict. Put it in `docs/` and GitHub Pages serves it as a demo (`scripts/build_demo.sh` builds this repo's).
|
|
114
|
+
|
|
115
|
+
| Exit code | Meaning |
|
|
116
|
+
|---|---|
|
|
117
|
+
| 0 | go (or partial, unless `--strict`) |
|
|
118
|
+
| 1 | no-go, or a regression against `--baseline` |
|
|
119
|
+
| 2 | partial with `--strict` |
|
|
120
|
+
| 3 | config error |
|
|
121
|
+
|
|
122
|
+
So a CI step that runs `golive run` fails the build when the agent is not ready. This repo's own CI does exactly that with the example: the reference agent must pass and the naive one must be blocked.
|
|
123
|
+
|
|
124
|
+
## GitHub Action
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
- uses: actions/checkout@v4
|
|
128
|
+
- id: gate
|
|
129
|
+
uses: pg2342-hub/golive-gate@main
|
|
130
|
+
with:
|
|
131
|
+
config: evals/golive.yml
|
|
132
|
+
baseline: evals/baseline/results.json # optional: fail on any regression
|
|
133
|
+
extras: claude # optional: for LLM judge checks
|
|
134
|
+
env:
|
|
135
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
136
|
+
- run: echo "decision was ${{ steps.gate.outputs.decision }}"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The job fails on no-go (or on partial with `strict: "true"`), the markdown report lands on the job summary page, and the `decision` output is go, partial or no-go. This repo tests the action on itself in `.github/workflows/action-selftest.yml`.
|
|
140
|
+
|
|
141
|
+
## LLM judge checks
|
|
142
|
+
|
|
143
|
+
Rules catch what a rule can state exactly. For the rest (tone, whether a reply explains itself, whether an answer is grounded), a judge check asks a model one yes/no criterion per call and keeps its reason and cost:
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from golive_gate import ClaudeJudge, judge_check
|
|
147
|
+
|
|
148
|
+
tone = judge_check(
|
|
149
|
+
"decline_tone",
|
|
150
|
+
"If the agent declines, its reply is polite, says why in plain words, and does not blame the customer.",
|
|
151
|
+
judge=ClaudeJudge(), # pip install "golive-gate[claude]", reads ANTHROPIC_API_KEY
|
|
152
|
+
render_output=lambda out: out["reply"],
|
|
153
|
+
)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The judge must answer `VERDICT: PASS|FAIL|NA - reason`. A reply it cannot read, or a judge that declines to grade, counts as a **fail**, never a silent pass. A judge is any callable that takes a prompt and returns text, so another provider or a recorded-reply lookup drops in the same way. Judge cost is reported separately from agent cost. See `examples/refund_agent/golive.judge.yml`.
|
|
157
|
+
|
|
158
|
+
## Agents behind an API
|
|
159
|
+
|
|
160
|
+
Point `agent` at a URL instead of a Python function:
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
agent: https://my-agent.internal/respond
|
|
164
|
+
agent_headers:
|
|
165
|
+
Authorization: Bearer ${AGENT_TOKEN} # read from the environment
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Each case is sent as `POST {"input": ...}`. If the JSON reply has an `output` key, that is the output and an optional `cost_usd` is recorded; otherwise the whole body is the output.
|
|
169
|
+
|
|
170
|
+
## Which checks does the gate depend on?
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
$ golive ablate examples/refund_agent/golive.yml --agent agent:naive_agent --runs 1
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Ablation switches off each check in turn and re-grades the stored outputs (no extra agent or judge calls). It shows what the gate would have said without that check, and which cases only that check catches. A check that never catches anything on its own is either redundant or not tested by your cases. Run it against a weak agent: against an agent that passes everything, every row is trivially GO.
|
|
177
|
+
|
|
178
|
+
## Regressions
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
$ golive run golive.yml --baseline reports/last-release/results.json
|
|
182
|
+
$ golive diff before/results.json after/results.json
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
A case counts as passing only if it passed on every run. Any case that passed before and fails now, or a worse gate decision, exits 1, so a prompt or model change that breaks a case that used to work fails CI even if the overall gate still holds.
|
|
186
|
+
|
|
187
|
+
## Use it from Python
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
from golive_gate import Gate, Response, evaluate, load_cases, run_eval
|
|
191
|
+
|
|
192
|
+
result = run_eval(my_agent, load_cases("cases.yml"), checks, runs=3)
|
|
193
|
+
outcome = evaluate(Gate.load("gate.yml"), result)
|
|
194
|
+
print(outcome.decision, outcome.reasons)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
An agent can return `Response(output, cost_usd=...)` to have cost recorded; latency is always measured.
|
|
198
|
+
|
|
199
|
+
## Roadmap
|
|
200
|
+
|
|
201
|
+
- More worked examples: field-service booking, text-message ordering, voice screening
|
|
202
|
+
|
|
203
|
+
## License
|
|
204
|
+
|
|
205
|
+
MIT
|