pub struct ReadonlyContext { /* private fields */ }Expand description
Read-only access to the invocation’s values.
Implementations§
Source§impl ReadonlyContext
impl ReadonlyContext
Sourcepub fn user_content(&self) -> Option<&Content>
pub fn user_content(&self) -> Option<&Content>
The user content that started the invocation.
Sourcepub fn invocation_id(&self) -> &str
pub fn invocation_id(&self) -> &str
The invocation id.
Sourcepub fn agent_name(&self) -> String
pub fn agent_name(&self) -> String
The name of the current agent.
Sourcepub fn readonly_state(&self) -> Arc<dyn ReadonlyState> ⓘ
pub fn readonly_state(&self) -> Arc<dyn ReadonlyState> ⓘ
The session’s state, without the actions overlay.
Sourcepub fn user_id(&self) -> &str
pub fn user_id(&self) -> &str
The session’s user id, read from the session on every call, never cached.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
The session id, read from the session on every call.
Sourcepub fn identity(&self) -> Identity
pub fn identity(&self) -> Identity
The invocation’s identity from one
session read, then one accessor call per field, so the identity cannot be torn.
Sourcepub fn cancellation_token(&self) -> &CancellationToken
pub fn cancellation_token(&self) -> &CancellationToken
The invocation’s cancellation token: the
same token InvocationContext::cancellation_token
returns, so a toolset’s tools can stop when the invocation is cancelled.
Sourcepub fn record_prompt(&self, used: PromptUse)
pub fn record_prompt(&self, used: PromptUse)
Records used as the prompt version this context’s agent rendered its instruction from,
replacing an earlier record of the same agent. Every context of the invocation (including
fresh_invocation deltas such as parallel branches) sees it; each runner invocation starts
with none. Records are keyed by agent name, so two agents with the same name in one
invocation share one record.
Sourcepub fn clear_recorded_prompt(&self)
pub fn clear_recorded_prompt(&self)
Removes the prompt version recorded for this context’s agent.
Sourcepub fn recorded_prompt(&self) -> Option<PromptUse>
pub fn recorded_prompt(&self) -> Option<PromptUse>
The prompt version recorded for this context’s agent, if any.