pub struct AgentTask {
pub task_id: String,
pub input: String,
pub run_id: Option<String>,
pub metadata: HashMap<String, Value>,
}Expand description
A unit of work submitted to a TaskBroker.
Each task carries a unique ID and the input text for an agent prompt. Optional metadata lets callers tag tasks with routing hints, priority, or any application-specific data.
Fields§
§task_id: StringUnique identifier for this task (generated on creation).
input: StringThe user input to prompt the agent with.
run_id: Option<String>Optional run ID for resumable execution via checkpoints.
metadata: HashMap<String, Value>Arbitrary key-value metadata (routing hints, priority, etc.).
Implementations§
Source§impl AgentTask
impl AgentTask
Sourcepub fn new(input: impl Into<String>) -> Self
pub fn new(input: impl Into<String>) -> Self
Creates a new task with a unique ID derived from the current time and a process-wide counter.
Sourcepub fn with_run_id(self, run_id: impl Into<String>) -> Self
pub fn with_run_id(self, run_id: impl Into<String>) -> Self
Assigns a checkpoint run ID for resumable execution.
Sourcepub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
pub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
Adds a metadata key-value pair.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AgentTask
impl<'de> Deserialize<'de> for AgentTask
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 AgentTask
impl RefUnwindSafe for AgentTask
impl Send for AgentTask
impl Sync for AgentTask
impl Unpin for AgentTask
impl UnsafeUnpin for AgentTask
impl UnwindSafe for AgentTask
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