pub struct RunAgentInput {
pub thread_id: ThreadId,
pub run_id: RunId,
pub parent_run_id: Option<RunId>,
pub state: Value,
pub messages: Vec<Message>,
pub tools: Vec<Tool>,
pub context: Vec<Context>,
pub forwarded_props: Value,
}Expand description
Input for running an agent.
This is the primary request type sent by clients to start or continue an agent run. It contains the thread and run identifiers, conversation messages, available tools, context, and any custom state.
§Example
use ag_ui_core::{RunAgentInput, Context, Message, ThreadId, RunId};
let input = RunAgentInput::new(ThreadId::random(), RunId::random())
.with_messages(vec![Message::new_user("Hello!")])
.with_context(vec![
Context::new("timezone".to_string(), "UTC".to_string()),
]);
assert!(input.messages.len() == 1);
assert!(input.context.len() == 1);Fields§
§thread_id: ThreadIdThe thread identifier for this conversation.
run_id: RunIdThe run identifier for this specific agent invocation.
parent_run_id: Option<RunId>Optional parent run ID for nested or sub-agent runs.
state: ValueThe current state, can be any JSON value.
messages: Vec<Message>The conversation messages.
tools: Vec<Tool>The tools available to the agent.
context: Vec<Context>Additional context provided to the agent.
forwarded_props: ValueForwarded properties from the client.
Implementations§
Source§impl RunAgentInput
impl RunAgentInput
Sourcepub fn new(
thread_id: impl Into<ThreadId>,
run_id: impl Into<RunId>,
) -> RunAgentInput
pub fn new( thread_id: impl Into<ThreadId>, run_id: impl Into<RunId>, ) -> RunAgentInput
Creates a new RunAgentInput with the given thread and run IDs.
Initializes with empty messages, tools, context, null state, and null forwarded props.
Sourcepub fn with_parent_run_id(self, parent_id: impl Into<RunId>) -> RunAgentInput
pub fn with_parent_run_id(self, parent_id: impl Into<RunId>) -> RunAgentInput
Sets the parent run ID for nested runs.
Sourcepub fn with_state(self, state: Value) -> RunAgentInput
pub fn with_state(self, state: Value) -> RunAgentInput
Sets the state.
Sourcepub fn with_messages(self, messages: Vec<Message>) -> RunAgentInput
pub fn with_messages(self, messages: Vec<Message>) -> RunAgentInput
Sets the messages.
Sourcepub fn with_tools(self, tools: Vec<Tool>) -> RunAgentInput
pub fn with_tools(self, tools: Vec<Tool>) -> RunAgentInput
Sets the available tools.
Sourcepub fn with_context(self, context: Vec<Context>) -> RunAgentInput
pub fn with_context(self, context: Vec<Context>) -> RunAgentInput
Sets the context items.
Sourcepub fn with_forwarded_props(self, props: Value) -> RunAgentInput
pub fn with_forwarded_props(self, props: Value) -> RunAgentInput
Sets the forwarded props.
Trait Implementations§
Source§impl Clone for RunAgentInput
impl Clone for RunAgentInput
Source§fn clone(&self) -> RunAgentInput
fn clone(&self) -> RunAgentInput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RunAgentInput
impl Debug for RunAgentInput
Source§impl<'de> Deserialize<'de> for RunAgentInput
impl<'de> Deserialize<'de> for RunAgentInput
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RunAgentInput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RunAgentInput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for RunAgentInput
impl PartialEq for RunAgentInput
Source§impl Serialize for RunAgentInput
impl Serialize for RunAgentInput
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for RunAgentInput
Auto Trait Implementations§
impl Freeze for RunAgentInput
impl RefUnwindSafe for RunAgentInput
impl Send for RunAgentInput
impl Sync for RunAgentInput
impl Unpin for RunAgentInput
impl UnsafeUnpin for RunAgentInput
impl UnwindSafe for RunAgentInput
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
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>
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>
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 more