Skip to content

Usage Tracking

The AI Context module tracks how context items are used by agents, giving you visibility into which items are being selected and where.

How it works

When an agent runs and context is selected, the module records:

  • Which context items were included in the agent's prompt
  • Which agent used them
  • The runner ID (unique identifier for the agent execution)
  • The route/path where the agent was triggered
  • Which tools the agent used during execution
  • Which entities were created or modified by the agent

Usage records are stored as ai_context_usage entities.

Viewing usage data

Usage listing

Go to /admin/ai/context/usage to see a Views-based listing of all usage records. The listing shows which context items were used, by which agents, and when.

Usage record detail

Click on any usage record to see its full details at /admin/ai/context/usage/{id}, including:

  • The agent that ran
  • The context items that were selected
  • The route where it happened
  • Tools used during execution
  • Entities that were created or modified

Usage settings

Configure usage tracking at /admin/ai/context/settings/usage:

  • Enable/disable usage tracking
  • Maximum records -- cap the total number of usage records stored
  • Maximum age -- automatically purge records older than a configured duration

Automatic cleanup

Old usage records are purged during cron based on the configured limits:

  • Records older than the maximum age are deleted first
  • If the total count still exceeds the maximum records setting, the oldest excess records are removed

Clearing usage data

To manually clear all usage records, go to /admin/ai/context/settings/usage/clear and confirm the deletion.