Table of contents
Official Content
  • This documentation is valid for:

The Analytics API module via PyGEAI allows you to interact with Globant Enterprise AI to get informantion on how it is being used across Projects, Agents, Users, and time periods.

It allows you to analyze usage, costs, performance, and adoption metrics through both the CLI and the Python SDK, enabling informed decisions around optimization, monitoring, and reporting.

Through the geai analytics CLI commands and the AnalyticsManager class in PyGEAI, you can retrieve aggregated metrics, detect trends, export reports, and share insights with technical and business stakeholders.

The Analytics module is designed to support operational monitoring, cost control, and strategic analysis, with flexible date filtering and multiple levels of granularity.

What you can measure with Analytics

The Analytics module exposes metrics across several dimensions:

  • Lab metrics: Track the creation and modification of Agents, Flows, and Processes.
  • Request metrics: Monitor total requests, error rates, and response times.
  • Cost metrics: Analyze total spend and average cost per request.
  • Token metrics: Track input, output, and total token consumption.
  • User and Agent activity: Measure active users, active agents, and active projects.
  • Top performers: Identify top Agents and Users by requests, tokens, and cost.

All analytics queries support custom date ranges and automatically default to the previous month when no dates are provided.

Prerequisites

Before using Analytics, ensure the following:

  • CLI installed: The geai CLI must be available.
  • Authentication configured: An API token must be generated from the GEAI platform.
  • Permissions: Your user must have access to Analytics data.

Set your API token as an environment variable:

export GEAI_APITOKEN="your-api-token-here"

Date range behavior

All analytics commands accept optional start_date and end_date parameters.

If no dates are provided, the system automatically uses the previous calendar month.

For example, if today is January 15, 2024:

  • Start date defaults to 2023-12-01
  • End date defaults to 2023-12-31

This behavior ensures consistent monthly reporting without requiring manual date input.

Common options

Most analytics commands support the following parameters:

  • --start-date (-s): Start date in YYYY-MM-DD format.
  • --end-date (-e): End date in YYYY-MM-DD format.
  • --agent-name (-a): Filter results by a specific Agent (when applicable).

Analytics commands overview

Help

Use the help command to explore all available analytics operations:

geai analytics help

Lab metrics

Lab metrics provide insight into how your AI assets evolve over time.

Agents created and modified

This metric returns the total number of Agents created and modified within the selected period.

Use this to understand development velocity and iteration frequency.

Request metrics

Request metrics help you understand traffic volume, reliability, and performance.

Requests per day

Returns the number of requests executed per day, including error counts. You can optionally filter results by Agent.

This is useful for identifying usage patterns, traffic spikes, or regressions.

Error rate

Calculates the overall error rate as a percentage across all requests in the selected period.

Use this metric to monitor system stability and detect failures early.

Cost metrics

Cost metrics provide financial visibility into model usage.

Total cost

Returns the total cost incurred during the selected period.

This metric is commonly used for monthly reporting and budgeting.

Average cost per request

Calculates the average cost of each request, helping you assess efficiency and optimize configurations.

Token metrics

Token metrics allow you to track model consumption in detail.

Total tokens

Returns aggregated token usage, including:

  • Input tokens
  • Output tokens
  • Total tokens

This data helps correlate cost, usage patterns, and model behavior.

User and Agent metrics

These metrics provide insight into platform adoption.

Active users

Returns the total number of users who executed requests during the selected period.

Use this to measure engagement and adoption across teams.

Top performers

Top performer metrics help identify high-impact Agents and Users.

Top Agents by requests

Returns the top 10 Agents ranked by number of executed requests.

This is useful for identifying critical Agents and prioritizing optimization efforts.

Full analytics report

The Full Report aggregates all available metrics into a single execution.

It can be generated using default dates or a custom date range and optionally exported to CSV.

The report includes:

  1. The Lab metrics
    • Agents created and modified
    • Flows created and modified
    • Processes created and modified
  2. Request metrics
    • Total requests
    • Requests with errors
    • Error rate
    • Average request time
  3. Cost metrics
    • Total cost
    • Average cost per request
  4. Token metrics
    • Input, output, and total tokens
    • Average tokens per request
  5. User and Agent metrics
    • Active users
    • Active agents
    • Active projects
  6. Top performers
    • Top 10 Agents by requests
    • Top 10 Agents by tokens
    • Top 10 Users by requests
    • Top 10 Users by cost

The full report is ideal for executive summaries, monthly reviews, and operational dashboards.

CSV export

Analytics reports can be exported in CSV format for further analysis in spreadsheets or BI tools.

The exported file includes:

  • Report metadata (period, generation time)
  • One metric per row
  • Numeric values ready for aggregation or visualization

Using Analytics from the Python SDK

In addition to the CLI, Analytics can be accessed programmatically using the AnalyticsManager class.

The Python SDK enables you to:

  • Automate reports
  • Integrate analytics into internal tools
  • Perform custom aggregations and comparisons

Typical use cases include scheduled reporting, dashboards, and data pipelines.

Available AnalyticsManager methods

Lab metrics

  • get_agents_created_and_modified
  • get_agents_created_and_modified_per_day
  • get_flows_created_and_modified
  • get_flows_created_and_modified_per_day
  • get_processes_created_and_modified

Request metrics

  • get_total_requests
  • get_total_requests_per_day
  • get_total_requests_with_error
  • get_overall_error_rate
  • get_average_request_time
  • get_average_requests_per_day
  • get_average_requests_per_user

Cost metrics

  • get_total_cost
  • get_total_cost_per_day
  • get_average_cost_per_request
  • get_average_cost_per_user

Token metrics

  • get_total_tokens
  • get_number_of_tokens_per_agent
  • get_number_of_tokens_per_day
  • get_average_tokens_per_request

User and Agent metrics

  • get_total_active_users
  • get_total_active_agents
  • get_total_active_projects
  • get_agent_usage_per_user

Top performers

  • get_top_10_agents_by_requests
  • get_top_10_agents_by_tokens
  • get_top_10_users_by_requests
  • get_top_10_users_by_cost

Best practices

  • Run reports regularly to identify trends early.
  • Export to CSV for deeper analysis or BI integration.
  • Compare periods to measure growth and regressions.
  • Monitor costs to avoid unexpected spending.
  • Track error rates to maintain reliability.
  • Use adoption metrics for capacity planning.
  • Correlate tokens and cost to optimize model usage.

Common use cases

  • Monthly reporting: Automatically generate full reports using default dates.
  • Cost tracking: Compare spend across quarters or projects.
  • Performance monitoring: Track error rates and latency over time.
  • Agent analysis: Identify high-impact or underperforming Agents.

Troubleshooting

  • Authentication errors: Verify the API token is configured correctly.
  • Permission errors: Ensure your user has Analytics access.
  • Empty results: Confirm the selected date range includes activity.
  • Date format issues: Always use YYYY-MM-DD.

Availability

Since Version 2026-02

Last update: December 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant