pub struct TaskSession {Show 16 fields
pub session_id: SessionId,
pub agent_id: Uuid,
pub delegation_chain_snapshot: Vec<String>,
pub declared_intent: String,
pub authorized_tools: Vec<String>,
pub authorized_credentials: Vec<String>,
pub time_limit: Duration,
pub call_budget: u64,
pub calls_made: u64,
pub rate_limit_per_minute: Option<u64>,
pub rate_window_start: DateTime<Utc>,
pub rate_window_calls: u64,
pub rate_limit_window_secs: u64,
pub data_sensitivity_ceiling: DataSensitivity,
pub created_at: DateTime<Utc>,
pub status: SessionStatus,
}Expand description
A task session scoping what an agent is allowed to do.
Fields§
§session_id: SessionIdUnique session identifier.
agent_id: UuidThe agent operating within this session.
delegation_chain_snapshot: Vec<String>Snapshot of the delegation chain at session creation time.
declared_intent: StringThe declared intent for this session (free-form string).
Tools this session is authorized to call (from policy evaluation).
Credential references this session is authorized to resolve.
Empty means no credentials are allowed (deny-by-default).
This prevents agents from injecting ${CRED:admin_password} inside
an authorized tool call’s arguments when they should only access
their own credentials.
time_limit: DurationMaximum duration for this session.
call_budget: u64Maximum number of tool calls allowed.
calls_made: u64Number of tool calls made so far.
rate_limit_per_minute: Option<u64>Per-minute rate limit. None means no rate limit (only lifetime budget applies).
rate_window_start: DateTime<Utc>Start of the current rate-limit window.
rate_window_calls: u64Number of calls within the current rate-limit window.
rate_limit_window_secs: u64Duration of the rate-limit window in seconds. Defaults to 60.
data_sensitivity_ceiling: DataSensitivityMaximum data sensitivity this session may access.
created_at: DateTime<Utc>When this session was created.
status: SessionStatusCurrent session status.
Implementations§
Source§impl TaskSession
impl TaskSession
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns true if the session has exceeded its time limit.
Sourcepub fn is_budget_exceeded(&self) -> bool
pub fn is_budget_exceeded(&self) -> bool
Returns true if the session’s call budget is exhausted.
Returns true if the given tool is authorized in this session.
Returns true if the given credential reference is authorized in this session.
Empty authorized_credentials means all credentials are allowed (wide-open,
matching the same pattern as is_tool_authorized for backward compatibility).
Non-empty means only the listed credential references are permitted.
Sourcepub fn check_rate_limit(&mut self) -> bool
pub fn check_rate_limit(&mut self) -> bool
Check and update the rate-limit window. Returns true if the call should be rejected due to rate limiting.
Trait Implementations§
Source§impl Clone for TaskSession
impl Clone for TaskSession
Source§fn clone(&self) -> TaskSession
fn clone(&self) -> TaskSession
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more