pub struct Runtime {
pub store: Store,
pub skills: Vec<Skill>,
pub projects: Vec<Project>,
pub data_dir: String,
pub system_prompt: String,
pub channel: String,
pub project: Option<String>,
pub hook_runner: Arc<dyn HookRunner>,
pub permission_rules: Option<Arc<PermissionRules>>,
pub guardrail_runner: Option<Arc<dyn GuardrailRunner>>,
pub auto_compact: bool,
}Expand description
A configured Kernex runtime with all subsystems initialized.
Fields§
§store: StorePersistent memory store.
skills: Vec<Skill>Loaded skills from the data directory.
projects: Vec<Project>Loaded projects from the data directory.
data_dir: StringData directory path (expanded).
system_prompt: StringBase system prompt prepended to every request.
channel: StringCommunication channel identifier (e.g. “cli”, “api”, “slack”).
project: Option<String>Active project key for scoping memory and lessons.
hook_runner: Arc<dyn HookRunner>Hook runner for tool lifecycle events.
permission_rules: Option<Arc<PermissionRules>>Declarative allow/deny rules applied before each tool call.
guardrail_runner: Option<Arc<dyn GuardrailRunner>>Optional guardrail applied to input before provider call and output after.
auto_compact: boolWhen true, conversations whose history exceeds max_context_messages
have their overflow summarized via the active provider instead of
silently dropped. See RuntimeBuilder::auto_compact.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub async fn complete(
&self,
provider: &dyn Provider,
request: &Request,
) -> Result<Response, KernexError>
pub async fn complete( &self, provider: &dyn Provider, request: &Request, ) -> Result<Response, KernexError>
Send a request through the full runtime pipeline: build context from memory → enrich with skills → complete via provider → save exchange.
This is the high-level convenience method that wires together all Kernex subsystems in a single call.
Sourcepub async fn complete_with_needs(
&self,
provider: &dyn Provider,
request: &Request,
needs: &ContextNeeds,
) -> Result<Response, KernexError>
pub async fn complete_with_needs( &self, provider: &dyn Provider, request: &Request, needs: &ContextNeeds, ) -> Result<Response, KernexError>
Like complete, but with explicit control over which
context blocks are loaded from memory.
Sourcepub async fn complete_stream(
&self,
provider: &dyn StreamingProvider,
request: &Request,
) -> Result<Receiver<StreamEvent>, KernexError>
pub async fn complete_stream( &self, provider: &dyn StreamingProvider, request: &Request, ) -> Result<Receiver<StreamEvent>, KernexError>
Stream a request through the runtime pipeline, returning events as they arrive.
Builds context from memory, enriches with skills, opens a streaming connection
to the provider, and persists the exchange to memory after the stream completes.
Returns a channel receiver that yields StreamEvents until Done or Error.
Sourcepub async fn complete_stream_with_needs(
&self,
provider: &dyn StreamingProvider,
request: &Request,
needs: &ContextNeeds,
) -> Result<Receiver<StreamEvent>, KernexError>
pub async fn complete_stream_with_needs( &self, provider: &dyn StreamingProvider, request: &Request, needs: &ContextNeeds, ) -> Result<Receiver<StreamEvent>, KernexError>
Like complete_stream, but with explicit control over which
context blocks are loaded from memory.
Sourcepub async fn run(
&self,
provider: &dyn Provider,
request: &Request,
config: &RunConfig,
) -> Result<RunOutcome, KernexError>
pub async fn run( &self, provider: &dyn Provider, request: &Request, config: &RunConfig, ) -> Result<RunOutcome, KernexError>
Run the agent with explicit lifecycle control.
Sets max_turns in context so the provider’s agentic loop respects it,
wires the runtime hook runner, calls the provider, fires the on_stop
hook, and wraps the outcome in RunOutcome.
Auto Trait Implementations§
impl Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl UnsafeUnpin for Runtime
impl !UnwindSafe for Runtime
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> 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 more