Skip to content

Get Optimal Agent

GET
/api/agents/optimal/{task_description}

Determine the optimal agent for a specific task using intelligent routing.

Analyzes task description and matches it with agent capabilities, specializations, and current load to recommend the best agent for execution.

Path Parameters: task_description: Natural language description of the task requirements

Returns: AgentOptimalResponse with recommended agent, confidence, and alternatives

Raises: HTTPException 503: If communication hub is not available HTTPException 500: For unexpected errors during agent selection

task_description
required
Task Description
string

Successful Response

AgentOptimalResponse

Optimal agent recommendation response model.

Provides the best agent recommendation for a given task along with confidence score, reasoning, and alternative options. Generated by boot coordinator’s agent selection algorithm based on capabilities matching and current load.

Fields: recommended_agent: ID of the optimal agent for the task confidence_score: Confidence in recommendation (0.0-1.0) reasoning: Explanation for why this agent was selected alternatives: List of alternative agents with their scores

Used By: - GET /api/agents/optimal endpoint - boot coordinator agent selection algorithm - Task routing decision making - Agent recommendation UI

object
recommendedAgent
required
Recommendedagent
string
confidenceScore
required
Confidencescore
number
reasoning
required
Reasoning
string
alternatives
required
Alternatives
Array<object>
AgentAlternativeInfo

Alternative agent recommendation information.

Provides details about alternative agents that could handle a task with their confidence scores and reasoning for agent selection.

Fields: agent_id: Alternative agent identifier confidence_score: Confidence in this alternative (0.0-1.0) reasoning: Explanation for why this agent is an alternative capabilities: List of relevant capabilities current_load: Current workload of alternative agent

Used By: - AgentOptimalResponse.alternatives - Agent selection UI - Load balancing decisions

object
agentId
required
Agentid

Alternative agent ID

string
confidenceScore
required
Confidencescore

Confidence score (0.0-1.0)

number
<= 1
reasoning
Any of:
string
capabilities
Any of:
Array<string>
currentLoad
Any of:
number
<= 1

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object