Skip to main content

WorkItem

Struct WorkItem 

Source
pub struct WorkItem<P> {
    pub agent_id: AgentId,
    pub prompt: P,
    pub step: CycleStep,
    pub prefix_hash: u64,
    pub model: String,
    pub queued_at: Instant,
    pub token_count: u32,
}
Expand description

A unit of work: one agent’s prompt for one cycle step.

The P type parameter is the prompt type — typically misanthropic::Prompt<'static> but kept generic for testability.

Fields§

§agent_id: AgentId

Which agent this work item belongs to.

§prompt: P

The prompt to submit to the backend.

§step: CycleStep

Which cycle step this represents.

§prefix_hash: u64

Hash of the cacheable prefix (system prompt, tools, constitution). Items with the same prefix_hash should be batched together for cache efficiency.

§model: String

Model identifier (e.g. “claude-opus-4-6”, “cogito:14b”).

§queued_at: Instant

When this item was queued. Used for starvation prevention.

§token_count: u32

Approximate token count for the full prompt (from token count API). Used for context-length bucketing on Ollama.

Trait Implementations§

Source§

impl<P: Debug> Debug for WorkItem<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P> Freeze for WorkItem<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for WorkItem<P>
where P: RefUnwindSafe,

§

impl<P> Send for WorkItem<P>
where P: Send,

§

impl<P> Sync for WorkItem<P>
where P: Sync,

§

impl<P> Unpin for WorkItem<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for WorkItem<P>
where P: UnsafeUnpin,

§

impl<P> UnwindSafe for WorkItem<P>
where P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PendingHandle for T
where T: Send + 'static,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V