# Python Client

Source: https://runvero.dev/docs/python-sdk/
Documentation index: https://runvero.dev/llms.txt

The `runvero` Python package is a small client for the RunVero gateway's HTTP and MCP APIs. It has no required dependencies and needs Python 3.8 or newer.

**Install status**
**Available:** install from a checkout of the `runvero` repository, as shown below.
**Planned:** `pip install runvero` from PyPI, with the first public release.


## Installation

```bash
git clone https://github.com/runvero-labs/runvero.git
pip install ./runvero/adapters/python
```

## Start a gateway

The examples below call a local gateway serving the starter tools from the [Quick Start](https://runvero.dev/docs/quickstart):

```bash
export RUNVERO_AUTH_TOKEN="$(openssl rand -hex 24)"
runvero serve --tools-dir target/catalog
```

## Run a tool

```python
import os

from runvero import RunveroClient

client = RunveroClient(
    base_url="http://127.0.0.1:8080",
    auth_token=os.environ["RUNVERO_AUTH_TOKEN"],
)

print([t["name"] for t in client.list_tools()])

result = client.execute(
    "sqlite-runner",
    arguments={"query": "SELECT 6 * 7 AS answer"},
    fuel=10_000_000,
    memory_mb=64,
    timeout_ms=5000,
)
print(result.output)
print(result.fuel_consumed, f"{result.latency_ms:.2f} ms")
```

```text
['calculator', 'regex-extractor', 'sqlite-runner']
{"columns":["answer"],"rows":[[42]],"truncated":false}
333588 5.38 ms
```

`arguments` is checked against the tool's input schema. `fuel`, `memory_mb` and `timeout_ms` are optional; the gateway uses its own defaults when you leave them out.

## Call a tool over MCP

```python
print(client.mcp_call_tool("calculator", {"expression": "2 + 3 * 4"}).output)
```

```text
{"result":14}
```

## Retries

`execute` and `mcp_call_tool` send an `Idempotency-Key` header, generated for you unless you pass `idempotency_key=`. The client never retries a call on its own: a timeout or lost response can mean the tool ran. To retry safely against RunVero Cloud, save your own key with the request and reuse both. The self-hosted gateway accepts the header but does not deduplicate calls.

## Agent frameworks

The client can describe a gateway tool for an agent framework:

- `client.as_langchain_tool("calculator")` returns a LangChain tool (install `./runvero/adapters/python[langchain]`).
- `client.to_openai_tool("calculator")` and `client.to_anthropic_tool("calculator")` return tool definitions for the OpenAI and Anthropic APIs.

See the [client README](https://github.com/runvero-labs/runvero/tree/main/adapters/python) for every method and option.
