LangChain tools for NodeRings, a hosting marketplace. An agent built with LangChain or
LangGraph can search Compute Instance (VPS) plans from independent providers, order a virtual machine, power it,
take snapshots, and manage hosted DNS and SSH keys. The tools are a thin, safe layer over the official
noderings Python SDK: read-only by default, with several
opt-ins and checks before anything is changed.
pip install langchain-noderingsFull guide: https://docs.noderings.com/docs/client-guides/langchain
Python 3.10 to 3.14. It installs noderings and langchain-core; add langchain (and a model provider package)
to build agents.
Create a service account in the NodeRings console (Organization → Access Control → Service accounts) and give it only the permissions the agent needs. Then set:
| 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=, base_url= to NodeRingsToolkit. Never commit tokens. The token is read
when a tool first runs, never at import time, and it never appears in tool output or error messages.
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}))Every tool returns compact JSON with stable keys. For example noderings_list_virtual_machines:
{"virtual_machines": [{"id": "…", "hostname": "web-1", "status": "started",
"provider": "…", "city": "Amsterdam", "country": "Netherlands", "plan_code": "…",
"vcpus": 2, "memory_mb": 4096, "ipv4": "203.0.113.10", "ipv6": "2001:db8::10",
"tags": ["agent-managed"], "created": "2026-11-29T10:00:00Z"}], "total": 1, "truncated": false}Lists are capped at max_list_items (default 50); "truncated": true says more exist. When no plan matches every
part of a search, NodeRings returns other plans instead; the tool marks those "matches_query": false and adds a
note (and a hint to try billing_type="subscription", since a search without a billing type covers hourly
plans only). Enum values are short
lower-case words (started, usage). Errors come back as a message starting with NodeRings error: that tells
the model what to do next.
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 (plan_id, region_id, price) → noderings_list_distros
(DISTRO_UBUNTU_24_04) → noderings_list_ssh_keys (or noderings_create_ssh_key with a public key) →
noderings_create_virtual_machine(..., wait=True) → the user connects with their own private key, usually
ssh root@<ipv4>. Passwords and private keys are never handled.
toolkit = NodeRingsToolkit(
mode="read_only", # "read_only" (default) or "read_write"
allow_destructive=False, # delete/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()- Read-only by default. Write tools are only returned with
mode="read_write". - Destructive tools need a second opt-in. Delete VM, reinstall VM, delete DNS record and delete SSH key
also need
allow_destructive=True. - Allowlist and denylist.
includeandexcludefilter by tool name. Unknown names, or anincludeof a tool the mode hides, raiseValueErrorwhen the toolkit is built. - Confirmation arguments. Every write tool has a required
confirmargument. Unless it istrue, the tool sends no request and tells the model to ask the user first. Delete and reinstall also needconfirm_hostnameequal to the VM's current hostname (the tool reads the VM first).noderings_create_virtual_machinereturns the plan's price with its result, and refuses aregion_idthat is not one of the plan's regions. - Tag scope. With
vm_tag_scope="agent-managed", power, tag, snapshot, reinstall and delete refuse VMs without that tag (and the tag cannot be removed), and new VMs always get it. - Dry run. With
dry_run=True, write tools validate input and run their read checks (hostname, tag scope, existing DNS records, plan price), then return{"dry_run": true, "would_call": "<METHOD> <path>", "body": {...}}instead of changing anything. - Framework approval. For any agent with write tools, also pause for a person before each change with LangChain's human-in-the-loop middleware and a checkpointer (see below).
- No secrets in or out. No tool accepts a password, a private key or raw cloud-init
user_data.noderings_create_ssh_keyrejects anything that looks like a private key without echoing it. Output never contains tokens, public key bodies or console URLs.
The SDK retries rate limits and transient errors, and VM creates carry an idempotency key, so a retry never
orders a second server. noderings_upsert_dns_record refuses to replace an existing record unless
allow_overwrite=true.
Read-only (examples/agent_readonly.py):
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?"}]})With write tools and human approval (examples/agent_hitl.py):
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)Async agents work the same way: every tool has a native async implementation on AsyncNodeRings.
The NodeRings API does not offer these, so the tools do not either:
- Block volumes, load balancers, and resizing or upgrading the plan of a running VM (a VM's tags are the only thing that can be updated).
- Custom image upload. The OS comes from the distro catalog, a saved cloud-init profile
(
cloud_init_user_data_id) or an Instant App. - Webhooks or event subscriptions. Waiting is done by polling (
wait=true).
Not exposed as tools in this version, although the API has them: snapshot restore and delete, backups, Instant
Apps, firewalls and DNS zone deletion. Use the noderings
SDK for those.
- LangChain guide: https://docs.noderings.com/docs/client-guides/langchain
- Usage guide: docs/noderings.md
- NodeRings docs: https://docs.noderings.com
- Python SDK: https://github.com/noderings/noderings-python
- Hosted MCP server:
https://mcp.noderings.com/mcp - API description: https://api.noderings.com/v1/openapi.json