Input to matching

User request text + list of agents, each with skills that have id, name, description, tags, examples.

Advertisement

Simple keyword match

Bag-of-words. Fast, deterministic. Misses semantic similarity but works for narrow skills with distinctive keywords.

Advertisement

Embedding-based match

float[] userEmbedding = embed(userRequest);
for (Agent a : agents) {
  for (Skill s : a.skills()) {
    float[] skillEmbedding = embed(s.description() + " " + s.examples().join(" "));
    scores.put(a, cosine(userEmbedding, skillEmbedding));
  }
}
return agents.stream().max(scoreComparator);