#[non_exhaustive]pub struct Event {Show 25 fields
pub id: String,
pub session_id: Option<String>,
pub project_id: String,
pub event_type: String,
pub timestamp: SystemTime,
pub duration: Option<Duration>,
pub input_tokens: Option<u32>,
pub output_tokens: Option<u32>,
pub sdk_language: Option<String>,
pub agentcat_version: Option<String>,
pub server_name: Option<String>,
pub server_version: Option<String>,
pub client_name: Option<String>,
pub client_version: Option<String>,
pub identify_actor_given_id: Option<String>,
pub identify_actor_name: Option<String>,
pub identify_actor_data: Option<Map<String, Value>>,
pub resource_name: Option<String>,
pub parameters: Option<Value>,
pub response: Option<Value>,
pub user_intent: Option<Value>,
pub is_error: Option<bool>,
pub error: Option<Value>,
pub tags: Option<BTreeMap<String, String>>,
pub properties: Option<Map<String, Value>>,
}Expand description
An event as AgentCat publishes it, as the hook of
Options::redact_event sees it. The hook may change any
field. It cannot add a field that events do not have, and the SDK restores the system fields
(id, session_id, project_id, event_type and timestamp) when the hook changes them.
The free-form fields (parameters, response, user_intent, error, identify_actor_data
and properties) hold JSON values, as the published event carries them.
To unit-test a redact_event hook, build an event with Event::default, set the fields
the hook reads, and call the hook with it.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: StringThe ID of the event.
session_id: Option<String>The session the event belongs to.
project_id: StringThe project the event is published to.
event_type: StringThe kind of event, such as mcp:tools/call.
timestamp: SystemTimeWhen the event happened.
duration: Option<Duration>How long it took.
input_tokens: Option<u32>The estimated tokens of the request.
output_tokens: Option<u32>The estimated tokens of the response.
sdk_language: Option<String>The language of the SDK: "Rust".
agentcat_version: Option<String>The version of the SDK.
server_name: Option<String>The name of the MCP server.
server_version: Option<String>The version of the MCP server.
client_name: Option<String>The name of the MCP client.
client_version: Option<String>The version of the MCP client.
identify_actor_given_id: Option<String>The ID of the caller in the customer’s system.
identify_actor_name: Option<String>The display name of the caller.
identify_actor_data: Option<Map<String, Value>>Other data about the caller.
resource_name: Option<String>The name of the tool or resource.
parameters: Option<Value>The parameters of the call.
response: Option<Value>The response of the call.
user_intent: Option<Value>Why the agent made the call.
is_error: Option<bool>Whether the call failed.
error: Option<Value>The error of the call.
The tags of the event.
properties: Option<Map<String, Value>>The properties of the event.
Trait Implementations§
Source§impl Default for Event
impl Default for Event
Source§fn default() -> Self
fn default() -> Self
An empty event: id, project_id and event_type are empty, timestamp is the Unix
epoch, and every other field is None. Set the fields a test needs:
use agentcat_sdk::Event;
use serde_json::json;
let mut event = Event::default();
event.parameters = Some(json!({"api_key": "fake-secret-42"}));