# For AI Agents

Source: https://runvero.dev/docs/agents/
Documentation index: https://runvero.dev/llms.txt

RunVero executes agent tools with resource and access limits. Start with [the documentation index](https://runvero.dev/llms.txt); every documentation page has a Markdown version at its URL followed by `/index.md` (for example, `/docs/agents/index.md`). The [REST OpenAPI reference](https://runvero.dev/openapi.json) describes tool discovery and structured execution. MCP clients discover tool schemas directly through `tools/list`.

## Choose your environment

- **RunVero Cloud:** use the API URL and data-plane API key from your authorized workspace at [app.runvero.dev](https://app.runvero.dev). Cloud remains in private preview; access and limits may change. The console's demo mode only shows sample data.
- **Self-hosted:** follow the [Quick Start](https://runvero.dev/docs/quickstart) and [self-hosting guide](https://runvero.dev/docs/self-hosting). Repository access is required until public releases are available. Your operator supplies the gateway URL and credentials. Cloud quota and idempotency behavior do not automatically apply to self-hosted gateways.

A console sign-in token is not a data-plane API key. Ask the workspace owner for access if needed. Store credentials in your client's secret store or environment, outside shared prompts and committed files.

## Connect an MCP client

In the console, run a guided Playground task and choose **Use this in my agent**. This creates a test key scoped to that tool and supplies setup instructions for your client. Use the endpoint shown there (normally `https://api.runvero.dev/v1/mcp`), Streamable HTTP transport, and `Authorization: Bearer <your API key>`.

After initialization, call `tools/list` to discover permitted tools and their `inputSchema`, then use `tools/call` with the selected name and arguments. Ask the agent to repeat the task from the console and inspect the real result. Connection verification uses the new key's first call.

## Discover and execute over HTTP

Set `RUNVERO_API_URL` to your workspace's API origin and `RUNVERO_API_KEY` to its test key. This example uses Python 3's standard library; no RunVero package installation is needed. It discovers the current tool schema before calculating an invoice total with SQLite.

```python
import json
import os
import uuid
import urllib.error
import urllib.request

base = os.environ["RUNVERO_API_URL"].rstrip("/")
headers = {"Authorization": "Bearer " + os.environ["RUNVERO_API_KEY"]}
request = urllib.request.Request(base + "/v1/tools", headers=headers)
with urllib.request.urlopen(request, timeout=30) as response:
    tools = json.load(response)["tools"]

tool = next((t for t in tools if t["name"] == "sqlite-runner"), None)
if tool is None:
    raise SystemExit("sqlite-runner is unavailable to this key; ask the owner.")
print("Input schema:", json.dumps(tool["input_schema"]))

payload = {
    "tool": tool["name"],
    "arguments": {
        "query": "SELECT 3 * 1200 + 2 * 450 AS total_cents"
    },
    "fuel": 10_000_000,
    "memory_mb": 64,
    "timeout_ms": 5000,
    "allowed_hosts": [],
}
# Save this key and the exact payload if you need to retry this logical run.
idempotency_key = str(uuid.uuid4())
request = urllib.request.Request(
    base + "/v1/execute",
    data=json.dumps(payload).encode(),
    headers={**headers, "Content-Type": "application/json",
             "Idempotency-Key": idempotency_key},
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=30) as response:
        result = json.load(response)
    print(result["output"])  # JSON-encoded table: total_cents = 4500
    print("Fuel:", result["fuel_consumed"])
except urllib.error.HTTPError as error:
    print("HTTP", error.code, error.read().decode())
    raise
```

Validate generated arguments against the discovered schema before sending them. Availability and limits depend on your key and deployment. A tool's output is a string; parse it as JSON only when that tool documents JSON output. SQLite starts with a fresh in-memory database for each invocation.

## Handle failures and retries

Execution errors expose `code` and `retryable` alongside a human-readable message. MCP tool failures use `isError` and `_meta.code` / `_meta.retryable`. Earlier authentication or gateway failures may use a different envelope: always inspect the HTTP status and preserve the response.

- `invalid_input`: correct arguments against the discovered schema.
- `unknown_tool`: refresh discovery and select an available tool.
- `unauthorized`, `access_denied`, `egress_denied`: ask the owner to resolve access; do not broaden permissions automatically.
- `fuel_exhausted`, `memory_limit_exceeded`, `timeout`: reduce the work or request an approved larger budget.
- `quota_exhausted`: check the workspace allowance.
- `retryable: true`: use bounded backoff, respecting `Retry-After` when present. This flag does not establish that a previous execution had no side effects.

Cloud REST execution requires `Idempotency-Key`. Reuse the same key and exact body for a retry; changing the body with the same key returns `409`. A lost response can mean execution happened. MCP accepts an optional idempotency key; calls without one can execute again when retried. The self-hosted gateway accepts the header but does not deduplicate requests. Do not blindly retry tool actions.

## Compatibility and boundaries

`python-extended` includes supported pure-Python libraries such as PyYAML, BeautifulSoup, openpyxl and Pydantic 1. It is not a general Linux environment: arbitrary pip installs, native extensions such as NumPy/pandas, subprocesses and persistent files are not supported. `python-sandbox` has a smaller restricted surface. `bash-emulator` implements a limited command set, not a full shell.

The underlying tools are WebAssembly components using WASI; custom tools must implement RunVero's [WIT contract](https://runvero.dev/docs/wit-contracts). Network access and credentials require explicit policy. Fuel bounds instruction execution; external responses can still change results. See [resource limits](https://runvero.dev/docs/fuel-metering) and [measured performance and quotas](https://runvero.dev/docs/performance-and-cost).
