Blast-radius control 01 of 05
Stop handing agents an identity that carries the union of every permission any task might ever need. Instead, expose a task-scoped interface: a class or wrapper that only surfaces the methods the current job requires. The agent can't route around what it can't see. Here's an email drafting agent. It gets one thread, one draft method, and nothing else.
// Bad: the agent gets the full Gmail SDK.
// It can read all mail, delete threads, manage labels, send anything.
const agent = createAgent({ tools: [gmailMCPServer] })
// Good: a task-scoped wrapper. No send(). No delete(). No listAll().
class EmailDraftAgent {
constructor(private readonly threadId: string) {}
// One thread. Read only.
async readThread(): Promise<EmailThread> {
return gmail.threads.get({ id: this.threadId })
}
// One draft. In this thread. That's it.
async saveDraft(body: string): Promise<Draft> {
return gmail.drafts.create({ threadId: this.threadId, body })
}
}
// Build tool definitions from the scoped interface only.
const tools = buildTools(new EmailDraftAgent(threadId))
const agent = createAgent({ tools, systemPrompt })
Your agent should not inherit your access. It should inherit your intent.