MCPcopy Create free account
hub / github.com/AI45Lab/Code / score_agent_for_prompt

Function score_agent_for_prompt

core/src/agent/auto_delegation.rs:144–165  ·  view source on GitHub ↗
(
    agent: &AgentDefinition,
    prompt: &str,
    explicit_target: Option<&str>,
)

Source from the content-addressed store, hash-verified

142}
143
144fn score_agent_for_prompt(
145 agent: &AgentDefinition,
146 prompt: &str,
147 explicit_target: Option<&str>,
148) -> Option<AutoDelegationTask> {
149 let lower_prompt = prompt.to_lowercase();
150 let lower_description = agent.description.to_lowercase();
151 let confidence = builtin_confidence(&agent.name, &lower_prompt)
152 .max(explicit_agent_confidence(
153 &agent.name,
154 &lower_prompt,
155 explicit_target,
156 ))
157 .max(description_confidence(&lower_description, &lower_prompt));
158
159 (confidence > 0.0).then(|| AutoDelegationTask {
160 agent: agent.name.clone(),
161 description: auto_description(agent, prompt),
162 prompt: auto_prompt(agent, prompt),
163 confidence,
164 })
165}
166
167fn explicit_agent_target(prompt: &str, registry: &AgentRegistry) -> Option<String> {
168 let lower = prompt.to_lowercase();

Calls 6

builtin_confidenceFunction · 0.85
description_confidenceFunction · 0.85
auto_descriptionFunction · 0.85
auto_promptFunction · 0.85
cloneMethod · 0.45