Python quickstart
Install the SDK, copy the example, and make your first call -- the identity whoami lookup. It is read-only, so it is safe to run as-is.
Prerequisites
You need an AgentRouter API key and the API base URL.
- Create an API key with the Platform API type -- it is shown once, as
<keyid>.<secret>. Copy it now. - Base URL
https://api.tetrate.ai(or your tenant's). SetAGENTROUTER_API_KEYand optionallyAGENTROUTER_BASE_URLin your environment.
Install
Download the Python SDK from the SDKs page, then install the sdist directly from the local file (no PyPI). Open the SDKs page
Install
pip install ./agentrouter-python-0.1.1.tar.gz
Your first call -- whoami
Resolve the identity behind your API key with a read-only GET /v1/me call. Copy the files below. Run with `python main.py`.
"""Runnable example for the AgentRouter Python SDK.
Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `python main.py`.
"""
import os
from agentrouter_sdk import Client
client = Client(
base_url=os.environ["AGENTROUTER_BASE_URL"],
api_key=os.environ["AGENTROUTER_API_KEY"],
)
# Replace the placeholder values below.
try:
result = client.me.get()
print(result)
except Exception as err:
print("Error:", err)
# Point this at the directory you extracted the downloaded Python SDK tarball
# into. The directory name matches the tarball stem on the Download SDK page.
# To install instead from PyPI once published, replace the line below with:
# agentrouter-sdk>=0.1.0
agentrouter-sdk @ file:./third_party/agentrouter-python-0.1.1