Skip to main content

Overview

Telemetry in OrbitAI provides real-time monitoring, performance metrics, and usage analytics across agents, tasks, and orbits. Track token consumption, execution times, API calls, tool usage, and costs to optimize performance, manage budgets, and debug issues effectively.

Usage Metrics

Track token usage, API calls, and request success rates

Performance Monitoring

Monitor execution times and identify bottlenecks

Cost Tracking

Calculate and monitor LLM and API costs

Tool Analytics

Measure tool usage, execution time, and success rates

Real-Time Updates

Monitor live execution status and progress

Custom Integration

Integrate with external analytics and monitoring systems

Key Capabilities

Telemetry data is collected at multiple levels—orbit, task, agent, and tool—providing both aggregated overview metrics and granular detail for deep analysis.
Metrics are collected automatically during execution without any manual instrumentation. All usage data, timing information, and performance metrics are captured seamlessly.
Telemetry is enabled by default and requires no setup. Access comprehensive metrics immediately after execution through simple API calls.
Integrate custom telemetry managers to export data to your preferred analytics platform, logging service, or monitoring dashboard.

Telemetry Architecture

Usage Metrics

OrbitAI tracks comprehensive usage metrics to help you understand resource consumption and API usage patterns.

UsageMetrics Structure

Token Usage Tracking
Understanding Token Counts:
  • Prompt tokens: Input sent to LLM (system messages, user input, context, tools)
  • Completion tokens: LLM-generated output (responses, tool calls, reasoning)
  • Total tokens: Sum of prompt and completion tokens
Why it matters:
  • Track API costs (billed per token)
  • Optimize prompt efficiency
  • Monitor context window usage
  • Identify verbose agents

Accessing Usage Metrics

1

Execute Orbit

Run your orbit to generate telemetry data:
2

Access Aggregated Metrics

Get orbit-wide metrics from the output:
3

Analyze Per-Task Metrics

Drill down into individual task performance:
4

Review Agent Statistics

Check agent-level cumulative metrics:

Performance Monitoring

Track execution times and identify performance bottlenecks across your agent workflows.

Execution Time Metrics

Total Workflow Duration
Components:
  • Task execution time (agent processing)
  • Tool execution time
  • Orchestration overhead (task coordination, validation)
  • Sequential vs parallel timing

Identifying Bottlenecks

1

Sort Tasks by Execution Time

Find the slowest tasks:
2

Analyze Tool Performance

Identify slow or failing tools:
3

Calculate Task Efficiency

Compare actual vs expected performance:

Real-Time Monitoring

Monitor orbit execution in real-time:
Execution Status Fields:
  • queuedTasks: Tasks waiting to execute
  • activeTasks: Currently executing tasks
  • completedTasks: Successfully completed tasks
  • failedTasks: Failed tasks
  • totalTasks: Total number of tasks
  • completionPercentage: Progress (0-100)

Tool Analytics

Track tool usage, performance, and success rates across your workflow.

ToolUsage Structure

Tool Performance Analysis

Tool Usage Patterns

Identify how tools are being used:

Cost Tracking

Calculate and monitor costs associated with LLM usage and external API calls.

LLM Cost Calculation

Calculate costs for OpenAI models:

Budget Management

Implement cost controls and budget tracking:

Cost Optimization

Strategies to reduce costs:

Optimize Prompts

Reduce token usage with concise prompts:

Use Cheaper Models

Choose appropriate model for task complexity:

Cache Responses

Enable LLM caching for repeated queries:

Batch Processing

Process multiple items in one request:

Custom Telemetry Integration

Integrate OrbitAI with your existing analytics and monitoring infrastructure.

TelemetryManager Protocol

Custom Implementation Example

Step Callbacks

Track execution progress with step callbacks:

Best Practices

Telemetry Configuration

Enable by Default

Always collect telemetry in production:
Why:
  • Debug production issues
  • Track costs
  • Monitor performance
  • Analyze usage patterns

Aggregate Metrics

Use orbit-level metrics for overview:
Benefits:
  • Cleaner code
  • Already aggregated
  • No calculation overhead

Archive Metrics

Store telemetry data for historical analysis:

Set Alerts

Alert on anomalies:

Performance Monitoring

Measure baseline performance for comparison:
Identify which tasks need optimization:

Troubleshooting

Common Issues

Symptom: usageMetrics is nil or has zero values.Causes:
  • Metrics collection disabled
  • Task didn’t execute
  • LLM provider doesn’t return usage data
Diagnosis:
Solutions:
Symptom: Token counts don’t match expectations or LLM provider reports.Causes:
  • Different tokenization methods
  • System messages not counted
  • Tool descriptions included/excluded
Diagnosis:
Solutions:
  • Use LLM provider’s token count (most accurate)
  • Include tool definitions in estimates
  • Account for system messages
  • Use provider’s tokenizer for accuracy
Symptom: Telemetry collection uses excessive memory or CPU.Causes:
  • Storing too much telemetry data in memory
  • Complex analytics calculations
  • Not archiving historical data
Solutions:
Symptom: Adding telemetry slows down execution.Causes:
  • Synchronous telemetry calls
  • Network I/O to analytics service
  • Complex calculations in callback
Solutions:

Next Steps

Orbits

Learn about orbit execution and orchestration

Tasks

Configure tasks and access task metrics

Agents

Monitor agent performance and usage

Tools

Track tool usage and execution metrics

Pro Tip: Set up automated daily reports that summarize your telemetry data. Track total costs, token usage trends, and performance metrics to catch issues early and optimize continuously.