Overview
This endpoint receives and stores individual events from AI agents throughout their execution. Events represent distinct steps in the agent’s reasoning loop (user inputs, model outputs, tool calls, etc.) and are essential for security analysis and observability.Events should be logged continuously throughout the agent’s lifecycle to maintain a complete audit trail.
Request
The category of event being logged. Must be one of:
user- Input from human usersmodel_input- Data sent to the LLMmodel_output- Responses from the LLMtool- Tool/function calls and resultsenvironment- External system interactionsmemory- Memory read/write operationssystem- System-level eventserror- Error conditions and failures
The session identifier obtained from
/register-agent-run. This links the event to a specific agent session.Example: "f4f4f4f4-f4f4-f4f4-f4f4-f4f4f4f4f4f4"Unix timestamp (seconds since epoch) when the event occurred.Example:
1678886405.123The event data as a stringified JSON object. Must conform to the structure defined in the
schema field.Example: "{\"location\":\"London, UK\",\"units\":\"celsius\"}"A stringified JSON Schema object defining the structure of the
content field. This enables dynamic validation and understanding of diverse event types.Example: "{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\"},\"units\":{\"type\":\"string\"}}}"Response
Unique identifier for the logged event.Example:
"e1e1e1e1-e1e1-e1e1-e1e1-e1e1e1e1e1e1"Server timestamp when the event was processed.Example:
1678886405.456Event Type Examples
User Event
Log user inputs to the agent:Tool Event
Log tool/function calls:Model Output Event
Log LLM responses:Memory Event
Log memory operations:Complete Example
Here’s a complete example of logging multiple events in sequence:Response Examples
Success Response
Error Responses
Best Practices
Log Events Immediately
Log Events Immediately
Log events as they occur rather than batching (unless using batch API):
Include Rich Context
Include Rich Context
Add contextual information that aids in debugging and analysis:
Use Detailed Schemas
Use Detailed Schemas
Provide comprehensive schemas with constraints and descriptions:
Handle Errors in Events
Handle Errors in Events
Log errors as events for complete observability:
Asynchronous Logging
Asynchronous Logging
Use async logging to minimize latency:
Performance Considerations
Batch Logging
For high-volume applications, consider batching events:Content Size Limits
Be mindful of content size:- Maximum content size: 1MB
- Maximum schema size: 64KB
- For large data, consider storing externally and logging references
Related Endpoints
- POST /register-agent-run - Register a session before logging events
- POST /check - Validate actions based on logged events
FAQ
Can I log events out of order?
Can I log events out of order?
Yes, events can arrive out of order. The timestamp field is used to establish the correct sequence. However, logging events as they occur is recommended for real-time analysis.
What happens if schema validation fails?
What happens if schema validation fails?
The event will be rejected with a 400 error detailing the validation failure. Fix the content to match the schema or update the schema to match the content.
How detailed should schemas be?
How detailed should schemas be?
Schemas should be as detailed as possible. Include types, constraints, enums, and descriptions. This helps Fabraix better understand your agent’s behavior.
Is there a limit on events per session?
Is there a limit on events per session?
There’s no hard limit on events per session, but extremely long sessions (>10,000 events) may experience degraded performance. Consider creating new sessions for long-running agents periodically.

