Gateway Session Protocol • Rust AI Agent SDK
GatewaySessionProtocol: Protocol for gateway session management. Sessions track conversations between clients and agents, maintaining state and message history.
GatewaySessionProtocol
Defined in the gateway module.
Rust AI Agent SDK
Protocol for gateway session management. Sessions track conversations between clients and agents, maintaining state and message history.
Methods
session_id
fn session_id(&self) -> &strUnique session identifier.
agent_id
fn agent_id(&self) -> Option<&str>ID of the agent handling this session.
client_id
fn client_id(&self) -> Option<&str>ID of the client in this session.
is_active
fn is_active(&self) -> boolWhether the session is currently active.
created_at
fn created_at(&self) -> f64Session creation timestamp.
last_activity
fn last_activity(&self) -> f64Last activity timestamp.
get_state
fn get_state(&self) -> HashMap<String, serde_json::Value>Get session state.
set_state
fn set_state(&mut self, key: &str, value: serde_json::Value) -> ()Set a session state value.
Parameters:
| Name | Type |
|---|---|
key | &str |
value | serde_json::Value |
add_message
fn add_message(&mut self, message: GatewayMessage) -> ()Add a message to the session history.
Parameters:
| Name | Type |
|---|---|
message | GatewayMessage |
get_messages
fn get_messages(&self, limit: Option<usize>) -> Vec<GatewayMessage>Get session message history.
Parameters:
| Name | Type |
|---|---|
limit | Option<usize> |
close
fn close(&mut self) -> ()Close the session.
Source
View on GitHubpraisonai/src/gateway/mod.rs at line 0