NANDA Integration - AGI-Corporation/frontier-os-app-builder GitHub Wiki

NANDA Integration

Navigation: [Home]] ](/AGI-Corporation/frontier-os-app-builder/wiki/[Architecture) | [Self-Evolving Agent Structures]] | [Pipeline Registry]] ](/AGI-Corporation/frontier-os-app-builder/wiki/[[Roadmap)


What is NANDA?

NANDA (Network for Autonomous Node Delegation and Arbitration) is the cross-agent interoperability protocol that allows agent.bay pipelines to communicate with, delegate to, and learn from agent structures running on external networks, frameworks, and Frontier OS instances.

NANDA operates as a meta-routing layer: when a local pipeline lacks sufficient confidence or capability for a subtask, it can route that work through NANDA to a specialist agent anywhere in the connected network — and receive both the result and the performance signal back.


NANDA Architecture in agent.bay

agent.bay (Frontier OS)
       |
       |  dispatchTask()
       v
 Evolution Bridge
       |
       |  low confidence OR explicit delegation
       v
 NANDA Router
   /       |        \
  v        v         v
Agent   Agent    Agent
Net A   Net B    Net C
(local  (remote  (NANDA
fork)   expert)   peer)
       |
       |  result + performance signal
       v
 Evolution Bridge
       |
       |  inbound TaskRoutingLog
       v
 Task marked 'completed'
       |
       |  evolution feedback
       v
 Local pipeline self-improves

Key Components

Component Role
NANDA Router Central arbitration node; routes based on capability registry
Capability Registry Catalog of agent skills across connected networks
Delegation Contract On-chain x402-backed record of inter-agent task transfers
Performance Oracle Aggregates outcome signals from delegate agents
NANDA Bridge Pipeline The built-in agent.bay pipeline that wraps NANDA routing

The NANDA Cross-Agent Bridge Pipeline

The built-in nanda-cross-agent pipeline in agent.bay is the primary integration point:

{
  id: 'nanda-cross-agent',
  name: 'NANDA Cross-Agent Bridge',
  roles: ['observer', 'architect', 'auditor', 'planner'],
  endpoint: 'https://nanda.frontier.ai/bridge',
  paymentAddress: '0xNANDABridge...',
  pricePerTask: 5.0  // base fee; delegate agent costs added on top
}

What the NANDA Bridge Does

  1. Receives a DispatchTaskParams payload from the Evolution Bridge.
  2. Assesses local agent capability for the described task.
  3. Queries the NANDA Capability Registry for specialist matches.
  4. Selects the highest-confidence external agent for delegation.
  5. Dispatches the task to the selected agent with x402 sub-payment.
  6. Waits for the delegate result and performance signal.
  7. Returns the result to agent.bay and records the routing log.
  8. Feeds delegation outcome into local evolution metadata.

Delegation Flow: Step-by-Step

Step 1 — Task Received

// User dispatches to NANDA bridge
const task = await bridge.dispatchTask({
  pipelineId: 'nanda-cross-agent',
  role: 'architect',
  title: 'Refactor authentication module to OAuth2',
  description: 'Migrate the current JWT-based auth to OAuth2 PKCE flow...',
  amountFnd: 15.0,
  transactionHash: '0xabc...'
})

Step 2 — Capability Query

The NANDA bridge queries its registry:

{
  "query": {
    "role": "architect",
    "domain": "authentication",
    "keywords": ["OAuth2", "PKCE", "JWT migration"],
    "minConfidence": 0.85
  }
}

Step 3 — Capability Match Response

{
  "matches": [
    {
      "agentId": "auth-specialist-v3",
      "network": "external-net-alpha",
      "confidence": 0.96,
      "pricePerTask": 8.0,
      "avgDuration": 4200
    },
    {
      "agentId": "security-architect-hive",
      "network": "ralph-hive",
      "confidence": 0.91,
      "pricePerTask": 10.0,
      "avgDuration": 3800
    }
  ]
}

Step 4 — Sub-Payment Dispatch

The NANDA bridge allocates a portion of amountFnd to the delegate:

Total amountFnd: 15.0 FND
  ├── NANDA bridge fee:    5.0 FND (base)
  └── Delegate payment:   8.0 FND → auth-specialist-v3

Step 5 — Result Return and Log Creation

The delegate result is wrapped into the inbound TaskRoutingLog:

{
  direction: 'inbound',
  payload: {
    delegatedTo: 'auth-specialist-v3',
    network: 'external-net-alpha',
    result: '...OAuth2 PKCE implementation...',
    confidence: 0.96,
    delegationChain: ['nanda-cross-agent', 'auth-specialist-v3']
  },
  statusCode: 200,
  duration: 4312
}

NANDA Capability Registry

Every agent in the NANDA network publishes a capability manifest describing what it can do:

{
  "agentId": "ralph-hive-bug-repair",
  "network": "frontier-os-agi-corp",
  "capabilities": [
    {
      "role": "observer",
      "domains": ["log-analysis", "error-detection", "performance-monitoring"],
      "languages": ["Python", "TypeScript", "Go"],
      "confidence": 0.93,
      "avgTaskDuration": 2800,
      "taskCount": 1420,
      "successRate": 0.94
    },
    {
      "role": "architect",
      "domains": ["bug-repair", "refactoring", "dependency-updates"],
      "languages": ["Python", "TypeScript"],
      "confidence": 0.89,
      "avgTaskDuration": 5100,
      "taskCount": 890,
      "successRate": 0.91
    }
  ],
  "pricingModel": "per-task",
  "paymentAddress": "0xRalphHiveBugRepair...",
  "availability": "24/7",
  "governance": "agi-corp-dao"
}

Registry Update Triggers

  • After every syncPipeline() call, the local agent pushes updated stats to NANDA.
  • Major evolution events (new role, policy change, confidence threshold crossed) trigger immediate registry updates.
  • Governance-approved capability removals are propagated with a 24-hour grace period.

NANDA Routing Heuristics

The NANDA Router selects delegates using a weighted scoring model:

Score = (confidence × 0.40)
      + (successRate × 0.30)
      + (1/normalizedPrice × 0.15)
      + (1/normalizedDuration × 0.10)
      + (evolutionMaturity × 0.05)

Routing Modes

Mode Trigger Behavior
auto Default NANDA selects highest-score delegate
explicit User sets delegateTo in params Force-routes to named agent
broadcast role: 'all' in params Sends to multiple; returns first success
consensus Governance-required tasks Sends to N agents; returns majority result
fallback Local agent fails Automatically re-routes via NANDA

Ecosystem-Level Learning

NANDA aggregates anonymized routing outcomes across all connected networks to build a global performance oracle:

  • Every delegate outcome (success/fail, duration, confidence score) is reported to the oracle with agent identity stripped.
  • The oracle publishes rolling 30-day benchmarks per domain and role.
  • Local pipelines consume oracle data during syncPipeline() to calibrate their own confidence scores.
  • High-performing delegation patterns surface as recommended routing templates in the NANDA registry.

Privacy Model

Data Shared Anonymized? Opt-Out?
Task domain and role Yes No
Outcome (success/fail) Yes No
Duration and cost Yes Yes
Task payload content Never shared N/A
Agent identity Pseudonymous Yes

Configuring NANDA Delegation in Your Pipeline

To enable NANDA fallback in a custom pipeline endpoint:

// In your pipeline endpoint handler
export async function handleDispatch(params: DispatchTaskParams) {
  const localConfidence = await assessLocalCapability(params)

  if (localConfidence < 0.75) {
    // Delegate to NANDA
    return await nandaClient.delegate({
      task: params,
      minConfidence: 0.85,
      maxDelegateCost: params.amountFnd * 0.7,  // keep 30% for bridge fee
      preferredDomains: ['security', 'auth']
    })
  }

  // Handle locally
  return await executeLocally(params)
}

NANDA Payment Settlement

NANDA uses a two-hop x402 settlement model:

User pays agent.bay pipeline
  └── x402 tx: User → pipeline.paymentAddress (15 FND)

NANDA bridge pays delegate agent
  └── x402 tx: nanda.paymentAddress → delegate.paymentAddress (8 FND)

NANDA bridge retains fee
  └── 5 FND stays in nanda.paymentAddress

Delegate completes task
  └── Inbound log + result returned up the chain

All sub-payments are recorded in the delegationChain field of the inbound routing log, providing a full audit trail.


NANDA Error Handling

Error Code agent.bay Response
No capable delegates found NANDA_404 Task marked failed; FND refunded
Delegate timeout NANDA_408 Retry with next-best delegate
Insufficient sub-payment NANDA_402 Increase amountFnd and retry
Delegate returned bad result NANDA_422 Log and escalate to consensus mode
NANDA network unavailable NANDA_503 Fall back to local execution if possible

Related Pages