LangChain
Give a LangChain or LangGraph agent NodeRings tools: search the marketplace, order and manage virtual machines, DNS records and SSH keys. Read-only by default, with human approval for every change.
langchain-noderings adds NodeRings tools to LangChain and LangGraph agents in Python. With them, an agent can search the marketplace, compare virtual machine plans from independent providers, order a virtual machine, start and stop it, take snapshots, and manage DNS records and SSH keys.
The tools are read-only by default. Tools that change something must be turned on, and with LangChain's human-in-the-loop middleware each change waits for a person's approval.
pip install langchain-noderingsIt supports Python 3.10 to 3.14 and installs noderings and langchain-core. Add langchain and a model provider package to build agents. The package is built on the official Python SDK. Source and examples: langchain-noderings on GitHub.
Authentication
Create a service account under Organization → Access Control → Service accounts, give it only the permissions the agent needs, and set its token:
| Variable | Required | Purpose |
|---|---|---|
NODERINGS_TOKEN | yes | The service-account token. |
NODERINGS_ORGANIZATION_ID | no | Act in another organization the account belongs to. |
NODERINGS_BASE_URL | no | Another API endpoint. Default https://api.noderings.com. |
Or pass token=, organization_id= and base_url= to NodeRingsToolkit. The token is read when a tool first runs, never at import time, and it never appears in tool output or error messages. Never commit tokens.
Quick start
from langchain_noderings import NodeRingsToolkit
toolkit = NodeRingsToolkit() # read-only tools
tools = toolkit.get_tools()
search = next(t for t in tools if t.name == "noderings_search_plans")
print(search.invoke({"query": "2 vcpu 4 GB in Amsterdam", "limit": 3}))A read-only agent:
from langchain.agents import create_agent
from langchain_noderings import NodeRingsToolkit
agent = create_agent(model="provider:model-name", tools=NodeRingsToolkit().get_tools())
agent.invoke({"messages": [{"role": "user", "content": "Which of my servers are stopped?"}]})Every tool returns compact JSON with stable keys. Lists are capped at max_list_items (default 50), and "truncated": true says more exist. Errors come back as a message starting with NodeRings error: that tells the model what to do next. Every tool also has a native async implementation, so async agents work the same way.
Tools
R = read, W = write (needs mode="read_write"), D = destructive (also needs allow_destructive=True).
| Tool | Kind | What it does |
|---|---|---|
noderings_search_plans | R | Search VM plans with a short query such as "2 vcpu 4 GB in Amsterdam". |
noderings_get_plan | R | One plan: specs, prices, rating and its regions. |
noderings_list_locations | R | Cities and countries where VM plans are sold. |
noderings_compare_providers | R | Providers selling one plan code in one city, with prices and IPv6/capacity. |
noderings_list_distros | R | Operating systems a new VM can run. |
noderings_list_ssh_keys | R | Saved SSH public keys (id, name, type, fingerprint). |
noderings_list_virtual_machines | R | VMs with status, location, IPs and tags; filter by status or tag. |
noderings_get_virtual_machine | R | One VM in detail. |
noderings_list_snapshots | R | Snapshots of one VM. |
noderings_list_dns_zones | R | Hosted DNS zones with nameservers and delegation state. |
noderings_list_dns_records | R | Records in a zone, optionally by name and type. |
noderings_get_account | R | Which organization the token acts for. |
noderings_create_ssh_key | W | Save an SSH public key. |
noderings_create_virtual_machine | W | Order a VM (spends money); optionally wait for its IPs. |
noderings_power_virtual_machine | W | Start, stop or restart a VM. |
noderings_tag_virtual_machine | W | Add or remove VM tags. |
noderings_create_snapshot | W | Snapshot a VM's disk. |
noderings_create_dns_zone | W | Create an empty zone for an apex domain. |
noderings_upsert_dns_record | W | Create an A, AAAA, CNAME, MX or TXT record; replace only with allow_overwrite. |
noderings_reinstall_virtual_machine | D | Reinstall a VM's OS, erasing its disk. |
noderings_delete_virtual_machine | D | Delete a VM with its snapshots and backups. |
noderings_delete_dns_record | D | Delete the records with one name and type. |
noderings_delete_ssh_key | D | Remove a saved SSH key. |
How an agent orders a server
noderings_search_plans returns plan_id, region_id and the listed price to tell the user.
noderings_list_distros returns a distro value, for example DISTRO_UBUNTU_24_04.
noderings_list_ssh_keys returns key ids. Or noderings_create_ssh_key saves the user's public key.
noderings_create_virtual_machine runs with confirm=true once the user agreed. With wait=true it waits up to 15 minutes for the VM to start and returns its IP addresses.
The user connects with their own private key, usually ssh root@<ipv4>.
Passwords and private keys are never handled. The SDK retries rate limits and transient errors, and VM creates carry an idempotency key, so a retry never orders a second server.
Safety
toolkit = NodeRingsToolkit(
mode="read_only", # "read_only" (default) or "read_write"
allow_destructive=False, # delete and reinstall tools also need this
include=None, # only these tool names
exclude=None, # never these tool names
vm_tag_scope=None, # e.g. "agent-managed"
dry_run=False, # describe write calls instead of making them
max_list_items=50,
)
toolkit.write_tool_names() # for HumanInTheLoopMiddleware
toolkit.destructive_tool_names()| Layer | What it does |
|---|---|
| Read-only by default | Write tools are only returned with mode="read_write". |
| Destructive opt-in | Delete VM, reinstall VM, delete DNS record and delete SSH key also need allow_destructive=True. |
include / exclude | Filter tools by name. Unknown names, or an include of a tool the mode hides, raise ValueError when the toolkit is built. |
confirm | Every write tool sends no request unless confirm is true, and tells the model to ask the user first. |
confirm_hostname | Delete and reinstall read the VM first and refuse unless confirm_hostname equals its current hostname. |
vm_tag_scope | Power, tag, snapshot, reinstall and delete refuse VMs without the tag, the tag cannot be removed, and new VMs always get it. |
dry_run | Write tools validate input and run their read checks, then return {"dry_run": true, "would_call": "<METHOD> <path>", "body": {...}}. |
| Human approval | Pause before each change with LangChain's human-in-the-loop middleware and a checkpointer (below). |
| No secrets | No password, private key or raw cloud-init user_data inputs. Outputs never contain tokens, public key bodies or console URLs. |
noderings_create_virtual_machine returns the plan's price with its result and refuses a region_id that is not one of the plan's regions. noderings_upsert_dns_record refuses to replace an existing record unless allow_overwrite=true.
Give the service account only the permissions the agent needs. The token's permissions are the last line of defence.
Human approval
from langchain.agents import create_agent
from langchain.agents.middleware import HumanInTheLoopMiddleware
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.types import Command
from langchain_noderings import NodeRingsToolkit
toolkit = NodeRingsToolkit(mode="read_write", vm_tag_scope="agent-managed")
agent = create_agent(
model="provider:model-name", # any tool-calling chat model you have configured
tools=toolkit.get_tools(),
system_prompt=(
"You manage NodeRings servers. Quote prices only from noderings_search_plans. "
"Ask before any action that costs money or changes resources."
),
middleware=[
HumanInTheLoopMiddleware(
interrupt_on={name: {"allowed_decisions": ["approve", "reject"]} for name in toolkit.write_tool_names()},
)
],
checkpointer=InMemorySaver(),
)
config = {"configurable": {"thread_id": "demo-1"}}
result = agent.invoke(
{"messages": [{"role": "user", "content": "Find the cheapest 2 vCPU server in Amsterdam and order it as web-1 with my 'laptop' SSH key."}]},
config,
)
# result["__interrupt__"] holds the pending noderings_create_virtual_machine call. Show it to the user, then:
agent.invoke(Command(resume={"decisions": [{"type": "approve"}]}), config)MCP instead of code
The hosted MCP server at https://mcp.noderings.com/mcp signs in as a NodeRings user through OAuth and exposes a fixed tool set. This package instead uses a service-account token and adds the safety options above.
Not supported
- Block volumes, load balancers, and resizing a running virtual machine. The API only changes tags on an existing VM.
- Custom image upload. The operating system comes from the distro catalogue, a saved cloud-init profile or an Instant App.
- Webhooks or event streams. Waiting is polling.
- Snapshot restore and delete, backups, Instant Apps, firewalls and DNS zone deletion are in the API but not exposed as tools in this version. Use the Python SDK for those.
Vercel AI SDK
Give an AI SDK agent NodeRings tools: search the marketplace, order and manage virtual machines, DNS records and SSH keys. Read-only by default, with tool approval for every change.
Backstage
Show NodeRings servers on Backstage entity pages and create servers and DNS records from Software Templates. The token stays in the Backstage backend.
