Execution Time Tracking for Unique AI Agent Steps

1 min read

Overview

To enhance performance analysis and bottleneck detection in Unique AI, we introduced structured logging for execution times across agent workflows. This improvement provides visibility into how long each component of the agent takes, enabling more effective debugging and optimization.

What’s Included

A new section called execution_time has been added to the debug output. This section captures:

  • Total execution time of the request

  • Per-loop iteration timing

  • Granular breakdown of each step within an iteration:

    • Planning / streaming

    • Evaluation (e.g. hallucination check)

    • Tool execution (including per-tool timing)

    • Post-processing (e.g. follow-up question generation)

    • Total loop time

Structure

json
"execution_time": {
  "total_time": 10.6,
  "loop_iterations": [
    {
      "iteration": 1,
      "evaluation": {},
      "tool_execution": {
        "total": 0.5,
        "InternalSearch": 0.5
      },
      "post_processing": {},
      "total_loop_time": 1.56,
      "planning_or_streaming": 1.03
    },
    {
      "iteration": 2,
      "evaluation": {
        "hallucination": 2
      },
      "post_processing": {
        "StockTickerPostprocessor": 0,
        "FollowUpQuestionPostprocessor": 1.7
      },
      "total_loop_time": 8.98,
      "planning_or_streaming": 5.26
    }
  ]
}

Key Benefits

  • Improved Observability: Clear visibility into time spent per agent step

  • Bottleneck Identification: Quickly identify slow components (e.g., tools, post-processors)

  • Performance Optimization: Enables data-driven improvements to agent workflows

  • Debugging Support: Structured format simplifies analysis in logs and monitoring tools

Last updated