configure()
Configure the global Gavrun client. Call once at startup before any guarded tool calls.
python
import gavrun
client = gavrun.configure(
api_key="gavrun_live_...",
agent_name="my-agent",
agent_manager_url="https://api.gavrun.ai",
)Signature
python
def configure(
*,
api_key: str | None = None,
agent_name: str | None = None,
agent_manager_url: str | None = None,
environment: str | None = None,
mode: str | None = None,
auto_patch: bool = True,
dotenv_path: str | None = ".env",
) -> GavrunClientAll parameters are keyword-only.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | env GAVRUN_API_KEY | SDK API key from the dashboard. |
agent_name | str | env GAVRUN_AGENT_NAME | Stable identifier for this agent. |
agent_manager_url | str | env GAVRUN_AGENT_MANAGER_URL | Required. API base URL. Use https://api.gavrun.ai for production. |
environment | str | env GAVRUN_ENV or "dev" | Deployment environment: "dev", "staging", or "prod". |
mode | str | env GAVRUN_MODE or "enforce" | See Modes. |
auto_patch | bool | True | Auto-instrument LangChain, LangGraph, CrewAI, and OpenAI Agents SDK. |
dotenv_path | str | None | ".env" | Path to a .env file to load before resolving other parameters. None to skip. |
Environment variables
All parameters fall back to environment variables:
| Parameter | Env var |
|---|---|
api_key | GAVRUN_API_KEY |
agent_name | GAVRUN_AGENT_NAME |
agent_manager_url | GAVRUN_AGENT_MANAGER_URL |
environment | GAVRUN_ENV |
mode | GAVRUN_MODE |
Errors
GavrunError— raised ifagent_manager_urlis not set (neither as argument nor env var).
Returns
GavrunClient — the global singleton client. Retrieve it later with gavrun.get_client().
Example: explicit config
python
import gavrun
gavrun.configure(
api_key="gavrun_live_abc123",
agent_name="support-agent",
agent_manager_url="https://api.gavrun.ai",
environment="prod",
mode="enforce",
)Example: env-only config
bash
# .env
GAVRUN_API_KEY=gavrun_live_abc123
GAVRUN_AGENT_NAME=support-agent
GAVRUN_AGENT_MANAGER_URL=https://api.gavrun.ai
GAVRUN_ENV=prodpython
import gavrun
gavrun.configure() # reads all values from env / .env file