pub struct AgentInput {
pub data: JsonValue,
pub metadata: AgentInputMetadata,
pub chat_history: Option<Vec<ChatMessage>>,
}Expand description
Input data passed to an agent
Fields§
§data: JsonValue§metadata: AgentInputMetadata§chat_history: Option<Vec<ChatMessage>>Optional pre-built chat history. If provided, this is used directly instead of building messages from data. Allows outer layer to manage conversation context across multiple agent calls.
Implementations§
Source§impl AgentInput
impl AgentInput
Sourcepub fn from_value(value: JsonValue) -> Self
pub fn from_value(value: JsonValue) -> Self
Create a new AgentInput from any JSON-serializable value
Sourcepub fn with_metadata(data: JsonValue, metadata: AgentInputMetadata) -> Self
pub fn with_metadata(data: JsonValue, metadata: AgentInputMetadata) -> Self
Create a new AgentInput with metadata
Sourcepub fn from_messages(messages: Vec<ChatMessage>) -> Self
pub fn from_messages(messages: Vec<ChatMessage>) -> Self
Create a new AgentInput from existing chat messages This allows the outer layer to manage conversation history and context.
§Example
use agent_runtime::{AgentInput, ChatMessage};
let mut history = vec![
ChatMessage::system("You are a helpful assistant"),
ChatMessage::user("What's 2+2?"),
ChatMessage::assistant("4"),
ChatMessage::user("What about 3+3?"),
];
let input = AgentInput::from_messages(history);
// Agent will continue this conversationSourcepub fn from_messages_with_metadata(
messages: Vec<ChatMessage>,
metadata: AgentInputMetadata,
) -> Self
pub fn from_messages_with_metadata( messages: Vec<ChatMessage>, metadata: AgentInputMetadata, ) -> Self
Create a new AgentInput from chat messages with custom metadata
Trait Implementations§
Source§impl Clone for AgentInput
impl Clone for AgentInput
Source§fn clone(&self) -> AgentInput
fn clone(&self) -> AgentInput
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 AgentInput
impl Debug for AgentInput
Source§impl<'de> Deserialize<'de> for AgentInput
impl<'de> Deserialize<'de> for AgentInput
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 AgentInput
impl RefUnwindSafe for AgentInput
impl Send for AgentInput
impl Sync for AgentInput
impl Unpin for AgentInput
impl UnwindSafe for AgentInput
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