<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Scott Smith (JNYCode)</title>
    <description>The latest articles on DEV Community by Scott Smith (JNYCode) (@jnycode).</description>
    <link>https://dev.to/jnycode</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2678954%2F1f785a09-1f10-4284-bb5f-30dc58816908.jpg</url>
      <title>DEV Community: Scott Smith (JNYCode)</title>
      <link>https://dev.to/jnycode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jnycode"/>
    <language>en</language>
    <item>
      <title>How to add trust boundaries to your multi-agent system</title>
      <dc:creator>Scott Smith (JNYCode)</dc:creator>
      <pubDate>Tue, 17 Feb 2026 03:34:18 +0000</pubDate>
      <link>https://dev.to/jnycode/how-to-add-trust-boundaries-to-your-multi-agent-system-gic</link>
      <guid>https://dev.to/jnycode/how-to-add-trust-boundaries-to-your-multi-agent-system-gic</guid>
      <description>&lt;p&gt;You have a personal AI assistant that can search the web, read documents, and send emails. It delegates research tasks to a cheaper sub-agent. How do you prevent that sub-agent from sending emails as you?&lt;/p&gt;

&lt;p&gt;If your answer involves prompt engineering or "it just wouldn't do that," this tutorial is for you.&lt;/p&gt;

&lt;p&gt;The problem&lt;br&gt;
Multi-agent frameworks like CrewAI, AutoGen, and LangGraph handle orchestration well. MCP handles tool access. But none of them answer the delegation trust question: when Agent A hands a task to Agent B, what limits B's authority?&lt;/p&gt;

&lt;p&gt;DelegateOS solves this with cryptographic delegation tokens. Let's build it step by step.&lt;/p&gt;

&lt;p&gt;Setup&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install delegateos
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {
  generateKeypair,
  createDCT,
  attenuateDCT,
  verifyDCT,
  createMCPPlugin,
  InMemoryRevocationList,
} from 'delegateos';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 1: Create identities&lt;br&gt;
Every participant gets an Ed25519 keypair. This is their identity in the delegation system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const you = generateKeypair();        // Root authority (you)
const assistant = generateKeypair();   // Your main AI assistant
const researcher = generateKeypair();  // Cheap research sub-agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2: Grant capabilities to your assistant&lt;br&gt;
You create a root Delegation Capability Token (DCT) for your assistant. This token defines exactly what it can do.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const assistantToken = createDCT({
  issuer: you,
  delegatee: assistant.principal,
  capabilities: [
    { namespace: 'web', action: 'search', resource: '*' },
    { namespace: 'docs', action: 'read', resource: '/home/me/**' },
    { namespace: 'email', action: 'send', resource: '*' },
  ],
  contractId: 'ct_daily_tasks',
  delegationId: 'del_001',
  parentDelegationId: 'root',
  chainDepth: 0,
  maxChainDepth: 2,
  maxBudgetMicrocents: 1_000_000, // $10
  expiresAt: new Date(Date.now() + 86400_000).toISOString(), // 24 hours
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your assistant can search the web, read your docs, and send emails. With a $10 budget and 24-hour expiry.&lt;/p&gt;

&lt;p&gt;Step 3: Delegate research with narrower scope&lt;br&gt;
Here's where it gets interesting. Your assistant delegates to a research sub-agent, but attenuates the token. The sub-agent gets strictly less authority.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const researchToken = attenuateDCT({
  token: assistantToken,
  attenuator: assistant,
  delegatee: researcher.principal,
  delegationId: 'del_002',
  contractId: 'ct_daily_tasks',
  allowedCapabilities: [
    { namespace: 'web', action: 'search', resource: '*.edu/**' },
  ],
  maxBudgetMicrocents: 50_000,    // $0.50
  expiresAt: new Date(Date.now() + 600_000).toISOString(), // 10 minutes
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The researcher can only search .edu domains. No docs access. No email. $0.50 budget. 10-minute window. These aren't suggestions. They're cryptographically enforced.&lt;/p&gt;

&lt;p&gt;Step 4: Verify at the point of use&lt;br&gt;
When the researcher tries to use a tool, verify the token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Allowed: web search on an .edu domain
const allowed = verifyDCT(researchToken, {
  resource: 'arxiv.org/search',
  namespace: 'web',
  operation: 'search',
  now: new Date().toISOString(),
  spentMicrocents: 0,
  rootPublicKey: you.principal.id,
  revocationIds: [],
});
console.log(allowed.ok); // true

// Denied: email was never delegated
const denied = verifyDCT(researchToken, {
  resource: 'boss@company.com',
  namespace: 'email',
  operation: 'send',
  now: new Date().toISOString(),
  spentMicrocents: 0,
  rootPublicKey: you.principal.id,
  revocationIds: [],
});
console.log(denied.ok); // false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 5: Add MCP middleware&lt;br&gt;
If you're using MCP, DelegateOS drops in as middleware:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const plugin = createMCPPlugin({
  toolCapabilities: {
    web_search: { namespace: 'web', action: 'search' },
    read_file: {
      namespace: 'docs',
      action: 'read',
      resourceExtractor: (args) =&amp;gt; args.path as string,
    },
    send_email: { namespace: 'email', action: 'send' },
  },
  trustedRoots: [you.principal.id],
  revocations: new InMemoryRevocationList(),
  budgetTracker: { getSpent: () =&amp;gt; 0, recordSpend: () =&amp;gt; {} },
});

// Every tools/call request gets checked against the caller's DCT
const result = await plugin.handleRequest(mcpRequest);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The plugin also filters tools/list responses. The researcher would only see web_search in its available tools. read_file and send_email don't exist from its perspective.&lt;/p&gt;

&lt;p&gt;Step 6: Revoke if needed&lt;br&gt;
Something going wrong? Revoke the delegation instantly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const revocationList = new InMemoryRevocationList();
revocationList.revoke('del_002'); // Single delegation
// or
revocationList.revokeCascade('del_001'); // Revoke assistant + all downstream
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All subsequent verification checks will reject the revoked tokens.&lt;/p&gt;

&lt;p&gt;What you get&lt;br&gt;
Sub-agents with cryptographically scoped authority&lt;br&gt;
Budget enforcement across delegation chains&lt;br&gt;
Time-limited delegations with automatic expiry&lt;br&gt;
Mid-flight revocation&lt;br&gt;
MCP integration with zero changes to your existing tools&lt;br&gt;
The full source, docs, and a PR review demo are at &lt;a href="https://github.com/newtro/delegateos" rel="noopener noreferrer"&gt;github.com/newtro/delegateos&lt;/a&gt;. MIT licensed, 374 tests passing.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>ai</category>
      <category>security</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
