Documentation menu
Start here
IntroductionGetting startedWrite an agentProject anatomyUnderstand Ayjnt
Harness engineeringTwo runtimesHuman interfacesHow agents workHost bridgeAgent capabilities
Callable methodsState & SQLiteSessions & memorySchedulingWorkflowsDurable executionInter-agent RPCSub-agentsToolsWebAssembly modulesInterfaces & integrations
Browser clientRouting & middlewareVoiceBrowser toolsMCPEmailObservabilityCLI
Command overviewnewdevrunbuildcompilemigratedeployAPI reference
AgentAgentClientWorkflow classesLocal & cloudMigrationsExamplesSub-agents
Create co-located child agents with isolated storage and typed parent–child RPC.
Delegate durable responsibilities
Use native this.subAgent(ChildClass, name) when one root entity owns an open-ended set of children such as chats, documents, sessions, projects, or orchestration workers.
export class Orchestrator extends Agent {
async research(topics: string[]) {
return Promise.all(topics.map(async (topic, index) => {
const child = await this.subAgent(Researcher, `research-${index}`);
return child.search(topic);
}));
}
}
export class Researcher extends Agent {
async search(topic: string) {
return { topic, findings: [] };
}
}Lifecycle and access
- Export child classes from the worker entry so the runtime can discover them.
- Children have isolated SQLite but run as facets co-located with the parent.
- Use
parentAgent()for child-to-parent RPC. - Use
hasSubAgent()andlistSubAgents()for registry-backed access control. abortSubAgent()stops execution but preserves storage;deleteSubAgent()permanently removes it.