History

agent: More subagent wordsmithing (#49804)

Now that this is also used for resuming, I think this is clearer what the input is. Release Notes: - N/A

Ben Brandt committed 8 months ago

Commit 76c878d1 parent c22eaa72 files · +8 −8Browse files

Unified · Split

2 files
  1. crates/agent/src/tests/mod.rs +4 −4
  2. crates/agent/src/tools/spawn_agent_tool.rs +4 −4
crates/agent/src/tests/mod.rs+4−4
@@ -4232,7 +4232,7 @@ async fn test_subagent_tool_call_end_to_end(cx: &mut TestAppContext) { · 4231 unmodified lines
4232 model.send_last_completion_stream_text_chunk("spawning subagent");4232 model.send_last_completion_stream_text_chunk("spawning subagent");
4233 let subagent_tool_input = SpawnAgentToolInput {4233 let subagent_tool_input = SpawnAgentToolInput {
4234 label: "label".to_string(),4234 label: "label".to_string(),
4235 task: "subagent task prompt".to_string(),4235 message: "subagent task prompt".to_string(),
4236 session_id: None,4236 session_id: None,
4237 timeout_secs: None,4237 timeout_secs: None,
4238 };4238 };
@@ -4383,7 +4383,7 @@ async fn test_subagent_tool_call_cancellation_during_task_prompt(cx: &mut TestAp · 144 unmodified lines
4383 model.send_last_completion_stream_text_chunk("spawning subagent");4383 model.send_last_completion_stream_text_chunk("spawning subagent");
4384 let subagent_tool_input = SpawnAgentToolInput {4384 let subagent_tool_input = SpawnAgentToolInput {
4385 label: "label".to_string(),4385 label: "label".to_string(),
4386 task: "subagent task prompt".to_string(),4386 message: "subagent task prompt".to_string(),
4387 session_id: None,4387 session_id: None,
4388 timeout_secs: None,4388 timeout_secs: None,
4389 };4389 };
@@ -4521,7 +4521,7 @@ async fn test_subagent_tool_resume_session(cx: &mut TestAppContext) { · 131 unmodified lines
4521 model.send_last_completion_stream_text_chunk("spawning subagent");4521 model.send_last_completion_stream_text_chunk("spawning subagent");
4522 let subagent_tool_input = SpawnAgentToolInput {4522 let subagent_tool_input = SpawnAgentToolInput {
4523 label: "initial task".to_string(),4523 label: "initial task".to_string(),
4524 task: "do the first task".to_string(),4524 message: "do the first task".to_string(),
4525 session_id: None,4525 session_id: None,
4526 timeout_secs: None,4526 timeout_secs: None,
4527 };4527 };
@@ -4583,7 +4583,7 @@ async fn test_subagent_tool_resume_session(cx: &mut TestAppContext) { · 55 unmodified lines
4583 model.send_last_completion_stream_text_chunk("resuming subagent");4583 model.send_last_completion_stream_text_chunk("resuming subagent");
4584 let resume_tool_input = SpawnAgentToolInput {4584 let resume_tool_input = SpawnAgentToolInput {
4585 label: "follow-up task".to_string(),4585 label: "follow-up task".to_string(),
4586 task: "do the follow-up task".to_string(),4586 message: "do the follow-up task".to_string(),
4587 session_id: Some(subagent_session_id.clone()),4587 session_id: Some(subagent_session_id.clone()),
4588 timeout_secs: None,4588 timeout_secs: None,
4589 };4589 };
crates/agent/src/tools/spawn_agent_tool.rs+4−4
@@ -33,8 +33,8 @@ pub struct SpawnAgentToolInput { · 32 unmodified lines
33 /// Short label displayed in the UI while the agent runs (e.g., "Researching alternatives")33 /// Short label displayed in the UI while the agent runs (e.g., "Researching alternatives")
34 pub label: String,34 pub label: String,
35 /// Describe the task for the agent to perform. Be specific about what you want accomplished. Include all necessary context (file paths, requirements, constraints) since the agent cannot see your conversation.35 /// Describe the task for the agent to perform. Be specific about what you want accomplished. Include all necessary context (file paths, requirements, constraints) since the agent cannot see your conversation.
36 pub task: String,36 pub message: String,
37 /// Optional session ID of an existing agent session to continue a conversation with. When provided, the task is sent as a follow-up message to that session instead of creating a new one. Use this to ask clarifying questions, request changes based on previous output, or retry after errors.37 /// Optional session ID of an existing agent session to continue a conversation with. When provided, the message is sent as a follow-up to that session instead of creating a new one. Use this to ask clarifying questions, request changes based on previous output, or retry after errors.
38 #[serde(default)]38 #[serde(default)]
39 pub session_id: Option<acp::SessionId>,39 pub session_id: Option<acp::SessionId>,
40 /// Optional maximum runtime in seconds. The purpose of this timeout is to prevent the agent from getting stuck in infinite loops, NOT to estimate task duration. Be generous if setting. If not set, the agent runs until it completes or is cancelled.40 /// Optional maximum runtime in seconds. The purpose of this timeout is to prevent the agent from getting stuck in infinite loops, NOT to estimate task duration. Be generous if setting. If not set, the agent runs until it completes or is cancelled.
@@ -117,7 +117,7 @@ impl AgentTool for SpawnAgentTool { · 76 unmodified lines
117 self.environment.resume_subagent(117 self.environment.resume_subagent(
118 parent_thread_entity,118 parent_thread_entity,
119 session_id,119 session_id,
120 input.task,120 input.message,
121 input.timeout_secs.map(Duration::from_secs),121 input.timeout_secs.map(Duration::from_secs),
122 cx,122 cx,
123 )123 )
@@ -125,7 +125,7 @@ impl AgentTool for SpawnAgentTool { · 1 unmodified line
125 self.environment.create_subagent(125 self.environment.create_subagent(
126 parent_thread_entity,126 parent_thread_entity,
127 input.label,127 input.label,
128 input.task,128 input.message,
129 input.timeout_secs.map(Duration::from_secs),129 input.timeout_secs.map(Duration::from_secs),
130 cx,130 cx,
131 )131 )

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t