Skip to main content
Practical recipes for loading agent data into a BI tool or data warehouse. For the endpoint reference, see Agent Usage Feed. For a one-off answer without code, ask your AI client to use the Runlayer MCP get_agent_usage_report tool instead.

Prerequisites

  • A Runlayer instance (referred to as RUNLAYER_URL below)
  • A personal API key from a user with both the View company metrics and Export usage data permissions. Use the least-privileged role that has both, Analytics Admin, rather than a Super Admin. Create it in Settings → Personal API keys. The key stops working if that user is deactivated, so give an ETL job a key from a user who will stay active
  • Python 3.9+ for the scripted recipes (standard library only)

Fetch One Page

The response has count (total agents), next_cursor, and data (one item per agent). Pass next_cursor back as cursor to get the next page, until it is null.

Export Every Agent to CSV

Pages through the whole feed for one date range and writes one row per agent, plus one row per agent and consumer.

Load Daily Partitions

For a warehouse table partitioned by day, pull one day per request and replace the last two days on every sync. Tokens for a run are recorded when it finishes, so the most recent day can still change.
Agent-level usage covers every consumer, so a day’s agent totals equal the sum of that day’s consumer rows.

Handle Errors