Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
63 changes: 9 additions & 54 deletions sidecar/src/agentic/tool/session/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,16 @@ impl SessionService {
project_labels: Vec<String>,
repo_ref: RepoRef,
root_directory: String,
tools: Vec<ToolType>,
tool_box: Arc<ToolBox>,
llm_broker: Arc<LLMBroker>,
user_context: UserContext,
aide_rules: Option<String>,
reasoning: bool,
running_in_editor: bool,
semantic_search: bool,
mcts_log_directory: Option<String>,
repo_name: Option<String>,
message_properties: SymbolEventMessageProperties,
is_devtools_context: bool,
context_crunching_llm: Option<LLMProperties>,
) -> Result<(), SymbolError> {
println!("session_service::tool_use_agentic::start");
Expand All @@ -420,45 +419,7 @@ impl SessionService {
// always update the tools over here, no matter what the session had before
// this is essential because the same session might be crossing over from
// a chat or edit
.set_tools(
vec![
ToolType::ListFiles,
ToolType::SearchFileContentWithRegex,
ToolType::OpenFile,
ToolType::CodeEditing,
ToolType::AttemptCompletion,
ToolType::RepoMapGeneration,
ToolType::TerminalCommand,
ToolType::FindFiles,
// remove this later
// ToolType::SemanticSearch,
]
.into_iter()
.chain(tool_box.mcp_tools().iter().cloned())
.chain(if is_devtools_context {
vec![ToolType::RequestScreenshot]
} else {
vec![]
})
.into_iter()
.chain(if running_in_editor {
// these tools are only availabe inside the editor
// they are not available on the agent-farm yet
vec![
ToolType::LSPDiagnostics,
// disable for testing
ToolType::AskFollowupQuestions,
]
} else {
vec![]
})
.chain(if semantic_search {
vec![ToolType::SemanticSearch]
} else {
vec![]
})
.collect(),
);
.set_tools(tools);

// truncate hidden messages
session.truncate_hidden_exchanges();
Expand Down Expand Up @@ -586,7 +547,6 @@ impl SessionService {
shell.to_owned(),
user_context.clone(),
running_in_editor,
reasoning,
mcts_log_directory.clone(),
tool_box.clone(),
tool_agent.clone(),
Expand All @@ -609,7 +569,6 @@ impl SessionService {
shell.to_owned(),
user_context.clone(),
running_in_editor,
reasoning,
mcts_log_directory,
tool_box,
tool_agent,
Expand All @@ -632,9 +591,6 @@ impl SessionService {
shell: String,
user_context: UserContext,
running_in_editor: bool,
// reasoning is passed so we can short circuit the loop early on when
// the agent has been going over context etc
_reasoning: bool,
mcts_log_directory: Option<String>,
tool_box: Arc<ToolBox>,
tool_agent: ToolUseAgent,
Expand Down Expand Up @@ -1214,13 +1170,12 @@ impl SessionService {
// Trim the content to handle any potential trailing whitespace
let trimmed_content = content.trim();

let session: Session = serde_json::from_str(trimmed_content)
.map_err(|e| {
SymbolError::IOError(std::io::Error::new(
std::io::ErrorKind::InvalidData,
format!("Error deserializing session: {}: {}", storage_path, e),
))
})?;
let session: Session = serde_json::from_str(trimmed_content).map_err(|e| {
SymbolError::IOError(std::io::Error::new(
std::io::ErrorKind::InvalidData,
format!("Error deserializing session: {}: {}", storage_path, e),
))
})?;

Ok(session)
}
Expand Down Expand Up @@ -1424,4 +1379,4 @@ pub enum TestGenerateCompletion {
LLMChoseToFinish(String),
/// Hit the maximum iteration limit (lower confidence)
HitIterationLimit(String),
}
}
24 changes: 18 additions & 6 deletions sidecar/src/bin/agent_bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ use llm_client::{
provider::{AnthropicAPIKey, LLMProvider, LLMProviderAPIKeys},
};
use sidecar::{
agentic::symbol::{
events::{input::SymbolEventRequestId, message_event::SymbolEventMessageProperties},
identifier::LLMProperties,
agentic::{
symbol::{
events::{input::SymbolEventRequestId, message_event::SymbolEventMessageProperties},
identifier::LLMProperties,
},
tool::r#type::ToolType,
},
application::{application::Application, config::configuration::Configuration},
repo::types::RepoRef,
Expand Down Expand Up @@ -188,6 +191,16 @@ Your thinking should be thorough and so it's fine if it's very long."#,
args.repo_name,
));

let tools = vec![
ToolType::ListFiles,
ToolType::SearchFileContentWithRegex,
ToolType::OpenFile,
ToolType::CodeEditing,
ToolType::AttemptCompletion,
ToolType::TerminalCommand,
ToolType::FindFiles,
];

// wait for the agent to finish over here while busy looping
println!("agent::tool_use::start");
let _ = session_service
Expand All @@ -202,18 +215,17 @@ Your thinking should be thorough and so it's fine if it's very long."#,
vec![],
RepoRef::local(&cloned_working_directory).expect("repo_ref to work"),
cloned_working_directory,
tools,
tool_box,
llm_broker,
UserContext::default(),
aide_rules,
false,
false,
false,
Some(args.log_directory.clone()),
Some(args.repo_name.clone()),
message_properties,
false, // not in devtools context
None, // No context crunching LLM for agent_bin
None, // No context crunching LLM for agent_bin
)
.await;
println!("agent::tool_use::end");
Expand Down
24 changes: 18 additions & 6 deletions sidecar/src/bin/agent_bin_reasoning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ use llm_client::{
provider::{AnthropicAPIKey, LLMProvider, LLMProviderAPIKeys},
};
use sidecar::{
agentic::symbol::{
events::{input::SymbolEventRequestId, message_event::SymbolEventMessageProperties},
identifier::LLMProperties,
agentic::{
symbol::{
events::{input::SymbolEventRequestId, message_event::SymbolEventMessageProperties},
identifier::LLMProperties,
},
tool::r#type::ToolType,
},
application::{application::Application, config::configuration::Configuration},
repo::types::RepoRef,
Expand Down Expand Up @@ -181,6 +184,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let tool_box = application.tool_box.clone();
let llm_broker = application.llm_broker.clone();

let tools = vec![
ToolType::ListFiles,
ToolType::SearchFileContentWithRegex,
ToolType::OpenFile,
ToolType::CodeEditing,
ToolType::AttemptCompletion,
ToolType::TerminalCommand,
ToolType::FindFiles,
];

// wait for the agent to finish over here while busy looping
println!("agent::tool_use::start");
let _ = session_service
Expand All @@ -195,20 +208,19 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
vec![],
RepoRef::local(&cloned_working_directory).expect("repo_ref to work"),
cloned_working_directory,
tools,
tool_box,
llm_broker,
UserContext::default(),
None,
true, // turn on reasoning
false,
false,
Some(args.log_directory.clone()),
Some(args.repo_name.clone()),
message_properties,
false, // not in devtools context
None, // No context crunching LLM for agent_bin_reasoning
)
.await;
println!("agent::tool_use::end");
Ok(())
}
}
25 changes: 19 additions & 6 deletions sidecar/src/bin/swe_bench_agent_bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ use llm_client::{
provider::{AnthropicAPIKey, LLMProvider, LLMProviderAPIKeys},
};
use sidecar::{
agentic::symbol::{
events::{input::SymbolEventRequestId, message_event::SymbolEventMessageProperties},
identifier::LLMProperties,
agentic::{
symbol::{
events::{input::SymbolEventRequestId, message_event::SymbolEventMessageProperties},
identifier::LLMProperties,
},
tool::r#type::ToolType,
},
application::{application::Application, config::configuration::Configuration},
repo::types::RepoRef,
Expand Down Expand Up @@ -189,6 +192,17 @@ Your thinking should be thorough and so it's fine if it's very long."#,
args.repo_name,
));

// the default tools which are present to the agent
let tools = vec![
ToolType::ListFiles,
ToolType::SearchFileContentWithRegex,
ToolType::OpenFile,
ToolType::CodeEditing,
ToolType::AttemptCompletion,
ToolType::TerminalCommand,
ToolType::FindFiles,
];

// wait for the agent to finish over here while busy looping
println!("agent::tool_use::start");
let _ = session_service
Expand All @@ -203,18 +217,17 @@ Your thinking should be thorough and so it's fine if it's very long."#,
vec![],
RepoRef::local(&cloned_working_directory).expect("repo_ref to work"),
cloned_working_directory,
tools,
tool_box,
llm_broker,
UserContext::default(),
aide_rules,
false,
false,
false,
Some(args.log_directory.clone()),
Some(args.repo_name.clone()),
message_properties,
false, // not in devtools context
None, // No context crunching LLM for agent_bin
None, // No context crunching LLM for agent_bin
)
.await;
println!("agent::tool_use::end");
Expand Down
38 changes: 36 additions & 2 deletions sidecar/src/webserver/agentic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1748,6 +1748,41 @@ pub async fn agent_tool_use(

let cloned_session_id = session_id.to_string();
let session_service = app.session_service.clone();

// the different tools the agent has access to
let tools = vec![
ToolType::ListFiles,
ToolType::SearchFileContentWithRegex,
ToolType::OpenFile,
ToolType::CodeEditing,
ToolType::AttemptCompletion,
ToolType::TerminalCommand,
ToolType::FindFiles,
]
.into_iter()
.chain(tool_box.mcp_tools().iter().cloned())
.chain(if is_devtools_context {
vec![ToolType::RequestScreenshot]
} else {
vec![]
})
.into_iter()
// editor specific tools over here
.chain(
// these tools are only availabe inside the editor
// they are not available on the agent-farm yet, which is true in this flow
vec![
ToolType::LSPDiagnostics,
// disable for testing
ToolType::AskFollowupQuestions,
],
)
.chain(if semantic_search {
vec![ToolType::SemanticSearch]
} else {
vec![]
})
.collect();
let _ = tokio::spawn({
let sender = sender.clone();
let session_id = session_id.clone();
Expand All @@ -1765,17 +1800,16 @@ pub async fn agent_tool_use(
project_labels,
repo_ref,
root_directory,
tools,
tool_box,
llm_broker,
user_context,
aide_rules,
reasoning,
true, // we are running inside the editor over here
semantic_search,
mcts_log_directory,
Some(repo_name),
message_properties,
is_devtools_context,
None, // No context crunching LLM for web requests
)
.await
Expand Down