aws / aws/amazon-q-developer-cli
Feature Request: Add allowedAgents configuration to delegate tool
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
### Checks
- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again
### Operating system
macOS 15.7.1 (24G231)
### Expected behaviour
The delegate tool should support an allowedAgents configuration option in toolsSettings to restrict which agents can be launched, similar to how execute_bash has allowedCommands and use_aws has allowedServices. Likewise approved agents should be allowed to execute without requiring manual user approval if autoAllowTrusted: true.
Example configuration:
```yaml
toolsSettings:
delegate:
autoAllowTrusted: true
allowedAgents: ["quality", "developer"]
```
When configured:
- Only agents in the allowedAgents list can be launched
- Attempting to launch an unlisted agent should fail with a clear error message
- Empty list should allow no agents (explicit deny all)
- Omitting allowedAgents should maintain current behavior (allow all)
- Agents in the list should be allowed to execute without manual approval if autoAllowedTrusted: true.
### Actual behaviour
Currently, the delegate tool accepts any agent name without validation against an allowed list. This can lead to accidentally launching tasks to incorrect agents that lack the necessary tools/MCP servers to complete the task. Additionally there is no way to auto approve sub agents. This can be done by the same mechanism.
For example, a supervisor agent intended to only use quality and developer sub agents could accidentally launch tasks to q_cli_default agents, which would complete successfully but fail to retrieve the required data due to missing API access.
```
[chat-transcript]
Based on the documentation I reviewed, here are the suggestions to prevent launching tasks to the wrong agents:
**1. Restrict Available Agents in Configuration**
The supervisor agent configuration should explicitly list only the agents it's allowed to delegate to:
\```yaml
toolsSettings:
delegate:
autoAllowTrusted: true
allowedAgents: ["quality", "developer"] # Only these agents
\```
**2. Add Validation Logic in the Supervisor**
The supervisor agent should validate agent names before launching:
\```
1. Run `delegate list` to get available agents
2. Check if the required agents (quality, developer) exist
3. Only launch tasks to those specific agents
4. Fail fast if required agents are missing
\```
### Steps to reproduce
1. Create an agent with delegate tool enabled and autoAllowTrusted: true
2. Launch a task to any agent name (even non-existent or inappropriate ones)
3. The delegate tool accepts the request without validation
4. Task may fail or produce incorrect results if wrong agent is used
Example scenario:
- Supervisor agent should only delegate to quality and developer agents
- Accidentally delegates quality task to q_cli_default agent
- Task completes but reports no quality specific tasks completed
- No configuration option exists to prevent this mistake
### Environment
```yaml
```
Contributor guide
Assessment
This issue has not been assessed yet.