Skip to main content

🤖 langchain-nwo

The only robotics API that lets AI agents control physical robots.

PyPI version Python 3.10+ License: MIT LangChain

langchain-nwo is the official LangChain integration for the NWO Robotics API — bridging the gap between LLM agents and physical robots. Drop it into any LangChain or LangGraph agent and let the agent control real hardware.


🔗 Resources

Resource Link
NWO Robotics API https://nwo.capital/webapp/nwo-robotics.html
Cardiac Identity https://nwo.capital/webapp/nwo-cardiac.html
MCP Server https://github.com/RedCiprianPater/mcp-server-robotics
Cardiac SDK https://github.com/RedCiprianPater/nwo-cardiac-sdk
Live Demo https://huggingface.co/spaces/PUBLICAE/nwo-robotics-api-demo
OpenAPI Spec https://nwo.capital/openapi.yaml
Whitepaper https://www.researchgate.net/publication/401902987
Get an API Key https://nwo.capital/webapp/api-key.php

📦 Installation

pip install langchain-nwo

With LangGraph (recommended for agents):

pip install "langchain-nwo[langgraph]"

⚡ Quick Start

LangGraph Agent

from langchain_nwo import NWOToolkit
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent

# Connect the toolkit to your robot
toolkit = NWOToolkit(api_key="sk_live_...")

# Create an embodied AI agent
agent = create_react_agent(
    model=ChatOpenAI(model="gpt-4o"),
    tools=toolkit.get_tools(),
)

# Agent controls a physical robot!
result = agent.invoke({
    "messages": [{
        "role": "user",
        "content": "Pick up the red box and place it on the table"
    }]
})

Classic LangChain Agent

from langchain_nwo import NWOToolkit
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate

toolkit = NWOToolkit(api_key="sk_live_...")
tools = toolkit.get_tools()

prompt = ChatPromptTemplate.from_messages([
    ("system", "You are an embodied robot agent. Use your tools to control physical robots."),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])

agent = create_tool_calling_agent(ChatOpenAI(model="gpt-4o"), tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)

executor.invoke({"input": "Navigate to the kitchen and bring me a water bottle"})

Individual Tools

from langchain_nwo import NWOInferenceTool, NWOQueryStateTool
from langchain_nwo.client import NWOClient

client = NWOClient(api_key="sk_live_...")

# Query robot state
state_tool = NWOQueryStateTool(client=client)
state = state_tool.invoke({"agent_id": "robot_001"})

# Run VLA inference
inference_tool = NWOInferenceTool(client=client)
actions = inference_tool.invoke({
    "instruction": "Pick up the red box",
    "images": ["<base64_image>"],
    "model_id": "xiaomi-robotics-0",
})

🛠️ Available Tools

All 19 tools are included by default. Use tool_names to select a subset.

Tool Description
nwo_inference VLA inference — standard, model router, or edge (<30ms)
nwo_models List and inspect available VLA models
nwo_query_state Get robot joint angles, gripper state, position, battery
nwo_execute_actions Send action arrays directly to a robot
nwo_sensor_fusion Multi-modal inference (camera + lidar + thermal + GPS + force)
nwo_status_poll Poll task progress and completion status
nwo_task_planner Decompose complex instructions into ordered subtasks
nwo_execute_subtask Execute one step of a multi-step plan
nwo_learning Get technique recommendations or log execution outcomes
nwo_discovery Health, capabilities, dry-run validation, plan generation
nwo_ros2 ROS2 bridge — list, status, command, emergency stop
nwo_simulation Trajectory simulation, collision check, MoveIt2 planning
nwo_embodiment Robot specs, URDF, benchmarks, auto-calibration
nwo_online_rl Online RL sessions, telemetry, and fine-tuning jobs
nwo_tactile ORCA hand — taxel reading, grip quality, slip detection
nwo_agent_management Register agents, check quota, upgrade tier
nwo_cardiac_oracle ECG validation and cardiac hash computation
nwo_cardiac_relayer On-chain identity on Base mainnet (rootTokenId)
nwo_dataset Unitree G1 dataset hub (1.54M+ demonstrations)

Tool Subsets

# Minimal: just inference + state + control
tools = NWOToolkit.core_tools(api_key="sk_live_...")

# Multi-step planning focus
tools = NWOToolkit.planning_tools(api_key="sk_live_...")

# Physical ROS2 robots
tools = NWOToolkit.physical_robot_tools(api_key="sk_live_...")

# Custom selection
toolkit = NWOToolkit(
    api_key="sk_live_...",
    tool_names=["nwo_inference", "nwo_ros2", "nwo_status_poll"],
)
tools = toolkit.get_tools()

🤖 7-Step Autonomous Workflow

The NWO API is designed around a 7-step loop that agents can execute autonomously:

from langchain_nwo import NWOToolkit
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent

toolkit = NWOToolkit(api_key="sk_live_...")
agent = create_react_agent(
    model=ChatOpenAI(model="gpt-4o"),
    tools=toolkit.get_tools(),
    state_modifier=(
        "You are an autonomous robot agent. Follow this workflow:\n"
        "1. DISCOVER — check capabilities with nwo_discovery(action='capabilities')\n"
        "2. INSPECT  — get robot state with nwo_query_state\n"
        "3. VALIDATE — dry-run the task with nwo_discovery(action='dry_run')\n"
        "4. PLAN     — generate steps with nwo_discovery(action='plan')\n"
        "5. EXECUTE  — run inference with nwo_inference\n"
        "6. MONITOR  — poll status with nwo_status_poll\n"
        "7. LEARN    — log outcome with nwo_learning(action='log')\n"
        "Handle errors gracefully. For SAFETY_VIOLATION, always stop immediately."
    ),
)

🫀 Cardiac Identity (On-Chain Agent ID)

Agents can register on Base mainnet for a verifiable digital identity:

import hashlib
from langchain_nwo import NWOCardiacRelayerTool
from langchain_nwo.client import NWOClient

client = NWOClient(
    api_key="sk_live_...",
    relayer_secret="your-relayer-secret",
)

tool = NWOCardiacRelayerTool(client=client)

# Hash your API key
api_key_hash = "0x" + hashlib.sha256(b"sk_live_your_key").hexdigest()

# Register on Base mainnet (gasless)
result = tool.invoke({
    "action": "register_agent",
    "moonpay_wallet": "0x...your_wallet...",
    "api_key_hash": api_key_hash,
})
# → {"rootTokenId": "42", "txHash": "0x..."}

# Issue task authorization credential
result = tool.invoke({
    "action": "issue_credential",
    "root_token_id": "42",
    "credential_type": "0x...keccak256('task_auth')...",
    "credential_hash": "0x...keccak256(task_id)...",
    "expires_at": 1704067200,
})

🔌 API Endpoints Covered

Group Endpoints
Inference & Models /api-robotics.php?action=inference, list_models, get_model_info, edge API
Robot Control execute, query_state, sensor_fusion, robot_query, status_poll
Task Planning task_planner, execute_subtask, learning
Discovery health, whoami, capabilities, dry-run, plan
Agent Mgmt /api-agent-register.php, /api-agent-balance.php, /api-agent-pay.php
ROS2 Bridge nwo-ros2-bridge.onrender.com — list, status, command, action, e-stop
Simulation simulate_trajectory, check_collision, estimate_torques, plan_motion
Embodiment list, detail, normalization, urdf, test_results, compare
Calibration run_calibration, calibrate
Online RL start_online_rl, submit_telemetry
Fine-Tuning create_dataset, start_job
Tactile /api-orca.php, /api-tactile.php — get_tactile, process, slip_detection
Dataset Hub /api-unitree-datasets.php
Cosmos /api-cosmos.php?action=generate_scene
Cardiac Oracle /oracle/validate, hashECG, verify
Cardiac Relayer registerAgent, issueCredential, hasValidCredential, grantAccess, /access/check, /payment/process

🛡️ Safety

All tools respect NWO's built-in safety constraints:

  • Force limit: 50 N
  • Torque limit: 10 Nm
  • Speed limit: 1.5 m/s
  • Human proximity minimum: 0.5 m
  • Emergency stop response: <10 ms
  • SAFETY_VIOLATION errors are never retried

📊 Quota Tiers

Tier Calls/Month Cost
Free 100,000 Free
Prototype 500,000 ~0.015 ETH/month
Production Unlimited ~0.062 ETH/month

Get an API key: https://nwo.capital/webapp/api-key.php


🏗️ Development

git clone https://github.com/RedCiprianPater/langchain-nwo
cd langchain-nwo
pip install -e ".[dev]"
pytest

📄 License

MIT — see LICENSE


🔗 Related Projects

Metadata

Release files for langchain-nwo 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-nwo 0.1.0
File Size Uploaded
langchain_nwo-0.1.0.tar.gz 30.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-nwo 0.1.0
File Interpreter ABI Platform
langchain_nwo-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 56.4 kB

Release files / langchain_nwo-0.1.0.tar.gz

Download URL langchain_nwo-0.1.0.tar.gz
Size 30.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4541f41d6c160735ce0525c863445359bb7a7fbde0ecc81c40c6aef8780ef3f0
BLAKE2b-256 checksum
How to use checksums
3405cc94e8caf3e1e04511b8c802b6df78aba6fc78e347f39c27ae574deffc92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / langchain_nwo-0.1.0-py3-none-any.whl

Download URL langchain_nwo-0.1.0-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d33e717646c06a1b9e587f8573e14bc0eecdb9bd4b1dc6b66c311df6ae652438
BLAKE2b-256 checksum
How to use checksums
5b00ef625f990ff53639856ffa4cf2a6117172e2f471ea6e23f0d0cc869b05db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page