Viewing traces in MLflow

View the traces of an agent in MLflow from Cloudera Agent Studio to review the input, the output, the status, and the token count of each agent run.

Agent Studio sends the traces of an agent to MLflow. Each agent and environment has one MLflow experiment, and the experiment contains the traces of that agent in that environment. The name of the experiment has the format agent_id-env, where env is authoring or deployed. For a deployed agent, the name has the format dep-deployment ID-deployed.

Open MLflow by using one of the following methods:

  • Select Observability in the left navigation pane to open the MLflow home page in a new browser tab. Then, select the experiment.
  • In the Deployments page, open the row menu for a deployment, and select View in MLflow to open the Traces page for the experiment associated with that deployment.

On the Traces page of MLflow, you can perform the following tasks:

  • Find a trace by time range, input, or output.
  • Open a trace to review its inputs, outputs, attributes, and events.
  • Add feedback and expectations to a trace.
  • Select traces and run scorers on them.
  • Select traces and add them to an evaluation dataset.
  • Ensure that your account has a role that can view traces. Agent Studio displays the Observability option when you have trace-viewing permission. For more information about roles and permissions, see User roles and capabilities.

    Trace visibility depends on your assigned role:

    • Builder: Views authoring traces for agents that you own.
    • Observer: Views production traces.
    • Admin: Views authoring and production traces for all agents.
  • Ensure that the MLflow URL is configured for your deployment. If it is not configured, the MLflow link unavailable message is displayed when you click Observability.
  • Ensure that the agent has run at least once in the environment that you want to inspect. An agent that has no traces has no MLflow experiment.
  • To open traces from the Deployments page, ensure that you have permission to view production agents. For more information, see Viewing deployment details, evaluations, and MLflow traces.
To view the traces of an agent in MLflow:
  1. Launch the Cloudera Agent Studio console.
  2. In the left navigation pane, click Observability.
    MLflow opens in a new browser tab. The Home page of MLflow is displayed, and the Recent Experiments table lists the experiments.
  3. In the left navigation pane of MLflow, click Experiments.
    The Experiments page is displayed.
  4. In Recent Experiments, click the name of the experiment.
    The Overview page of the experiment is displayed. The page displays the tabs Usage, Quality, and Tool calls. The Traces chart displays the number of traces in the selected period. The default period is Last 7 days.
  5. In the left navigation pane of MLflow, under Observability, click Traces.
    The Traces page is displayed with the columns Time, Input, Output, Session, Duration, State, Tokens, and Tags. A trace that completed without an error has the State value OK.
  6. Click the row of the trace.

    The page of the trace is displayed. The title is the name of the root span. The page displays the following details:

    • The status of the trace.
    • The duration.
    • The number of tokens.
    • The ID of the session and the number of tags.
    • The span tree in the left pane.
  7. Review the trace.
    1. Click the Inputs / Outputs tab.
      The Inputs section contains the request that the user sent. The Outputs section contains the response of the agent. To change the format of a section, click Pretty. To display the full text, click See more.
    2. Click the Attributes tab to review the attributes of the selected span.
    3. Click the Events tab to review the events of the selected span.
    4. Optional: To add feedback or an expectation to the trace, click Assess.

      The Assessments pane is displayed with the following sections:

      • Feedback: To add custom feedback, click Add feedback.
      • Expectations: To add a custom expectation, click Add expectation.

      To close the pane, click Close at the top of the pane.

      To close the trace and return to the Traces page, click Close in the upper-right corner of the trace view.

To view sessions in traces:
  1. In the left navigation pane of MLflow, under Observability, click Traces.
    The Traces page is displayed.
  2. To group the traces by session, click the Group traces by session icon to the right of the Filter.
    In the grouped table, Session is the first column, and each row has an arrow at its left. To list the traces without grouping, click the icon again.
  3. In the Session column, click the session ID of the trace.

    The session page opens and displays the following details:

    • The Session label and the full session ID, with Copy.
    • The Tokens count.
    • The Latency.
    • The list of the turns at the left.
    • The turn at the right, with the User message and the Assistant message.
  4. Optional: To review the trace of the turn, click View full trace.
To run actions on traces:
  1. In the left navigation pane, click Observability, and then open the Traces page of the experiment.
    See steps 3 to 5 of To view the traces of an agent in MLflow.
  2. Select the checkbox for each trace.
    The Actions menu displays the number of selected traces.
  3. Click Actions, and do one of the following:
    • Under Use for evaluation, click Run scorers, Add to evaluation dataset, or Flag for review.
    • Under Edit, click Edit tags or Delete.
To open the traces of a deployment from Agent Studio:
  1. Launch the Cloudera Agent Studio console.
  2. In the left navigation pane, click Deployments.
  3. In the row of the deployment, click Open menu, and then click View in MLflow.
    The Traces page of the experiment opens in a new browser tab. If the deployment has no MLflow experiment, the message No MLflow experiment yet for this agent is displayed in Agent Studio.

The Traces page of MLflow lists the traces of the agent, and the page of a trace displays the inputs, the outputs, the status, the duration, and the token count of the agent run.

If the lookup of the experiment fails, Agent Studio displays the message Failed to look up the MLflow experiment or the message of the server. Run the agent in the environment, and then try again.