The domino.agents package provides tracing, evaluation, and search capabilities for agentic systems. This is part of the python-domino library.
|
Note
|
The canonical import path is |
Decorator that starts an MLflow span for the decorated function. If an existing trace is in progress, appends a span to it; otherwise creates a new trace.
domino.agents.tracing.add_tracing(
name: str,
autolog_frameworks: list[str] | None = [],
evaluator: Callable | None = None,
trace_evaluator: Callable | None = None,
eagerly_evaluate_streamed_results: bool = True,
allow_tracing_evaluator: bool = False
)| Parameter | Type | Description |
|---|---|---|
|
| Name of the span (or new trace). |
|
| MLflow-supported frameworks to autolog (for instance, |
|
| Function that receives the span and returns evaluation results as |
|
| Function that receives the complete trace. Only fires when the trace was started and finished by this decorator. Useful for end-to-end quality checks. |
|
| When |
|
| Default |
Initialize MLflow autologging and set the active experiment to enable tracing. Used to initialize logging in both development and production modes.
domino.agents.tracing.init_tracing(
autolog_frameworks: list[str] | None = None
)-
In production mode, the environment variables
DOMINO_AGENT_IS_PRODandDOMINO_APP_IDmust be set. -
Call
init_tracing()before your app starts serving requests.
Search for traces in a development-mode evaluation run. Returns a paginated response of trace summaries.
domino.agents.tracing.search_traces(
run_id: str,
trace_name: str | None = None,
start_time: datetime | None = None,
end_time: datetime | None = None,
page_token: str | None = None,
max_results: int | None = None
) → SearchTracesResponseSearch for traces from a deployed production agent. Filter by agent version, trace name, and time range. If agent_version is not provided, searches across all versions.
domino.agents.tracing.search_agent_traces(
agent_id: str,
agent_version: str | None = None,
trace_name: str | None = None,
start_time: datetime | None = None,
end_time: datetime | None = None,
page_token: str | None = None,
max_results: int | None = None
) → SearchTracesResponseTraceSummary
class domino.agents.tracing.TraceSummary(
name: str,
id: str,
spans: list[SpanSummary],
evaluation_results: list[EvaluationResult]
)| Parameter | Type | Description |
|---|---|---|
|
| Name of the trace. |
|
| MLflow trace ID. |
|
| Child spans of this trace. |
|
| Evaluation results for this trace. |
SpanSummary
class domino.agents.tracing.SpanSummary(
id: str,
name: str,
trace_id: str,
inputs: Any,
outputs: Any
)| Parameter | Type | Description |
|---|---|---|
|
| MLflow span ID. |
|
| Span name. |
|
| Parent trace ID. |
|
| Inputs to the function that created the span. |
|
| Outputs of the function. |
Log an evaluation result against an existing trace. Used for ad-hoc or production evaluations where you evaluate traces after they’ve been collected such as in a scheduled Job.
domino.agents.logging.log_evaluation(
trace_id: str,
name: str,
value: float | str
)| Parameter | Type | Description |
|---|---|---|
|
| The MLflow trace ID to attach the evaluation to. |
|
| Name of the evaluation metric. |
|
| Evaluation result value (numeric score or string label). |
The DominoRun wrapper from domino.agents.logging creates an MLflow experiment run that stores traces and logged parameters.
from domino.agents.logging import DominoRun
with DominoRun(
agent_config_path="config.yaml",
aggregated_metrics=[("toxicity", "mean"), ("bleu", "median")]
) as run:
run_agent(...)| Parameter | Description |
|---|---|
| Path to a YAML config file. Logged as parameters in the Experiment Manager. |
| List of |
| Variable | Required for | Description |
|---|---|---|
| All modes | Set automatically in Domino executions. For local testing, use |
| Production | Set to indicate production mode for |
| Production | The ID of the deployed agent app. |
