Skip to content

latent.studio.report

Ship a published report to the Agent Studio reports API.

The transmit leg of the agent_studio.Report dataset type, and nothing else. Building the payload — gate-fill, sampled stamp, markdown sibling, MLflow, the atomic local write — is latent.gates.publish plus latent.datasets; by the time :func:submit_report runs, the payload has already landed on disk.

That ordering is the contract, not an implementation detail: the local copy is what the gate teardown discovers (latent.gates.thresholds.discover_reports), so a failing POST must not cost the run its gate evidence, and a failing local write must abort the POST rather than show Studio a report the teardown never saw.

Functions

submit_report

submit_report(payload: dict[str, Any], flow_name: str, dataset_name: str, catalog_config: dict, flow_logger: logging.Logger) -> str

POST an already-published report payload to Agent Studio.

Args: payload: The published payload, exactly as written to data/<flow>/output/. What lands on disk and what goes on the wire are the same object. flow_name: The Prefect flow name. Used in the default idempotency_key and report name. dataset_name: The catalog output key (e.g. "inference_judge_report" from catalog.yaml). Folded into the default idempotency_key so multiple outputs in a single flow run don't collide. catalog_config: The catalog entry under dataset_name; see below for recognised keys. flow_logger: Logger for status messages.

Catalog config (all optional — sensible defaults inferred): report_type: stats_eval # default: "stats_eval" flow_name: eval_report # default: auto-detected from @flow context name: My Report # default: "{flow_name} {timestamp}" idempotency_key: ... # default: "{flow_name}{output_name}". # Pass null to disable dedup entirely. dataset_slug: support-qa # default: inferred from agent_studio.Dataset inputs dataset_version: latest # default: inferred from agent_studio.Dataset inputs base_url: http://... # default: AGENT_STUDIO_URL or http://localhost:8000 api_key: ... # default: AGENT_STUDIO_API_KEY

Returns: The Studio report id, or "unknown" when the response omits one.