Skip to content

Event Lifecycle

Understanding agent sessions, event ordering, and the lifecycle of telemetry data.

A session is identified by assigning the same session_id value to all events that belong to that session. To group events together, simply use a consistent session_id across those events.

You can assign an agent_id to an event. This helps identify multiple agents in the same session. If the agent_id is not set, Cylestio will automatically identify it based on the session and the configured prompt.

Events in a session follow a predictable lifecycle pattern. Understanding this order helps ensure proper telemetry collection and analysis.

  1. session.start — Agent session begins, user context and initial configuration established (Required: session_id, agent_id (optional), user context)
  2. llm.call.* & tool.* events — LLM interactions, function executions, and agent decision-making events (May include: llm.call.start, llm.call.finish, tool.execution, tool.result)
  3. session.end — Session completion with summary metrics and final state (Includes: total_events, session_duration_ms, completion_status)
  • session.start → Agent initialization
    • llm.call.start → LLM request initiated
    • llm.call.finish → LLM response received
    • tool.execution → Function execution begins
    • tool.result → Function execution completes
  • session.end → Session completion
  • trace_id: 32-character hex string
  • Links all events in a distributed session
  • OpenTelemetry compatible format
  • span_id: 16-character hex string
  • Identifies individual operations
  • Enables hierarchical event tracking

Send events asynchronously to avoid impacting proxy performance. Cylestio Perimeter gateway continues operation even if event sending fails.

Only performance and behavioral metadata is collected. PII data can be omitted from request payloads.

Use consistent session_id values across all related events to enable proper session analysis and correlation.

Use ISO 8601 timestamps with timezone support for accurate event ordering and analysis.