Skip to main content

Agent

Struct Agent 

Source
pub struct Agent<'a, P, V>{ /* private fields */ }

Implementations§

Source§

impl<'a, P, V> Agent<'a, P, V>

Source

pub const fn new( store: &'a mut EventStore, session: Session, provider: P, verifier: V, tools: NativeTools, context_builder: ContextBuilder, limits: AgentLimits, ) -> Self

Source

pub fn execute_genui_action( &mut self, principal: &str, surface: &Surface, catalog: &ActionCatalog, action_id: &str, payload: Value, confirmation: Option<&HostConfirmation>, ) -> Result<ToolResult, AgentError>

Canonical Agent-owned bridge for a trusted GenUI action. This keeps event persistence and MCP invocation under the same Agent instance.

Source

pub fn execute_admitted_genui_action( &mut self, context: &CompositionContext, admitted: &AdmittedComposedSurface, catalog: &ActionCatalog, action_id: &str, payload: Value, confirmation: Option<&HostConfirmation>, ) -> Result<ToolResult, AgentError>

Execute an action selected from a previously admitted composition. The cached rendering is never treated as authority: the live composition context, source identity, catalog binding, durable state, and normal G1/G2 transport fence are all revalidated immediately before dispatch.

Source

pub fn compose_genui( &mut self, context: &CompositionContext, untrusted_task_data: &str, host: &HostCapabilities, _capabilities: &NegotiatedCapabilities, catalog: &mut ActionCatalog, limits: CompositionLimits, ) -> Result<ProductionComposition, AgentError>

Run the canonical production G5 path through the Agent’s configured provider: strict bounded JSON response -> host handle resolution -> mandatory authority checks -> durable negotiated renderer admission. Any provider/proposal failure uses the deterministic host-owned, read-only fallback and records privacy-safe audit metadata.

Source

pub fn compose_genui_for_outcome( &mut self, outcome: &RunOutcome, host: &HostCapabilities, capabilities: &NegotiatedCapabilities, catalog: &mut ActionCatalog, limits: CompositionLimits, ) -> Result<ProductionComposition, AgentError>

User-reachable CLI/runtime bridge: after the normal Agent run, expose the host-owned run outcome as required data and perform one explicit G5 composition turn. A provider/proposal failure deterministically renders the same host-owned outcome surface through the G5 fallback path.

Source

pub fn present_genui_action( &mut self, catalog: &ActionCatalog, action_id: &str, ) -> Result<(), AgentError>

Source

pub fn request_genui_confirmation( &mut self, catalog: &ActionCatalog, action_id: &str, payload: &Value, ) -> Result<HostConfirmation, AgentError>

Source

pub fn confirm_genui_action( &mut self, catalog: &ActionCatalog, confirmation: &HostConfirmation, ) -> Result<(), AgentError>

Source

pub fn advance_genui_current_state( &mut self, principal: &str, catalog: &mut ActionCatalog, ) -> Result<(u64, String, String), AgentError>

Advance GenUI authority from the trusted Agent/session boundary. The state digest and authorization context are derived from host-owned session and workspace data; callers cannot inject either value.

Source

pub fn with_temperature(self, temperature: f32) -> Self

Source

pub const fn with_pause_after_model_turns(self, turns: Option<u32>) -> Self

End this invocation at a persisted, source-fingerprinted turn boundary. The resulting Paused session remains resumable by a later process.

Source

pub fn run(&mut self) -> Result<RunOutcome, AgentError>

Auto Trait Implementations§

§

impl<'a, P, V> !Freeze for Agent<'a, P, V>

§

impl<'a, P, V> !RefUnwindSafe for Agent<'a, P, V>

§

impl<'a, P, V> !Send for Agent<'a, P, V>

§

impl<'a, P, V> !Sync for Agent<'a, P, V>

§

impl<'a, P, V> !UnwindSafe for Agent<'a, P, V>

§

impl<'a, P, V> Unpin for Agent<'a, P, V>
where P: Unpin, V: Unpin,

§

impl<'a, P, V> UnsafeUnpin for Agent<'a, P, V>
where P: UnsafeUnpin, V: UnsafeUnpin,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more