Skip to content
Open
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
4 changes: 2 additions & 2 deletions python/src/agent_squad/agents/supervisor_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class SupervisorAgent(Agent):

def __init__(self, options: SupervisorAgentOptions):
options.validate()
options.name = options.lead_agent.name
options.description = options.lead_agent.description
options.name = options.name or options.lead_agent.name
options.description = options.description or options.lead_agent.description
super().__init__(options)

self.lead_agent: 'Union[AnthropicAgent, BedrockLLMAgent]' = options.lead_agent
Expand Down
18 changes: 18 additions & 0 deletions python/src/tests/agents/test_supervisor_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,24 @@ async def test_supervisor_agent_initialization(mock_boto3_client):
assert agent.trace is None
assert isinstance(agent.supervisor_tools, AgentTools)

@pytest.mark.asyncio
async def test_supervisor_agent_preserves_custom_name_and_description(mock_boto3_client):
"""Custom name/description on SupervisorAgentOptions must not be overwritten by lead_agent values"""
lead_agent = MockBedrockLLMAgent(BedrockLLMAgentOptions(
name="Lead Agent Name",
description="Lead Agent Description"
))

agent = SupervisorAgent(SupervisorAgentOptions(
name="Custom Supervisor Name",
description="Custom Supervisor Description",
lead_agent=lead_agent,
team=[]
))

assert agent.name == "Custom Supervisor Name"
assert agent.description == "Custom Supervisor Description"

@pytest.mark.asyncio
async def test_supervisor_agent_validation(mock_boto3_client):
"""Test SupervisorAgent validation"""
Expand Down
4 changes: 2 additions & 2 deletions typescript/src/agents/supervisorAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export class SupervisorAgent extends Agent {

super({
...options,
name: options.leadAgent.name,
description: options.leadAgent.description,
name: options.name ?? options.leadAgent.name,
description: options.description ?? options.leadAgent.description,
});

this.leadAgent = options.leadAgent;
Expand Down