Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3308eae
checkpoint
michaelneale Aug 12, 2025
aae9c0b
nicer refactoring
michaelneale Aug 12, 2025
66d5030
test coverage
michaelneale Aug 12, 2025
3f1ac4c
WIP - testing out turn logic CONFIRM OR REMOVE
michaelneale Aug 12, 2025
1066976
simplifying
michaelneale Aug 14, 2025
6557b37
printing out debugging
michaelneale Aug 14, 2025
a74ec94
Merge branch 'main' into micn/multi-model-multi-provider-autopilot
michaelneale Aug 19, 2025
2f3c594
Merge branch 'micn/multi-model-multi-provider-autopilot' of github.co…
michaelneale Aug 19, 2025
79b0a94
Merge branch 'main' into micn/multi-model-multi-provider-autopilot
michaelneale Aug 22, 2025
7fbc2df
new version of flexible
michaelneale Aug 22, 2025
8e0ab84
flexible refactoring 2
michaelneale Aug 22, 2025
d527964
second opionion
michaelneale Aug 22, 2025
7a262ba
clarifying tests
michaelneale Aug 23, 2025
ea8b364
Merge branch 'main' into micn/multi-model-multi-provider-autopilot
michaelneale Aug 25, 2025
411fbcd
fmt
michaelneale Aug 25, 2025
05540d7
fix bug where it wouldn't stick
michaelneale Aug 25, 2025
aa416a5
now working a bit better
michaelneale Aug 25, 2025
2306c7f
refactoring names and rules
michaelneale Aug 25, 2025
0d10b90
checkpoint
michaelneale Aug 26, 2025
1d17e2f
checkpoint
michaelneale Aug 26, 2025
653b547
remove slop
michaelneale Aug 26, 2025
9742989
fmt
michaelneale Aug 26, 2025
2bdb004
unneeeded
michaelneale Aug 27, 2025
ebc8a96
tidy roles
michaelneale Aug 27, 2025
39b4855
tidy test
michaelneale Aug 27, 2025
99cee31
add lead support
michaelneale Aug 27, 2025
e3b8e8d
fmt
michaelneale Aug 27, 2025
e2a1109
add a bunch of algorithms to classify complexity
michaelneale Aug 28, 2025
57dde8a
Merge branch 'main' into micn/multi-model-multi-provider-autopilot
michaelneale Aug 28, 2025
43d45f4
block scope idiomatic
michaelneale Aug 28, 2025
15d5f46
tidying up
michaelneale Aug 29, 2025
c1e0fe9
Merge branch 'main' into micn/multi-model-multi-provider-autopilot
michaelneale Aug 29, 2025
f5329e8
fmt
michaelneale Aug 29, 2025
c79beed
Merge branch 'main' into micn/multi-model-multi-provider-autopilot
michaelneale Sep 1, 2025
1f7ee27
Merge branch 'main' into micn/multi-model-multi-provider-autopilot
michaelneale Sep 3, 2025
4ddfef3
adding docs and renaming config
michaelneale Sep 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions crates/goose/src/agents/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ use tokio_util::sync::CancellationToken;
use tracing::{debug, error, info, instrument};

use super::final_output_tool::FinalOutputTool;
use super::model_selector::autopilot::AutoPilot;
use super::platform_tools;
use super::tool_execution::{ToolCallResult, CHAT_MODE_TOOL_SKIPPED_RESPONSE, DECLINED_RESPONSE};
use crate::agents::subagent_task_config::TaskConfig;
Expand Down Expand Up @@ -102,6 +103,7 @@ pub struct Agent {
pub(super) tool_route_manager: ToolRouteManager,
pub(super) scheduler_service: Mutex<Option<Arc<dyn SchedulerTrait>>>,
pub(super) retry_manager: RetryManager,
pub(super) autopilot: Mutex<AutoPilot>,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -178,6 +180,7 @@ impl Agent {
tool_route_manager: ToolRouteManager::new(),
scheduler_service: Mutex::new(None),
retry_manager,
autopilot: Mutex::new(AutoPilot::new()),
}
}

Expand Down Expand Up @@ -1041,6 +1044,20 @@ impl Agent {
break;
}

{
let mut autopilot = self.autopilot.lock().await;
if let Some((new_provider, role, model)) = autopilot.check_for_switch(&messages, self.provider().await?).await? {
debug!("AutoPilot switching to {} role with model {}", role, model);
self.update_provider(new_provider).await?;

yield AgentEvent::ModelChange {
model: model.clone(),
mode: format!("autopilot:{}", role),
};
}
}


let mut stream = Self::stream_response_from_provider(
self.provider().await?,
&system_prompt,
Expand Down
1 change: 1 addition & 0 deletions crates/goose/src/agents/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub mod extension_malware_check;
pub mod extension_manager;
pub mod final_output_tool;
mod large_response_handler;
pub mod model_selector;
pub mod platform_tools;
pub mod prompt_manager;
pub mod recipe_tools;
Expand Down
28 changes: 28 additions & 0 deletions crates/goose/src/agents/model_selector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Autopilot model selector

This is an advanced feature (config of which may change, use with caution for now)
which lets goose automatically rotate through many providers and models based on rules that trigger as part of its work.

Models can change at any time, and can help (similar to lead/worker) solve persistent issues, get an advanced plan, a second opinion or more.

`premade_roles.yaml` are the out of the box configurations, which can be used in the `~/.config/goose/config.yaml` like so:


```yaml
x-advanced-models:
- provider: databricks
model: goose-gpt-5
role: reviewer
- provider: anthropic
model: claude-opus-4-1-20250805
role: deep-thinker
```

in this case, when there is some complex activity or planning or thining required, it will automatically switch to opus for a while, likewise when code changes have been made, it will use the reviewer model.

## Use cases

You can do a lead/worker like combo, or you can default to a low cost model and only in some cases use a frontier model.
You could default to a local model, and only intermittently switch when needed.

use `--debug` flag if you want to see it logging when it changes.
Loading
Loading