feat(core): transition sub-agents to XML format and improve definitions (#18555)

This commit is contained in:
N. Taylor Mullen
2026-02-08 18:25:04 -08:00
committed by GitHub
parent 375c104b32
commit cb73fbf384
10 changed files with 638 additions and 116 deletions
-33
View File
@@ -481,37 +481,4 @@ export class AgentRegistry {
getDiscoveredDefinition(name: string): AgentDefinition | undefined {
return this.allDefinitions.get(name);
}
/**
* Generates a markdown "Phone Book" of available agents and their schemas.
* This MUST be injected into the System Prompt of the parent agent.
*/
getDirectoryContext(): string {
if (this.agents.size === 0) {
return 'No sub-agents are currently available.';
}
let context = '## Available Sub-Agents\n';
context += `Sub-agents are specialized expert agents that you can use to assist you in
the completion of all or part of a task.
Each sub-agent is available as a tool of the same name.
You MUST always delegate tasks to the sub-agent with the
relevant expertise, if one is available.
The following tools can be used to start sub-agents:\n\n`;
for (const [name] of this.agents) {
context += `- ${name}\n`;
}
context += `Remember that the closest relevant sub-agent should still be used even if its expertise is broader than the given task.
For example:
- A license-agent -> Should be used for a range of tasks, including reading, validating, and updating licenses and headers.
- A test-fixing-agent -> Should be used both for fixing tests as well as investigating test failures.`;
return context;
}
}