pub enum SteeringMode {
InstructionUpdate,
ContextInjection,
Hybrid,
}Expand description
How the phase machine steers the model’s behavior.
Controls two things:
- Phase instruction delivery — whether the phase instruction is sent as
a system instruction update (
update_instruction) or as a model-role context turn (send_client_content). - Per-turn modifier delivery — whether
with_state,when, andwith_contextmodifiers are baked into the system instruction or injected as model-role context turns.
§Choosing a mode
| Mode | System instruction | Modifiers | Best for |
|---|---|---|---|
InstructionUpdate | Replaced on every phase transition | Baked into instruction | Agents with radically different personas per phase |
ContextInjection | Set once at connect, never touched | Model-role context turns | Multi-phase apps with stable persona (recommended) |
Hybrid | Replaced on phase transition | Model-role context turns | Persona shifts + lightweight per-turn context |
§Example
use gemini_adk_fluent_rs::prelude::*;
// Recommended: base instruction at connect, phase context via injection
let handle = Live::builder()
.instruction("You are a helpful restaurant reservation assistant.")
.steering_mode(SteeringMode::ContextInjection)
.phase("greeting")
.instruction("Welcome the guest and ask how you can help.")
.done()
.phase("booking")
.instruction("Help the guest find an available time slot.")
.done()
.initial_phase("greeting")
.connect_google_ai(api_key)
.await?;Variants§
InstructionUpdate
Replace system instruction on phase transition.
The model re-processes its full context on every phase change. Gives the clearest persona shift but causes a latency spike as the model ingests the new instruction.
Per-turn modifiers (with_state, when, with_context) are baked
into the system instruction text.
ContextInjection
Inject all steering via send_client_content (model-role turns).
The system instruction set at connect time is never updated. Phase instructions and per-turn modifiers are delivered as model-role context turns, working with the model’s conversational intelligence rather than overriding it.
Lighter weight, lower latency, avoids instruction re-processing. Best for multi-phase apps where the base persona is stable.
Hybrid
Hybrid: instruction update on phase transition + context injection per turn.
Phase transitions trigger a system instruction replacement (like
InstructionUpdate), but per-turn modifiers are delivered as
model-role context turns (like ContextInjection).
Use when phases represent genuinely different personas but you also want lightweight per-turn steering within each phase.
Trait Implementations§
Source§impl Clone for SteeringMode
impl Clone for SteeringMode
Source§fn clone(&self) -> SteeringMode
fn clone(&self) -> SteeringMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more