Skip to main content

Execution flow

When an agent run is triggered (via dashboard, API, or webhook):
1

Queued

A message is sent to the execution queue (Azure Service Bus). The run status is set to Pending.
2

Processing

A worker picks up the message, loads the agent configuration, and sets status to Running.
3

LLM Loop

The agent enters a loop:
  1. Build the prompt (system message + conversation history + tool definitions)
  2. Call the LLM
  3. If the LLM returns a tool call → execute the tool, add the result to history, repeat
  4. If the LLM returns a final text response → exit the loop
  5. If max steps reached → exit with current output
4

Quality Check

If a QualityChecker system agent is configured, it evaluates the output and assigns a score.
5

Complete

Status is set to Completed (or Failed). Results are stored and published via SignalR for real-time updates.

Run metrics

Each run records:
MetricDescription
Steps ExecutedNumber of tool-call iterations
Tokens UsedTotal input + output tokens across all LLM calls
Actions UsedNumber of tool/function executions
Credits UsedTotal credit cost based on model pricing
DurationWall-clock time from start to finish

Step details

Each step within a run records:
  • Tool Name — which function was called
  • Input Data — parameters passed to the tool
  • Output Data — result returned by the tool
  • Reasoning — the LLM’s chain-of-thought before the tool call
  • Token Usage — per-step input/output tokens
  • Duration — execution time in milliseconds

Hierarchical runs

Agents can invoke other agents using the InvokeAgent tool. This creates a parent-child relationship:
  • The parent run’s ParentAgentRunId links child runs
  • Child runs execute independently with their own step limits and credit tracking
  • The parent agent receives the child’s final output as a tool result

Error handling

When an agent run fails:
  • The ErrorAnalyzer system agent (if enabled) examines the error and provides diagnosis
  • The error message is stored on the run record
  • Credits consumed up to the point of failure are still deducted
Common failure reasons:
  • LLM API timeout or rate limit
  • Tool execution error
  • Max steps exceeded without resolution
  • Insufficient credits