pub struct AgentContextBuilder { /* private fields */ }Expand description
Re-exports every public item from klieo-core.
Fluent builder for AgentContext.
All fields except run_id and cancel are required. Omitting
run_id defaults to RunId::new(); omitting cancel defaults
to a fresh CancellationToken.
// A full build is exercised in tests; this snippet shows the chaining shape.
let result: Result<AgentContext, AgentContextBuilderError> = AgentContext::builder()
.agent_name("my-agent")
.build();
assert!(result.is_err()); // other required fields are missingImplementations§
Source§impl AgentContextBuilder
impl AgentContextBuilder
Sourcepub fn llm(self, v: Arc<dyn LlmClient>) -> AgentContextBuilder
pub fn llm(self, v: Arc<dyn LlmClient>) -> AgentContextBuilder
Set the LLM client.
Sourcepub fn short_term(self, v: Arc<dyn ShortTermMemory>) -> AgentContextBuilder
pub fn short_term(self, v: Arc<dyn ShortTermMemory>) -> AgentContextBuilder
Set the short-term memory store.
Sourcepub fn long_term(self, v: Arc<dyn LongTermMemory>) -> AgentContextBuilder
pub fn long_term(self, v: Arc<dyn LongTermMemory>) -> AgentContextBuilder
Set the long-term memory store.
Sourcepub fn episodic(self, v: Arc<dyn EpisodicMemory>) -> AgentContextBuilder
pub fn episodic(self, v: Arc<dyn EpisodicMemory>) -> AgentContextBuilder
Set the episodic memory store.
Sourcepub fn pubsub(self, v: Arc<dyn Pubsub>) -> AgentContextBuilder
pub fn pubsub(self, v: Arc<dyn Pubsub>) -> AgentContextBuilder
Set the pub/sub bus.
Sourcepub fn kv(self, v: Arc<dyn KvStore>) -> AgentContextBuilder
pub fn kv(self, v: Arc<dyn KvStore>) -> AgentContextBuilder
Set the KV store.
Sourcepub fn request_reply(self, v: Arc<dyn RequestReply>) -> AgentContextBuilder
pub fn request_reply(self, v: Arc<dyn RequestReply>) -> AgentContextBuilder
Set the request/reply bus.
Sourcepub fn jobs(self, v: Arc<dyn JobQueue>) -> AgentContextBuilder
pub fn jobs(self, v: Arc<dyn JobQueue>) -> AgentContextBuilder
Set the job queue.
Sourcepub fn tools(self, v: Arc<dyn ToolInvoker>) -> AgentContextBuilder
pub fn tools(self, v: Arc<dyn ToolInvoker>) -> AgentContextBuilder
Set the tool invoker.
Sourcepub fn run_id(self, v: RunId) -> AgentContextBuilder
pub fn run_id(self, v: RunId) -> AgentContextBuilder
Override the run ID. Defaults to RunId::new() when omitted.
Sourcepub fn cancel(self, v: CancellationToken) -> AgentContextBuilder
pub fn cancel(self, v: CancellationToken) -> AgentContextBuilder
Override the cancellation token. Defaults to a fresh token when omitted.
Sourcepub fn agent_name(self, v: impl Into<String>) -> AgentContextBuilder
pub fn agent_name(self, v: impl Into<String>) -> AgentContextBuilder
Set the agent name (required).
Sourcepub fn audit_redactor(
self,
redactor: Arc<dyn AuditRedactor>,
) -> AgentContextBuilder
pub fn audit_redactor( self, redactor: Arc<dyn AuditRedactor>, ) -> AgentContextBuilder
Install the audit redactor applied to audit-flagged tools’
recorded args/results. When omitted, dispatch falls back to the
fail-closed crate::opaque_digest for flagged tools.
Sourcepub fn tenant_label(self, label: String) -> AgentContextBuilder
pub fn tenant_label(self, label: String) -> AgentContextBuilder
Install the derived non-PII tenant attribution label. Runtime
records crate::Episode::RunAttributed at run entry when set.
Caller must pre-derive a non-PII label (e.g. via
crate::principal_hash) — the value is recorded into
episodic memory verbatim.
Sourcepub fn build(self) -> Result<AgentContext, AgentContextBuilderError>
pub fn build(self) -> Result<AgentContext, AgentContextBuilderError>
Consume the builder and produce an AgentContext.
Returns AgentContextBuilderError::MissingField when any
required field was not set.
Trait Implementations§
Source§impl Default for AgentContextBuilder
impl Default for AgentContextBuilder
Source§fn default() -> AgentContextBuilder
fn default() -> AgentContextBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for AgentContextBuilder
impl !UnwindSafe for AgentContextBuilder
impl Freeze for AgentContextBuilder
impl Send for AgentContextBuilder
impl Sync for AgentContextBuilder
impl Unpin for AgentContextBuilder
impl UnsafeUnpin for AgentContextBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().