LLM Runtime
Applies to SDK 0.16+ · Last updated: 2026-06-12
AgentNodeRuntime connects any OpenAI, Anthropic, or Gemini agent to AgentNode with zero configuration. It registers 5 meta-tools, injects a system prompt, and runs the tool loop automatically. The LLM discovers, installs, and runs capabilities on its own.
Quick start
terminal
$ pip install agentnode-sdkOpenAI
openai_agent.pypython
from openai import OpenAI
from agentnode_sdk import AgentNodeRuntime
runtime = AgentNodeRuntime()
client = OpenAI()
result = runtime.run(
provider="openai",
client=client,
model="gpt-4o",
messages=[{"role": "user", "content": "Count the words in 'Hello world'"}],
)
print(result.content)Anthropic
anthropic_agent.pypython
from anthropic import Anthropic
from agentnode_sdk import AgentNodeRuntime
runtime = AgentNodeRuntime()
client = Anthropic()
result = runtime.run(
provider="anthropic",
client=client,
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Search for PDF tools on AgentNode"}],
)Gemini
gemini_agent.pypython
from google import genai
from agentnode_sdk import AgentNodeRuntime
runtime = AgentNodeRuntime()
client = genai.Client()
result = runtime.run(
provider="gemini",
client=client,
model="gemini-2.5-flash",
messages=[{"role": "user", "content": "What AgentNode tools are available?"}],
)OpenRouter / any OpenAI-compatible provider
Use Mistral, DeepSeek, Qwen, Llama, and more via OpenRouter or any OpenAI-compatible endpoint:
openrouter_agent.pypython
from openai import OpenAI
from agentnode_sdk import AgentNodeRuntime
runtime = AgentNodeRuntime()
client = OpenAI(
api_key="sk-or-...",
base_url="https://openrouter.ai/api/v1",
)
result = runtime.run(
provider="openai",
client=client,
model="mistralai/mistral-large",
messages=[{"role": "user", "content": "Find and install a PDF reader tool"}],
)Manual tool calling
For any provider that supports tool calling, get tool definitions and dispatch calls manually with handle():
manual.pypython
runtime = AgentNodeRuntime()
# Get tool definitions in your provider's format
tools = runtime.as_openai_tools() # OpenAI function-calling format
tools = runtime.as_anthropic_tools() # Anthropic format
tools = runtime.as_gemini_tools() # Gemini format
tools = runtime.as_generic_tools() # Generic / baseline format
# When the LLM makes a tool call, dispatch it:
result = runtime.handle("agentnode_search", {"query": "pdf extraction"})
# → {"success": true, "result": {"total": 5, "results": [...]}}Constructor
init.pypython
AgentNodeRuntime(
client=None, # Optional AgentNodeClient
api_key=None, # Optional API key
minimum_trust_level="verified", # "verified" | "trusted" | "curated"
)5 meta-tools
These tools are automatically registered when you create a Runtime. The LLM calls them as needed during the tool loop.
| Tool | Description |
|---|---|
| agentnode_capabilities | List installed packages (local, no API call) |
| agentnode_search | Search the registry (max 5 results) |
| agentnode_install | Install a package by slug |
| agentnode_run | Execute an installed tool |
| agentnode_acquire | Search + install in one step |
API reference
| Method | Description |
|---|---|
| tool_specs() | Internal typed tool definitions (list[ToolSpec]) |
| as_openai_tools() | Tools in OpenAI function-calling format |
| as_anthropic_tools() | Tools in Anthropic format |
| as_gemini_tools() | Tools in Google Gemini format |
| as_generic_tools() | Tools in generic/baseline format |
| system_prompt() | AgentNode system prompt block (append to yours) |
| tool_bundle() | Combined {"tools": [...], "system_prompt": "..."} |
| handle(name, args) | Dispatch a tool call. Returns dict. Never throws. |
| run(provider, client, ...) | Auto-loop with tool dispatch. Never throws. |
run() parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| provider | str | — | "openai", "anthropic", or "gemini" |
| client | Any | — | Provider SDK client instance |
| messages | list[dict] | — | Conversation messages |
| model | str | "" | Model name (e.g. "gpt-4o") |
| max_tool_rounds | int | 8 | Max tool call rounds before stopping |
| inject_system_prompt | bool | True | Append AgentNode prompt to system message |
Trust levels
minimum_trust_level controls which packages can be installed and run through the Runtime. Higher levels are stricter:
| Level | Accepts |
|---|---|
| "verified" | verified, trusted, curated |
| "trusted" | trusted, curated |
| "curated" | curated only |
Three surfaces
| CLI | For humans — search, install, publish |
| SDK / Client | For programmatic access — search, resolve, install, run |
| Runtime | For LLM agents — tool registration, dispatch, auto-loop |