Subagents
Some work is best handled off to the side. A large task may split into independent pieces that can run in parallel; a sensitive operation may deserve its own tightly scoped toolset; a noisy investigation may be better kept out of the main conversation so it doesn’t crowd the context. Subagents address all three. A subagent is a separate agent instance that Amara can delegate to — with its own system prompt, its own tools, and its own permissions — that reports a result back to the parent when it finishes.
Because a subagent runs with a fresh context, it keeps its intermediate exploration to itself and returns only the conclusion. The parent agent stays focused on the overall goal instead of accumulating every file the subagent read along the way.
Defining and delegating
Declare subagents in the options with a name, description, prompt, and the tools they may use. Amara delegates to them by name when the description matches the work at hand.
import { query } from "@syntic/agent-sdk";
for await (const msg of query({
prompt: "Audit the auth module and propose fixes.",
options: {
subagents: {
reviewer: {
description: "Reviews code for security issues. Read-only.",
prompt: "You are a security reviewer. Report findings, don't edit.",
tools: ["read_file", "grep"],
},
},
},
})) {
if (msg.type === "result") console.log(msg.result);
}from syntic_agent_sdk import query
async for msg in query(
prompt="Audit the auth module and propose fixes.",
options={
"subagents": {
"reviewer": {
"description": "Reviews code for security issues. Read-only.",
"prompt": "You are a security reviewer. Report findings, don't edit.",
"tools": ["read_file", "grep"],
}
}
},
):
if msg.type == "result":
print(msg.result)When to delegate
Delegate when a subtask is self-contained and its result is what matters, not the steps. Parallelize independent pieces of work by giving each its own subagent so they run concurrently instead of serially. Use scoped toolsets and permissions to enforce boundaries — a read-only reviewer that cannot write files is safer than trusting the main agent to stay in its lane. Keep subagent prompts specific so the delegate knows exactly what to return. For work that is a single quick lookup you already know how to do, skip delegation; the overhead only pays off when the subtask is substantial or genuinely parallel.