Expand description
§Bob Runtime
Runtime orchestration layer for the Bob Agent Framework.
§Overview
This crate provides the orchestration layer that coordinates agent execution:
- Scheduler: Finite state machine for agent turn execution
- Action Parser: Parses LLM responses into structured actions
- Prompt Builder: Constructs prompts with tool definitions and context
- Composite Tool Port: Aggregates multiple tool sources
This crate depends only on bob_core port traits — never on concrete adapters.
§Architecture
┌─────────────────────────────────────────┐
│ AgentRuntime (trait) │
├─────────────────────────────────────────┤
│ ┌──────────┐ ┌──────────┐ ┌───────┐ │
│ │Scheduler │→ │Prompt │→ │Action │ │
│ │ FSM │ │Builder │ │Parser │ │
│ └──────────┘ └──────────┘ └───────┘ │
└─────────────────────────────────────────┘
↓ uses ports from bob_core§Example
ⓘ
use bob_runtime::{AgentBootstrap, AgentRuntime, RuntimeBuilder};
use bob_core::{
ports::{LlmPort, ToolPort, SessionStore, EventSink},
types::TurnPolicy,
};
use std::sync::Arc;
fn create_runtime(
llm: Arc<dyn LlmPort>,
tools: Arc<dyn ToolPort>,
store: Arc<dyn SessionStore>,
events: Arc<dyn EventSink>,
) -> Result<Arc<dyn AgentRuntime>, bob_core::error::AgentError> {
RuntimeBuilder::new()
.with_llm(llm)
.with_tools(tools)
.with_store(store)
.with_events(events)
.with_default_model("openai:gpt-4o-mini")
.with_policy(TurnPolicy::default())
.build()
}§Features
- Finite State Machine: Robust turn execution with state tracking
- Streaming Support: Real-time event streaming via
run_stream() - Tool Composition: Aggregate multiple MCP servers or tool sources
- Turn Policies: Configurable limits for steps, timeouts, and retries
- Health Monitoring: Built-in health check endpoints
§Modules
scheduler- Core FSM implementation for agent executionaction- Action types and parser for LLM responsesprompt- Prompt construction and tool definition formattingcomposite- Multi-source tool aggregation
§Related Crates
bob_core- Domain types and portsbob_adapters- Concrete implementations
Re-exports§
pub use tooling::NoOpToolPort;pub use tooling::TimeoutToolLayer;pub use tooling::ToolLayer;pub use bob_core as core;
Modules§
- action
- Action Parser
- composite
- Composite Tool Port
- prompt
- Prompt Builder
- scheduler
- Scheduler
- tooling
- Tooling helpers for runtime composition.
Structs§
- Default
Agent Runtime - Default runtime that composes the 4 port traits via
Arc<dyn ...>. - Runtime
Builder - Trait-first runtime builder used by composition roots.
Enums§
- Dispatch
Mode - Action dispatch mode for model responses.
Traits§
- Agent
Bootstrap - Bootstrap contract for producing an
AgentRuntime. - Agent
Runtime - The primary API for running agent turns.