Cookbook
Agents & skills · for AI agents

Check usage and quota

Read token usage and the monthly quota over MCP — by agent, user, space, day or model — to answer "am I close to my limit?" and "what's driving the cost?".

MCP tools:tenant_infousage_stats

Two read-only tools answer every "how much am I using?" question. Both return metadata only — token counts and event counts — and never any conversation content.

Where you stand against the quota

tenant_info()                 # plan + monthly_token_quota (the ceiling)
usage_stats(group="total")    # tokens + events used so far this period

Use case — "am I about to run out?" Compare the total against monthly_token_quota from tenant_info. Overage is billed in arrears, so surfacing "you're at 82% of this month's quota" lets the user decide before it costs them.

What's driving the cost

usage_stats(group=…) slices the same totals. Pick the group by the question you're answering:

usage_stats(group="agent")    # which agent is busiest / burning the most tokens
usage_stats(group="user")     # which end user is heaviest — spot one runaway account
usage_stats(group="space")    # usage per customer space (multi-tenant fan-out)
usage_stats(group="day")      # trend over time — catch a spike the day it happens
usage_stats(group="model")    # cost mix across models — is an expensive model doing routine work?

Use cases at a glance:

  • "My bill jumped this month — why?"group="day" to find the spike, then group="agent" to see which agent it came from.
  • "Is one model doing work a cheaper one could?"group="model", then consider update_agent(name, model=…) on the offenders.
  • "Which customer should I upsell / rate-limit?"group="space" or group="user".

This is metadata, not analytics on content. It answers how much and by whom/what, never what was said. Chat transcripts and end-user profiles are deliberately not reachable over MCP.

Report back. Lead with the one number that matters — "You've used 4.2M of your 5M monthly tokens (84%)" — then the breakdown that explains it, and link the console for the full picture: https://console.agent4.io/#/usage.