Skip to main content
POST
Log Event

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

enum
required
The category of event being logged. Must be one of:
  • user - Input from human users
  • model_input - Data sent to the LLM
  • model_output - Responses from the LLM
  • tool - Tool/function calls and results
  • environment - External system interactions
  • memory - Memory read/write operations
  • system - System-level events
  • error - Error conditions and failures
UUID
required
The session identifier obtained from /register-agent-run. This links the event to a specific agent session.Example: "f4f4f4f4-f4f4-f4f4-f4f4-f4f4f4f4f4f4"
float
required
Unix timestamp (seconds since epoch) when the event occurred.Example: 1678886405.123
string
required
The event data as a stringified JSON object. Must conform to the structure defined in the schema field.Example: "{\"location\":\"London, UK\",\"units\":\"celsius\"}"
string
required
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

UUID
required
Unique identifier for the logged event.Example: "e1e1e1e1-e1e1-e1e1-e1e1-e1e1e1e1e1e1"
float
required
Server timestamp when the event was processed.Example: 1678886405.456

Event 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 as they occur rather than batching (unless using batch API):
Add contextual information that aids in debugging and analysis:
Provide comprehensive schemas with constraints and descriptions:
Log errors as events for complete observability:
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

FAQ

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.
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.
Schemas should be as detailed as possible. Include types, constraints, enums, and descriptions. This helps Fabraix better understand your agent’s behavior.
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.