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

rust
fn session_id(&self) -> &str

Unique session identifier.

agent_id

rust
fn agent_id(&self) -> Option<&str>

ID of the agent handling this session.

client_id

rust
fn client_id(&self) -> Option<&str>

ID of the client in this session.

is_active

rust
fn is_active(&self) -> bool

Whether the session is currently active.

created_at

rust
fn created_at(&self) -> f64

Session creation timestamp.

last_activity

rust
fn last_activity(&self) -> f64

Last activity timestamp.

get_state

rust
fn get_state(&self) -> HashMap<String, serde_json::Value>

Get session state.

set_state

rust
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

rust
fn add_message(&mut self, message: GatewayMessage) -> ()

Add a message to the session history.

Parameters:

NameType
messageGatewayMessage

get_messages

rust
fn get_messages(&self, limit: Option<usize>) -> Vec<GatewayMessage>

Get session message history.

Parameters:

NameType
limitOption&lt;usize&gt;

close

rust
fn close(&mut self) -> ()

Close the session.

Source

View on GitHub

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


Related Documentation