pub struct AgentUiState {
pub steps: Vec<AgentStep>,
pub current_tool: Option<String>,
pub tool_results: Vec<ToolResult>,
pub metadata: Option<Value>,
}Expand description
Agent state for generative UI rendering.
This state is streamed to frontends via STATE_SNAPSHOT events
and can be rendered using CopilotKit’s useCoAgentStateRender.
Fields§
§steps: Vec<AgentStep>Steps showing progress of agent execution.
current_tool: Option<String>Current tool being executed (if any).
tool_results: Vec<ToolResult>Tool results for rich UI rendering.
metadata: Option<Value>Additional metadata for custom rendering.
Implementations§
Source§impl AgentUiState
impl AgentUiState
Sourcepub fn complete_step(&mut self, index: usize)
pub fn complete_step(&mut self, index: usize)
Marks a step as completed by index.
Sourcepub fn complete_current_step(&mut self)
pub fn complete_current_step(&mut self)
Marks the first pending step as completed.
Sourcepub fn set_current_tool(&mut self, tool: Option<String>)
pub fn set_current_tool(&mut self, tool: Option<String>)
Sets the current tool being executed.
Trait Implementations§
Source§impl Clone for AgentUiState
impl Clone for AgentUiState
Source§fn clone(&self) -> AgentUiState
fn clone(&self) -> AgentUiState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AgentUiState
impl Debug for AgentUiState
Source§impl Default for AgentUiState
impl Default for AgentUiState
Source§fn default() -> AgentUiState
fn default() -> AgentUiState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AgentUiState
impl<'de> Deserialize<'de> for AgentUiState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AgentUiState
impl RefUnwindSafe for AgentUiState
impl Send for AgentUiState
impl Sync for AgentUiState
impl Unpin for AgentUiState
impl UnsafeUnpin for AgentUiState
impl UnwindSafe for AgentUiState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.