When organizations start logging AI agent activity, they face a fundamental question: what format should the data be in?
Custom JSON schemas are flexible but create silos. Proprietary formats lock you into specific vendors. What you need is a standard, something designed for capturing activity data at scale.
Enter xAPI.
What Is xAPI?
xAPI (Experience API, also called Tin Can API) is an e-learning specification for tracking and recording learning experiences. It was designed to capture statements about what a learner did, in what context, with what result.
The core format is simple: Actor + Verb + Object
{
"actor": { "name": "Sales Agent #47" },
"verb": { "id": "qualified", "display": "qualified" },
"object": { "id": "lead-7734", "name": "Lead #7734" },
"result": { "success": true, "duration": "PT340MS" },
"context": { "platform": "CRM Integration" }
}
This reads naturally: "Sales Agent #47 qualified Lead #7734."
Why xAPI for AI Agents?
xAPI wasn't designed for AI agents. It was designed for human learners in educational contexts. But its core abstractions map remarkably well to agent activity:
Natural Language Structure
Agent actions are naturally described as actor-verb-object: "Agent classified email as spam." "Agent escalated ticket to human." "Agent recommended product to customer."
xAPI's structure captures this without forcing artificial schemas.
Rich Context
Every xAPI statement can include context: what platform, what session, what other activities preceded this one. For AI agents, this context is crucial for understanding decisions.
Extensible Results
The result field can capture success/failure, scores, durations, and custom extensions. For agents, this means capturing confidence levels, alternative options considered, and downstream outcomes.
Built-in Provenance
xAPI statements include timestamps, authorities (who logged this), and optional attachments. This creates audit trails by design.
Industry Standard
Because xAPI is an established standard, there's tooling, documentation, and expertise available. You're not reinventing the wheel.
xAPI vs. Custom Logging
Compare an xAPI statement to typical custom logging:
Custom Log:
{
"timestamp": "2025-01-28T14:23:00Z",
"agent_id": "sales-47",
"action": "lead_qualification",
"lead_id": "7734",
"status": "qualified",
"latency_ms": 340
}
xAPI Statement:
{
"actor": {
"account": { "name": "sales-47" }
},
"verb": {
"id": "https://empress.eco/xapi/verbs/qualified",
"display": { "en": "qualified" }
},
"object": {
"id": "https://crm.example.com/leads/7734",
"objectType": "Activity"
},
"result": {
"success": true,
"duration": "PT0.34S"
},
"timestamp": "2025-01-28T14:23:00Z"
}
The xAPI version is more verbose but provides:
- Standardized verb vocabulary with URIs
- Object identification that works across systems
- Result structure that's consistent across all statements
- Automatic compatibility with xAPI tooling and analytics
Building an Agent Activity Vocabulary
The power of xAPI comes from building a consistent vocabulary for your domain. For AI agents, this might include:
Decision Verbs:
- analyzed
- classified
- predicted
- recommended
- escalated
- approved
- rejected
Action Verbs:
- created
- updated
- sent
- queried
- invoked
- completed
Outcome Verbs:
- succeeded
- failed
- timed-out
- was-overridden
With a consistent vocabulary, you can query across all agents: "Show me all escalations this week" or "What's the success rate for predictions?"
The LRS (Learning Record Store) Advantage
xAPI data is stored in a Learning Record Store (LRS). While "learning" is in the name, an LRS is really just a database optimized for xAPI statements. Benefits include:
- Standardized API for storing and querying statements
- Aggregation and analytics built in
- Cross-system compatibility between any xAPI-compliant tools
- Compliance-ready data retention and access controls
For AI agent observability, an LRS becomes your central repository for all agent activity: queryable, analyzable, and auditable.
Getting Started with xAPI
If you're building AI agent observability, consider xAPI from the start:
-
Define your vocabulary. What verbs describe your agents' actions? What objects do they act on?
-
Instrument your agents. Emit xAPI statements for significant decisions and actions.
-
Choose an LRS. Self-hosted or cloud, open-source or commercial. There are options for every scale.
-
Build analytics. Use the standardized query API to build dashboards and alerts.
-
Plan for compliance. xAPI's audit trail capabilities align well with EU AI Act requirements.
The Empress Approach
Empress uses xAPI as the foundation for AI agent observability. Every agent action is captured as an xAPI statement, stored in a compliant LRS, and queryable through standard interfaces.
This means:
- Your agent data isn't locked into a proprietary format
- You can integrate with any xAPI-compatible tool
- Compliance audits have standardized data to work with
- Analytics work across all your agents consistently
The format you choose for logging matters. xAPI is the format designed for exactly this problem.