Skip to content

Probe API reference

All Probe endpoints live under /probe/ at the Acumen API level — not under /lenser/. Lenser is a consumer of the Probe API, not its owner.

The router lives at backend/api/routes/probe.py in the Acumen source tree.


Spec management

List specs

GET /probe/specs

Returns all ProbeSpecs visible to the caller's tenant.

Create a spec

POST /probe/specs

Request body matches the ProbeSpec YAML grammar:

{
  "slug": "fs_licenses__no_indefinite",
  "name": "License No Indefinite Date",
  "screen_id": "fs_licenses",
  "description": "Verify that …",
  "tags": ["lenser", "validation"],
  "lenser_project_id": "01919e4f-...",
  "yaml_content": "id: fs_licenses__no_indefinite\nname: …\nscenarios:\n  …"
}

Response: full ProbeSpec record including the generated UUIDv7 id.

Get a spec

GET /probe/specs/{id}

Returns the full ProbeSpec including yaml_content.

Update a spec

PATCH /probe/specs/{id}

Partial update. Re-validates yaml_content against the grammar rules.

Delete a spec

DELETE /probe/specs/{id}

Deletes the spec and cascades to its probe_run records and assertion results. Screenshots on disk are not garbage-collected automatically.

List runs for a spec

GET /probe/specs/{id}/runs

Returns the most recent runs for this spec, newest first. Limit parameter optional.


Execution

Run a single spec

POST /probe/run

Request body:

{
  "spec_id": "01919e4f-...",
  "tenant_id": "01919e50-...",
  "base_url": "https://staging.acumen.example",
  "triggered_by": "manual",
  "triggered_by_id": "01919e51-..."
}

triggered_by is one of: lenser_publish, ci, manual, api. triggered_by_id is the project ID, user ID, or workflow ID that initiated the run — used for auditing.

Response (immediate):

{
  "run_id": "01919e60-...",
  "status": "pending"
}

Asynchronous

The endpoint returns as soon as the run is queued — it does not wait for cc to finish. Poll GET /probe/runs/{id} for terminal status. Typical wall-clock time per run is 30–90 seconds.

Run a suite

POST /probe/suite/run

Request body:

{
  "suite_id": "01919e70-...",
  "tenant_id": "01919e50-...",
  "base_url": "https://staging.acumen.example"
}

Returns a suite_run_id. Each spec in the suite gets its own probe_run record linked back to the suite via suite_run_id.

Get a run

GET /probe/runs/{id}

Returns the full ProbeRun including cc_reasoning_log and the array of per-assertion results.

{
  "id": "01919e60-...",
  "spec_id": "01919e4f-...",
  "tenant_id": "01919e50-...",
  "base_url": "https://staging.acumen.example",
  "triggered_by": "manual",
  "status": "failed",
  "started_at": "2026-04-29T14:22:11Z",
  "completed_at": "2026-04-29T14:23:02Z",
  "cc_reasoning_log": "Navigated to fs_licenses...",
  "assertions": [
    {
      "id": "01919e61-...",
      "scenario_id": "valid_from_disabled",
      "assertion_index": 0,
      "assertion_desc": "Valid From field is disabled",
      "status": "passed",
      "actual_value": "disabled",
      "expected_value": "disabled",
      "screenshot_path": null
    }
  ]
}

Get a failure screenshot

GET /probe/runs/{id}/screenshot/{assertion_id}

Returns the PNG screenshot captured at the moment the assertion failed. 404 if the assertion passed (no screenshot exists).


Suite management

Endpoint Description
GET /probe/suites List suites
POST /probe/suites Create a suite. Body: {name, description, spec_ids: [<uuid>, …]}
GET /probe/suites/{id} Get a suite
PATCH /probe/suites/{id} Update a suite (name, description, ordered spec list)

Suite execution is Phase 2

The data model and CRUD endpoints exist. POST /probe/suite/run is implemented but the production-grade scheduling, parallel execution, and aggregate reporting are Phase 2.


Authentication

Probe endpoints sit behind the standard Acumen auth middleware. The caller's session is used for authorisation (which tenant they can target). The actual browser run uses the probe_test tenant credentials, fetched from secrets management — not the caller's session.


Error shapes

Standard FastAPI error envelope:

{ "detail": "spec validation failed: action 'frob' not in allowed set" }

HTTP status:

Status Meaning
200 OK
201 Created
202 Accepted (run queued)
400 YAML validation failed, or invalid triggered_by
403 Caller cannot target this tenant
404 Spec / run / suite not found
409 Slug collision on POST /probe/specs
500 ProbeRunner crash or cc transport error (see probe_run.cc_reasoning_log)

Source code

The router and service implementations live in the Acumen monorepo:

  • Routes: backend/api/routes/probe.py
  • Service: backend/api/services/probe_service.py
  • Runner: backend/api/services/probe_runner.py
  • Spec generator (Lensmith→ProbeSpec): backend/api/services/probe_spec_generator.py
  • Models: backend/api/models/probe.py
  • Schemas: backend/api/schemas/probe.py
  • Migrations: backend/api/migrations/versions/f1a2b3c4d5e6_probe_phase1_tables.py

See also