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 more