Struct StepEvent
#[non_exhaustive]pub struct StepEvent {
pub id: String,
pub parent: Option<String>,
pub kind: StepKind,
pub label: String,
pub state: StepState,
pub icon: Option<StepIcon>,
pub detail: Option<String>,
pub input: Option<Map<String, Value>>,
pub output: Option<StepOutput>,
}Expand description
One report about a step: it started, moved, or ended.
The first report of an id starts the step, later ones update it, and a report whose state
is_end ends it; a report after the end starts it again (a retry). Make the
event with StepEvent::new and the builder methods, which keep the bounds of the contract (an
id of at most [MAX_STEP_ID_BYTES] bytes, a one-line label of at most [MAX_STEP_LABEL_CHARS]
characters, a detail of at most [MAX_STEP_DETAIL_CHARS]).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: StringThe step’s id: unique within the run, stable across the reports about it. A tool call’s own
step is tool:<call id>.
parent: Option<String>The step this one runs under, reported earlier. None: at the top, under the agent.
kind: StepKindWhat kind of work it is.
label: StringA plain one-line label.
state: StepStateWhere it stands.
icon: Option<StepIcon>The picture to draw it with.
detail: Option<String>Plain text: a result, a failure, what it is doing now.
input: Option<Map<String, Value>>What the call was given: the arguments of a tool call, as a JSON object, on the report that
starts the step. Cut to [STEP_INPUT_MAX_BYTES] and made printable by
with_input; the caller redacts what it knows to be secret first.
output: Option<StepOutput>What the call answered (or the error it ended with), on the report that ends the step.
Implementations§
§impl StepEvent
impl StepEvent
pub fn new(
id: impl Into<String>,
kind: StepKind,
label: impl AsRef<str>,
state: StepState,
) -> StepEvent
pub fn new( id: impl Into<String>, kind: StepKind, label: impl AsRef<str>, state: StepState, ) -> StepEvent
A report about the step id: its kind, label and state. The id is cut to
[MAX_STEP_ID_BYTES] bytes (control characters become _), and the label to one line of at
most [MAX_STEP_LABEL_CHARS] characters.
pub fn under(self, parent: impl Into<String>) -> StepEvent
pub fn under(self, parent: impl Into<String>) -> StepEvent
Run under the step parent, which was reported earlier.
pub fn with_detail(self, detail: impl AsRef<str>) -> StepEvent
pub fn with_detail(self, detail: impl AsRef<str>) -> StepEvent
Say more: a result, a failure, what it is doing now. Cut to [MAX_STEP_DETAIL_CHARS]
characters (ending in …); line breaks are kept.
pub fn with_input(self, input: Map<String, Value>) -> StepEvent
pub fn with_input(self, input: Map<String, Value>) -> StepEvent
Say what the call was given: input, bounded as the contract wants
([STEP_INPUT_MAX_BYTES]): control characters other than the line break and the tab are dropped,
a string longer than [STEP_INPUT_STRING_MAX_CHARS] characters is cut (ending in …), and an input
that is still larger once serialized is replaced by {"_cut": true, "bytes": <its size>}.
Redact what is secret before this: a cut can leave the front half of a value that a redactor would no longer recognise.
pub fn with_input_within(
self,
input: Map<String, Value>,
max: usize,
) -> StepEvent
pub fn with_input_within( self, input: Map<String, Value>, max: usize, ) -> StepEvent
As with_input, with a bound of max bytes (at most
[STEP_INPUT_MAX_BYTES]).
pub fn with_output(self, output: StepOutput) -> StepEvent
pub fn with_output(self, output: StepOutput) -> StepEvent
Say what the call answered: see StepOutput.
Trait Implementations§
§impl<'de> Deserialize<'de> for StepEvent
impl<'de> Deserialize<'de> for StepEvent
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StepEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StepEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for StepEvent
§impl Serialize for StepEvent
impl Serialize for StepEvent
§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 StepEvent
Auto Trait Implementations§
impl Freeze for StepEvent
impl RefUnwindSafe for StepEvent
impl Send for StepEvent
impl Sync for StepEvent
impl Unpin for StepEvent
impl UnsafeUnpin for StepEvent
impl UnwindSafe for StepEvent
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].