feat: Added support for sub-agents to escalate user interaction requests from any depth to the parent agents for user interactions
This commit is contained in:
@@ -204,6 +204,7 @@ impl Agent {
|
||||
}
|
||||
|
||||
functions.append_teammate_functions();
|
||||
functions.append_user_interaction_functions();
|
||||
|
||||
agent_config.replace_tools_placeholder(&functions);
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ use crate::mcp::{
|
||||
MCP_SEARCH_META_FUNCTION_NAME_PREFIX, McpRegistry,
|
||||
};
|
||||
use crate::supervisor::Supervisor;
|
||||
use crate::supervisor::escalation::EscalationQueue;
|
||||
use crate::supervisor::mailbox::Inbox;
|
||||
use crate::vault::{GlobalVault, Vault, create_vault_password_file, interpolate_secrets};
|
||||
use anyhow::{Context, Result, anyhow, bail};
|
||||
@@ -220,6 +221,8 @@ pub struct Config {
|
||||
pub current_depth: usize,
|
||||
#[serde(skip)]
|
||||
pub inbox: Option<Arc<Inbox>>,
|
||||
#[serde(skip)]
|
||||
pub root_escalation_queue: Option<Arc<EscalationQueue>>,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@@ -298,6 +301,7 @@ impl Default for Config {
|
||||
self_agent_id: None,
|
||||
current_depth: 0,
|
||||
inbox: None,
|
||||
root_escalation_queue: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,21 @@ pub(in crate::config) const DEFAULT_SPAWN_INSTRUCTIONS: &str = indoc! {"
|
||||
# If dependents have --agent set, they auto-dispatch
|
||||
agent__task_complete --task_id task_1
|
||||
```
|
||||
|
||||
### Escalation Handling
|
||||
|
||||
Child agents may need user input but cannot prompt the user directly. When this happens,
|
||||
you will see `pending_escalations` in your tool results listing blocked children and their questions.
|
||||
|
||||
| Tool | Purpose |
|
||||
|------|----------|
|
||||
| `agent__reply_escalation` | Unblock a child agent by answering its escalated question. |
|
||||
|
||||
When you see a pending escalation:
|
||||
1. Read the child's question and options.
|
||||
2. If you can answer from context, call `agent__reply_escalation` with your answer.
|
||||
3. If you need the user's input, call the appropriate `user__*` tool yourself, then relay the answer via `agent__reply_escalation`.
|
||||
4. **Respond promptly**; the child agent is blocked and waiting (5-minute timeout).
|
||||
"};
|
||||
|
||||
pub(in crate::config) const DEFAULT_TEAMMATE_INSTRUCTIONS: &str = indoc! {"
|
||||
|
||||
Reference in New Issue
Block a user