Lesson 7: Blueprint to OpenShell Flow

This lesson provides a comprehensive deep dive into the journey from a Blueprint YAML file to a fully running, secured AI agent. We'll explore the onboarding process, SHA-256 verification, resource creation, and agent startup sequence.

1. Blueprint Structure

1.1 What is a Blueprint?

A Blueprint is a versioned YAML package that defines everything needed to create and run a sandboxed AI agent. It bundles the sandbox image specification, security policies, inference configuration, and supporting assets into a single, immutable artifact.

The key principle behind blueprints is supply chain safety: all artifacts are immutable, versioned, and digest-verified before execution. This ensures reproducible deployments and prevents tampering.

Blueprint Package Structure

graph TB subgraph "Blueprint Package" A[Blueprint YAML] B[Sandbox Image Spec] C[Security Policy] D[Inference Profile] E[Supporting Assets] end A --> B A --> C A --> D A --> E F[SHA-256 Digest] -.->|Verifies| A style A fill:#0066ff,stroke:#333,stroke-width:2px style F fill:#ff9900,stroke:#333,stroke-width:2px

1.2 Complete YAML Schema

The blueprint YAML follows a structured schema with these key sections:

# Blueprint YAML Schema (Annotated)
apiVersion: nemoclaw/v1
kind: Blueprint
metadata:
  name: my-agent-blueprint           # Unique identifier
  version: 1.2.0                     # Semantic version
  description: "Production agent"    # Human-readable description
  digest: sha256:abc123...           # Cryptographic hash of contents

spec:
  # Agent selection - which agent framework to use
  agent:
    type: openclaw                   # openclaw | hermes | langchain-deepagents-code
    version: "2.1.0"                 # Agent framework version

  # Container image specification
  sandbox:
    image: ghcr.io/nvidia/nemoclaw-sandbox:latest
    pullPolicy: IfNotPresent
    resources:
      limits:
        memory: "8Gi"
        cpu: "4"
      requests:
        memory: "4Gi"
        cpu: "2"

  # Inference provider configuration
  inference:
    provider: build                  # build | openrouter | openai | anthropic | etc.
    model: nemotron-4-340b-instruct  # Model identifier
    endpoint: inference.local        # Routed through gateway
    parameters:
      temperature: 0.7
      max_tokens: 4096

  # Network security policy
  network:
    tier: balanced                   # balanced | restricted | open
    endpoints:
      - host: "api.github.com"
        port: 443
        protocol: rest
        methods: [GET, POST]
        paths: ["/repos/**", "/users/**"]
      - host: "*.pypi.org"
        port: 443
        protocol: none              # L4 only - no inspection

  # Filesystem layout (locked at creation)
  filesystem:
    writable:
      - /sandbox                     # Agent working directory
      - /tmp                         # Temporary files
    readonly:
      - /usr                         # System binaries
      - /lib                         # Shared libraries
      - /app                         # Application code

  # Process security (locked at creation)
  process:
    user: sandbox
    capabilities_drop:
      - cap_sys_admin
      - cap_sys_ptrace
      - cap_net_raw

  # Web search configuration (optional)
  webSearch:
    provider: brave                  # brave | tavily | none

  # Messaging channels (optional)
  messaging:
    channels:
      - type: slack
        allowedUsers: ["U12345"]
      - type: telegram
        allowedIds: ["123456789"]

1.3 Blueprint Field Reference

Field Purpose Mutable at Runtime?
spec.agent Agent framework type and version No - requires rebuild
spec.sandbox Container image specification No - requires rebuild
spec.inference Provider and model configuration Yes - hot-reloadable
spec.network Egress filtering rules Yes - hot-reloadable
spec.filesystem Landlock path restrictions No - locked at creation
spec.process Capabilities and syscall filters No - locked at creation

1.4 Example Blueprints Comparison

Different agent frameworks have different default configurations:

Feature OpenClaw DeepAgents
Agent Type openclaw langchain-deepagents-code
Default Model Nemotron / Claude Claude / GPT-4
Network Tier Balanced Balanced
Web Search Optional (Brave/Tavily) Built-in tool support
Primary Use Case General-purpose coding LangChain/LangGraph workflows

Source: NemoClaw How It Works Documentation

2. The Onboarding Flow

2.1 What Happens When You Run nemoclaw onboard

The nemoclaw onboard command initiates a multi-step orchestration process that transforms a blueprint into a running, secured agent environment. This process involves resolution, verification, resource creation, and startup.

Onboarding Process Flow

flowchart TD A[nemoclaw onboard] --> B{Preflight Checks} B -->|Pass| C[Blueprint Resolution] B -->|Fail| X[Error: Missing Dependencies] C --> D[Version Compatibility Check] D --> E[SHA-256 Digest Verification] E -->|Valid| F[Resource Determination] E -->|Invalid| Y[Error: Tampered Blueprint] F --> G[Gateway Setup] G --> H[Provider Registration] H --> I[Sandbox Image Build] I --> J[Policy Activation] J --> K[Readiness Verification] K --> L[Agent Startup] L --> M[Ready Summary] style E fill:#ff9900,stroke:#333,stroke-width:2px style I fill:#0066ff,stroke:#333,stroke-width:2px style L fill:#00aa00,stroke:#333,stroke-width:2px

2.2 Step-by-Step CLI Commands

The onboarding wizard guides you through each step:

Command Purpose
nemoclaw onboard Start interactive onboarding wizard
nemoclaw onboard --resume Resume an interrupted onboarding session
nemoclaw onboard --fresh Discard existing state and start fresh
nemoclaw <sandbox> status Check sandbox state after onboarding
nemoclaw <sandbox> connect Connect to sandbox terminal
nemoclaw <sandbox> logs --follow Stream sandbox logs

2.3 Detailed Onboarding Process Flow

The complete onboarding process consists of 13 discrete steps:

Step 1:  Preflight checks (Docker, platform, GPU, memory, disk)
           |
Step 2:  Start/reuse OpenShell gateway
           |
Step 3:  Select inference provider and model
           |
Step 4:  Collect credentials (via secure helper)
           |
Step 5:  Enter sandbox name
           |
Step 6:  Review configuration summary
           |
Step 7:  Register provider with OpenShell
           |
Step 8:  Prompt for web search (Brave/Tavily)
           |
Step 9:  Prompt for messaging channels (Telegram/Discord/Slack)
           |
Step 10: Build sandbox image (5-15 minutes typical)
           |
Step 11: Apply network policy tier (Balanced/Restricted/Open)
           |
Step 12: Verify readiness (gateway, dashboard, inference.local route)
           |
Step 13: Display ready summary with dashboard URL

2.4 Non-Interactive Onboarding

For CI/CD pipelines or automated deployments, use environment variables:

# Non-interactive onboarding example
curl -fsSL https://www.nvidia.com/nemoclaw.sh | \
  NEMOCLAW_NON_INTERACTIVE=1 \
  NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 \
  NEMOCLAW_AGENT=openclaw \
  NEMOCLAW_PROVIDER=build \
  NVIDIA_INFERENCE_API_KEY=nvapi-xxxxx \
  NEMOCLAW_SANDBOX_NAME=my-agent \
  bash

Source: NemoClaw Quickstart Guide

3. SHA-256 Verification

3.1 How Digest Verification Works

Every blueprint includes a SHA-256 cryptographic hash that ensures integrity. Before any resources are created, NemoClaw verifies that the blueprint contents match the expected digest.

Digest Verification Sequence

sequenceDiagram participant CLI as NemoClaw CLI participant Resolver as Blueprint Resolver participant Registry as Blueprint Registry participant Verifier as Digest Verifier participant Runner as Blueprint Runner CLI->>Resolver: nemoclaw onboard --blueprint my-agent Resolver->>Registry: Fetch blueprint package Registry-->>Resolver: Blueprint + Manifest Resolver->>Verifier: Verify digest Verifier->>Verifier: Compute SHA-256 of contents alt Digest Matches Verifier-->>Resolver: Verification passed Resolver->>Runner: Execute blueprint Runner-->>CLI: Begin resource creation else Digest Mismatch Verifier-->>Resolver: VERIFICATION FAILED Resolver-->>CLI: Error: Blueprint tampered Note over CLI: Process halts - no resources created end

3.2 Why Immutability Matters

Blueprint immutability provides critical security guarantees:

# Blueprint manifest with digest
metadata:
  name: production-agent
  version: 2.1.0
  digest: sha256:1a42bbe8dbc9003cb79d4e641b53760571aacd85293671aee97c09c0746fef33

3.3 What Happens If Verification Fails

When digest verification fails, NemoClaw takes these protective actions:

  1. Immediate Halt - No resources are created or modified
  2. Error Report - Clear message indicating tampering detected
  3. Audit Log - Failed verification attempt is logged
  4. No Fallback - Unlike some systems, there is no "proceed anyway" option
# Example verification failure
$ nemoclaw onboard --blueprint compromised-agent

ERROR: Blueprint verification failed
  Expected digest: sha256:1a42bbe8dbc9003cb79d4...
  Computed digest: sha256:9f8e7d6c5b4a3219087f...

The blueprint has been modified since it was signed.
This could indicate:
  - Corruption during download
  - Unauthorized modification
  - Man-in-the-middle attack

No resources have been created. Please verify the blueprint source.

3.4 Secure Credential Helper Verification

Even the credential helper scripts are digest-verified:

Helper: scripts/local-credential-helper.mts
  SHA-256: 1a42bbe8dbc9003cb79d4e641b53760571aacd85293671aee97c09c0746fef33

Form: docs/resources/local-credential-form.html
  SHA-256: 5512a256e0ad7c63a26ab82cf4f5924e98652097172ab8a5dc9d9358dd4f6ae8

Source: NemoClaw How It Works Documentation

4. Resource Creation

After blueprint verification passes, the runner determines which OpenShell resources to create or update. This involves four key components: Gateway, Provider, Sandbox, and Policy.

4.1 Gateway Setup

The OpenShell Gateway is the central orchestration component that owns sandbox lifecycle, networking, policy enforcement, and inference routing.

OpenShell Gateway Architecture

graph TB subgraph "OpenShell Gateway" A[Lifecycle Manager] B[Network Proxy] C[Policy Engine] D[Inference Router] end E[Sandbox 1] --> B F[Sandbox 2] --> B G[Sandbox N] --> B B --> C C -->|Allow| H[External APIs] C -->|Route| D D --> I[inference.local] I --> J[Managed LLM Provider] style B fill:#0066ff,stroke:#333,stroke-width:2px style C fill:#ff9900,stroke:#333,stroke-width:2px

Gateway Responsibilities:

# Gateway is started/reused during onboarding
# Check gateway status
openshell gateway status

# Gateway serves all sandboxes on the host
openshell gateway list-sandboxes

4.2 Provider Configuration

During onboarding, NemoClaw validates and registers the selected inference provider:

Provider NEMOCLAW_PROVIDER Value Credential Variable
NVIDIA Endpoints build NVIDIA_INFERENCE_API_KEY
OpenRouter openrouter OPENROUTER_API_KEY
OpenAI openai OPENAI_API_KEY
Anthropic anthropic ANTHROPIC_API_KEY
Google Gemini gemini GEMINI_API_KEY
Local Ollama ollama None required
Custom Compatible custom COMPATIBLE_API_KEY

The provider configuration process:

  1. Validate credentials via test API call
  2. Register provider route with OpenShell gateway
  3. Bake matching model reference into sandbox image
  4. Configure inference.local routing

4.3 Sandbox Provisioning

The sandbox image is built with all security configurations baked in:

# Sandbox build process (5-15 minutes typical)
# 1. Pull base image
# 2. Install agent framework
# 3. Configure inference endpoint
# 4. Apply filesystem layout
# 5. Set process constraints
# 6. Remove dangerous tools (gcc, make, netcat)
# 7. Lock PATH

# Resulting sandbox has:
#   - Writable: /sandbox, /tmp
#   - Read-only: /usr, /lib, /app, /etc
#   - Landlock LSM enforcement
#   - Dropped capabilities
#   - Seccomp-BPF filtering

Filesystem protections are locked at sandbox creation and cannot be modified at runtime:

4.4 Policy Activation

Network policies are applied during onboarding but can be modified at runtime:

# Three network policy tiers available
Balanced   - Common dev presets (npm, PyPI, Hugging Face, Homebrew) + web search
Restricted - Minimal network access
Open       - Broader access (not recommended for production)

Policy configuration is hot-reloadable:

# View current policy
openshell policy get my-sandbox

# Update policy at runtime
openshell policy set my-sandbox --tier restricted

# Add specific endpoint
openshell policy add my-sandbox --host api.example.com --port 443

Source: NemoClaw Quickstart Guide

5. Agent Startup

5.1 How the Agent is Installed

The agent framework is installed into the sandbox image during the build phase. The specific installation depends on the agent type:

Agent Type Installation Method Entry Point
OpenClaw Pre-built in base image /app/openclaw/main.py
Hermes Pre-built in base image /app/hermes/agent.py
LangChain DeepAgents pip install during build /app/deepagents/run.py

5.2 Initial Configuration

When the sandbox container starts, the following initialization sequence occurs:

Agent Initialization Sequence

sequenceDiagram participant Container as Sandbox Container participant Entrypoint as Entrypoint Script participant Security as Security Layer participant Agent as AI Agent participant Gateway as OpenShell Gateway Container->>Entrypoint: Container starts Entrypoint->>Security: Enter namespaces (pid, net, mnt, user) Security->>Security: Drop capabilities (15+) Security->>Security: Apply Landlock filesystem rules Security->>Security: Enable seccomp-BPF filtering Security->>Security: Set no_new_privs flag Security->>Agent: Launch agent process as 'sandbox' user Agent->>Agent: Load blueprint configuration Agent->>Agent: Register NemoClaw plugin Agent->>Gateway: Register with gateway Gateway-->>Agent: Confirm registration Agent->>Gateway: Test inference.local route Gateway->>Gateway: Route to managed provider Gateway-->>Agent: Inference OK Agent-->>Container: Ready for interaction

5.3 First Run Behavior

On first run, the NemoClaw plugin performs these registration steps:

  1. Managed Provider Metadata - Registers available inference providers and models
  2. Slash Command Registration - Enables /nemoclaw commands in the agent
  3. Runtime Context Hooks - Injects system guidance as context
  4. Gateway Communication - Establishes connection via inference.local
# After startup, verify agent is ready
nemoclaw my-sandbox status

# Expected output:
Sandbox: my-sandbox
Status: Ready
Model: claude-sonnet-4-20250514
Provider: anthropic-managed
Gateway: Connected
Dashboard: http://127.0.0.1:18789/sandbox/my-sandbox

# Connect to agent terminal
nemoclaw my-sandbox connect

5.4 Protection Layers Applied at Startup

Layer Lock Timing Behavior
Network Hot-reloadable Blocks unauthorized outbound connections
Filesystem Sandbox creation Enforces read-only system paths via Landlock
Process Sandbox creation Blocks privilege escalation via capabilities/seccomp
Inference Hot-reloadable Routes all LLM calls through controlled backends

5.5 Inference Routing via inference.local

All agent requests to LLM providers are routed through the gateway's inference.local endpoint:

# Inside sandbox, agent makes request to:
https://inference.local/v1/chat/completions

# Gateway intercepts and:
# 1. Validates request against inference policy
# 2. Injects managed credentials
# 3. Routes to actual provider (Anthropic, OpenAI, etc.)
# 4. Returns response to agent

This provides:

Source: NemoClaw How It Works Documentation

6. Complete Flow Diagram

Here's the end-to-end journey from blueprint to running agent:

Complete Blueprint to Agent Flow

flowchart TB subgraph "Phase 1: Resolution" A[Blueprint YAML] --> B[Resolve Reference] B --> C[Check Version Compatibility] C --> D{SHA-256 Verify} D -->|Pass| E[Blueprint Validated] D -->|Fail| X[Abort: Tampered] end subgraph "Phase 2: Resource Creation" E --> F[Start/Reuse Gateway] F --> G[Register Provider] G --> H[Build Sandbox Image] H --> I[Apply Landlock Rules] I --> J[Configure Network Policy] end subgraph "Phase 3: Agent Startup" J --> K[Start Container] K --> L[Enter Namespaces] L --> M[Drop Capabilities] M --> N[Enable Seccomp] N --> O[Launch Agent] O --> P[Register with Gateway] P --> Q[Agent Ready] end subgraph "Runtime" Q --> R[Process User Requests] R --> S{Egress Request?} S -->|Yes| T[Gateway Policy Check] T -->|Allow| U[Forward to Target] T -->|Deny| V[Block + Log] S -->|No| R end style D fill:#ff9900,stroke:#333,stroke-width:2px style H fill:#0066ff,stroke:#333,stroke-width:2px style Q fill:#00aa00,stroke:#333,stroke-width:2px

7. Environment Variables Reference

Key environment variables for configuring the onboarding process:

Variable Purpose Example Values
NEMOCLAW_AGENT Agent framework selection openclaw, hermes, langchain-deepagents-code
NEMOCLAW_PROVIDER Inference provider build, openai, anthropic, ollama
NEMOCLAW_SANDBOX_NAME Name for the sandbox my-agent, prod-claw
NEMOCLAW_NON_INTERACTIVE Skip interactive prompts 1
NEMOCLAW_WEB_SEARCH_PROVIDER Web search backend brave, tavily, none

Quiz: Test Your Understanding

Question 1

What is the primary purpose of SHA-256 digest verification in the blueprint flow?

Show Answer

SHA-256 digest verification ensures supply chain security by cryptographically verifying that the blueprint has not been tampered with since it was signed. This prevents man-in-the-middle attacks, ensures reproducible deployments, and provides auditability. If verification fails, no resources are created - there is no "proceed anyway" option.

Question 2

Which blueprint fields can be modified at runtime, and which require sandbox re-creation?

Show Answer

Runtime modifiable (hot-reloadable): Network policies and Inference routing configuration.

Require sandbox re-creation: Agent type/version, Sandbox image specification, Filesystem layout (Landlock rules), and Process constraints (capabilities, seccomp filters).

Question 3

What happens during the 13-step onboarding process between "Build sandbox image" and "Agent Ready"?

Show Answer

After building the sandbox image (step 10), the process: Step 11 - Applies network policy tier (Balanced/Restricted/Open). Step 12 - Verifies readiness (gateway connection, dashboard accessibility, inference.local route). Step 13 - Displays the ready summary with dashboard URL. Then during container startup, security layers are applied in order: namespace entry, capability dropping, Landlock application, and seccomp enablement before the agent launches.

Question 4

How does the OpenShell Gateway handle inference requests from the agent?

Show Answer

The agent sends requests to inference.local, which the gateway intercepts. The gateway then: (1) validates the request against the inference policy, (2) injects managed credentials that the agent never sees, (3) routes to the actual provider (Anthropic, OpenAI, etc.), and (4) returns the response. This provides credential isolation, model enforcement, usage tracking, and the ability to switch providers without modifying the agent.

Question 5

What are the four key resources created during the resource creation phase, and what is each one's primary responsibility?

Show Answer

Gateway: Central orchestration - owns sandbox lifecycle, networking, policy enforcement, and inference routing.

Provider: Inference configuration - validates credentials, registers routes, and configures model access.

Sandbox: Isolated container - runs the agent with all security constraints (Landlock, capabilities, seccomp).

Policy: Network rules - defines allowed egress endpoints, methods, and paths with support for hot-reloading.


References