Expand description
Context module - Execution context types
This module provides the context types passed through all execution:
- TenantContext: Multi-tenant isolation boundary (REQUIRED)
- RuntimeContext: The execution spine
- TraceContext: W3C distributed tracing
- InvocationContext: Agent/tool invocation context
§Key Invariant: TenantContext is Required
Every execution MUST have a TenantContext. This ensures:
- Multi-tenant isolation
- Resource limit enforcement
- Audit compliance
- Billing attribution
§Usage
ⓘ
use enact_core::context::{TenantContext, RuntimeContext};
use enact_core::kernel::{ExecutionId, ParentLink, TenantId, UserId};
// Create tenant context (REQUIRED)
let tenant = TenantContext::new(TenantId::from("tenant_acme"))
.with_user(UserId::from("usr_alice"));
// Create runtime context with tenant
let ctx = RuntimeContext::new(
ExecutionId::new(),
ParentLink::from_user_message("msg_123"),
tenant,
);Structs§
- Invocation
Context - InvocationContext - Context for invoking an agent or tool
- Invocation
Services - Services available during invocation
- Resource
Limits - Resource limits enforced by the runtime per tenant
- Runtime
Context - RuntimeContext - The context passed through all execution
- Runtime
Context Builder - Builder for creating RuntimeContext with fluent API
- Session
Context - Session context for user-initiated flows
- Tenant
Context - TenantContext - Required context for every execution
- Trace
Context - TraceContext - W3C Trace Context for distributed tracing