fix: wrap generate_agent call in try/except for consistency

Add exception handler for AgentGeneratorNotConfiguredError in generate_agent
call for defensive consistency, even though decompose_goal would typically
catch it first.

Addresses CodeRabbit review suggestion.
This commit is contained in:
Zamil Majdy
2026-01-21 18:48:39 -05:00
parent 0ca73004e5
commit da9c4a4adf

View File

@@ -168,7 +168,17 @@ class CreateAgentTool(BaseTool):
)
# Step 2: Generate agent JSON (external service handles fixing and validation)
agent_json = await generate_agent(decomposition_result)
try:
agent_json = await generate_agent(decomposition_result)
except AgentGeneratorNotConfiguredError:
return ErrorResponse(
message=(
"Agent generation is not available. "
"The Agent Generator service is not configured."
),
error="service_not_configured",
session_id=session_id,
)
if agent_json is None:
return ErrorResponse(