Skip to main content

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) -> &str
Unique 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) -> bool
Whether the session is currently active.

created_at

fn created_at(&self) -> f64
Session creation timestamp.

last_activity

fn last_activity(&self) -> f64
Last 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:
NameType
key&str
valueserde_json::Value

add_message

fn add_message(&mut self, message: GatewayMessage) -> ()
Add a message to the session history. Parameters:
NameType
messageGatewayMessage

get_messages

fn get_messages(&self, limit: Option<usize>) -> Vec<GatewayMessage>
Get session message history. Parameters:
NameType
limitOption&lt;usize&gt;

close

fn close(&mut self) -> ()
Close the session.

Source

View on GitHub

praisonai/src/gateway/mod.rs at line 0