Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.domain.actions.stats

Action statistics functionality for retrieving invocation metrics.

Module Contents

ActionStatsRecord

class roboto.domain.actions.stats.ActionStatsRecord(/, **data)#View Source

Bases: pydantic.BaseModel

Statistical summary of action invocations for a specific action within a time period.

This model represents aggregated invocation counts for a single action, broken down by completion status (completed, failed, queued).

Parameters

data Any

Attributes

ActionStatsRecord.action_name

action_name str #

Name of the action. Action names are unique within an organization.

ActionStatsRecord.action_org_id

action_org_id str #

Organization ID that owns the action.

ActionStatsRecord.completed_count

completed_count int #

Number of invocations that completed successfully during the time period.

ActionStatsRecord.fail_count

fail_count int #

Number of invocations that failed during the time period.

ActionStatsRecord.queued_count

queued_count int #

Number of invocations that are currently queued or in progress during the time period.

get_action_stats()

roboto.domain.actions.stats.get_action_stats(start_time, end_time, roboto_client=None, org_id=None)#View Source

Retrieve action invocation statistics for all actions in an organization.

Fetches aggregated statistics showing invocation counts by status for each action within the specified organization and time range. This provides a high-level view of action usage and success rates across the organization.

Parameters

org_id Optional[str]

Organization ID to retrieve statistics for.

start_time datetime.datetime

Start of the time period (inclusive) for which to retrieve statistics.

end_time datetime.datetime

End of the time period (exclusive) for which to retrieve statistics.

roboto_client Optional[roboto.http.RobotoClient]

HTTP client for making API requests. If not provided, uses the default client configuration.

Returns

List of ActionStatsRecord objects, one for each action that had invocations during the specified time period. Actions with no invocations are not included.

Raises

The caller is not authorized to access statistics for the specified organization.

Invalid time range or organization ID provided.

Usage

Get statistics for the last 24 hours:

import datetime
from roboto.domain.actions.stats import get_action_stats
end_time = datetime.datetime.now()
start_time = end_time - datetime.timedelta(days=1)
stats = get_action_stats(start_time, end_time, org_id="og_1234567890abcdef")
for stat in stats:
    print(f"{stat.action_name}: {stat.completed_count} completed, {stat.fail_count} failed")

Was this page helpful?