add --no-agents flag to disable background agents

Disables memory scoring, surface, and observe agents when set.
Useful for testing with external backends (e.g. OpenRouter) where
background agent traffic would be slow and unnecessary.

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2026-04-04 23:06:25 -04:00
parent 7123c9166d
commit 060ab10340
3 changed files with 17 additions and 3 deletions

View file

@ -445,6 +445,8 @@ pub struct SessionConfig {
pub memory_file_count: usize, pub memory_file_count: usize,
pub session_dir: PathBuf, pub session_dir: PathBuf,
pub app: AppConfig, pub app: AppConfig,
/// Disable background agents (surface, observe, scoring)
pub no_agents: bool,
} }
/// A fully resolved model ready to construct an ApiClient. /// A fully resolved model ready to construct an ApiClient.
@ -514,6 +516,7 @@ impl AppConfig {
config_file_count, memory_file_count, config_file_count, memory_file_count,
session_dir, session_dir,
app: self.clone(), app: self.clone(),
no_agents: cli.no_agents,
}) })
} }

View file

@ -208,7 +208,9 @@ impl Session {
self.update_status(); self.update_status();
self.check_compaction(); self.check_compaction();
if !self.config.no_agents {
self.start_memory_scoring(); self.start_memory_scoring();
}
self.drain_pending(); self.drain_pending();
} }
@ -803,15 +805,20 @@ pub async fn run(cli: crate::user::CliArgs) -> Result<()> {
let (turn_tx, mut turn_rx) = mpsc::channel::<(Result<TurnResult>, StreamTarget)>(1); let (turn_tx, mut turn_rx) = mpsc::channel::<(Result<TurnResult>, StreamTarget)>(1);
let no_agents = config.no_agents;
let mut session = Session::new(agent, config, ui_tx.clone(), turn_tx); let mut session = Session::new(agent, config, ui_tx.clone(), turn_tx);
session.update_status(); session.update_status();
if !no_agents {
session.start_memory_scoring(); // also sends initial agent snapshots session.start_memory_scoring(); // also sends initial agent snapshots
}
session.send_context_info(); session.send_context_info();
// Start observation socket // Start observation socket
let socket_path = session.config.session_dir.join("agent.sock"); let socket_path = session.config.session_dir.join("agent.sock");
let (observe_input_tx, mut observe_input_rx) = observe::input_channel(); let (observe_input_tx, mut observe_input_rx) = observe::input_channel();
if !no_agents {
observe::start(socket_path, ui_tx.subscribe(), observe_input_tx); observe::start(socket_path, ui_tx.subscribe(), observe_input_tx);
}
let mut reader = EventStream::new(); let mut reader = EventStream::new();

View file

@ -693,6 +693,10 @@ pub struct CliArgs {
#[arg(long)] #[arg(long)]
pub dmn_max_turns: Option<u32>, pub dmn_max_turns: Option<u32>,
/// Disable background agents (surface, observe, scoring)
#[arg(long)]
pub no_agents: bool,
#[command(subcommand)] #[command(subcommand)]
pub command: Option<SubCmd>, pub command: Option<SubCmd>,
} }