Expand description
Turn runtime and session host for the Machi kernel.
Maturity: core (turn, host, session, spawn); stable workflow host adapter.
Re-exports§
pub use gates::CompletionToolGate;pub use gates::GateChain;pub use gates::GateDecision;pub use gates::StopGate;pub use gates::evaluate_stop_gates;pub use host::AgentRunResult;pub use host::DEFAULT_MAX_CONCURRENT_CHILDREN;pub use host::DEFAULT_MAX_SPAWN_DEPTH;pub use host::InProcessHost;pub use host::SessionHost;pub use host::SpawnOpts;pub use isolation::InProcessIsolation;pub use isolation::IsolationBackend;pub use isolation::IsolationEnv;pub use isolation::isolation_error;pub use lifecycle::LifecycleFanout;pub use lifecycle::NoopLifecycle;pub use lifecycle::TurnAbortReason;pub use lifecycle::TurnLifecycleContributor;pub use stationarity::HARD_STOP_THRESHOLD;pub use stationarity::NUDGE_THRESHOLD;pub use stationarity::StationarityAction;pub use stationarity::StationarityTracker;pub use stationarity::fingerprint_batch;pub use stationarity::nudge_message;pub use schema::STRUCTURED_OUTPUT_MAX_RETRIES;pub use schema::compile_schema;pub use schema::schema_retry_reminder;pub use schema::validate_structured_output;pub use session::Session;pub use side_effects::WorkflowSideEffects;pub use spawn_tool::SpawnAgentTool;pub use state::ConversationState;pub use state::VecConversationState;pub use state::estimate_messages_tokens;pub use turn::TurnInput;pub use turn::TurnOptions;pub use turn::TurnOutcome;pub use turn::TurnRuntime;pub use turn::estimate_conversation_tokens;pub use workflow_host::run_workflow_configured;pub use workflow_host::run_workflow_on_host;pub use workflow_host::run_workflow_on_host_with_metrics;
Modules§
- gates
- Stop gates evaluated when the model returns a non-tool final message.
- host
- Session host for nested agent runs (dynamic multi-agent delegation).
- isolation
- Isolation backend for nested agent runs (default: in-process, no sandbox).
- lifecycle
- Turn lifecycle contributor port (W3.5).
- metrics
- Re-export observability metrics from
machi_obs. - schema
- JSON Schema validation for structured agent outputs.
- session
- Multi-turn session helper over
TurnRuntime. - side_
effects - In-process workflow side effects: scratch, templates, optional git diff.
- spawn_
tool - Model-facing
spawn_agenttool for dynamic multi-agent delegation. - state
- Conversation state abstractions.
- stationarity
- Identical tool-call stationarity protection (W3.1).
- turn
TurnRuntime: host-agnostic ReAct-style loop with stop gates and compaction.- workflow_
host - Adapter:
machi-workflowhost channel →SessionHostnested runs.
Structs§
- Compaction
Outcome - Result of a compaction pass.
- MaxMessages
- Drop oldest non-system messages until
maxremains. - Noop
Metrics - Discards all metrics (default for tests / offline).
- Token
Threshold - Drop oldest non-system messages when
token_estimateexceedsmax_tokens.
Constants§
- METRIC_
COMPACTIONS_ TOTAL - Counter: compaction passes by strategy/result.
- METRIC_
SAMPLE_ DURATION_ MS - Histogram: LLM sample duration in milliseconds.
- METRIC_
SPAWNS_ TOTAL - Counter: nested agent spawns by status.
- METRIC_
TOKENS_ TOTAL - Counter: tokens by direction (
input,output). - METRIC_
TOOL_ CALLS_ TOTAL - Counter: tool calls by tool name and status.
- METRIC_
TOOL_ DURATION_ MS - Histogram: tool duration in milliseconds.
- METRIC_
TURNS_ TOTAL - Counter: completed turns by status (
ok,error,cancelled). - METRIC_
TURN_ DURATION_ MS - Histogram: turn wall duration in milliseconds.
- METRIC_
TURN_ STEPS - Histogram: steps consumed per turn.
- METRIC_
WORKFLOW_ AGENTS_ TOTAL - Counter: workflow agent slots consumed.
- METRIC_
WORKFLOW_ RUNS_ TOTAL - Counter: workflow runs by outcome.
Traits§
- Compaction
Strategy - Pure compaction strategy.
- Metrics
Sink - Host-provided metrics backend.
Functions§
- record_
compaction - Record a compaction pass.
- record_
sample - Record sample duration and tokens.
- record_
spawn - Record a nested spawn.
- record_
tool_ call - Record one tool call.
- record_
turn - Record a completed turn.
- record_
workflow_ agents - Record workflow agent slot consumption.
- record_
workflow_ run - Record workflow terminal outcome.
- required_
metric_ names - Required metric name catalogue (contract tests / CI snapshots).
Type Aliases§
- Shared
Metrics - Shared metrics handle.