ReflexioDeveloper Docs
Menu
All

Initialization & Authentication

ReflexioClient setup for Hosted Enterprise and Local OSS.

Initialization & Authentication

ReflexioClient

The main client class for interacting with the Reflexio API. The same ReflexioClient works against both deployment modes — only the install package, the URL, and whether you need an API key change.

from reflexio import ReflexioClient

client = ReflexioClient()  # uses REFLEXIO_API_KEY env var
curl -X GET "https://www.reflexio.ai/api/whoami" \
  -H "User-Agent: my-agent-reflexio" \
  -H "Authorization: Bearer $REFLEXIO_API_KEY"

Prop

Type

The SDK and CLI share one URL env var. Both the Python client and the reflexio CLI read REFLEXIO_URL, defaulting to https://www.reflexio.ai/. Set it once (or pass --server-url / url_endpoint explicitly) and both tools agree.


Setup

Hosted Enterprise

The hosted endpoint at https://www.reflexio.ai and API key authentication require a Reflexio Enterprise account.

Hosted Enterprise access is invite-gated. If you do not have an account yet, join the waitlist from the registration page and create your account from the invitation email once access is approved.

Install the lightweight client package — it has only the SDK and a handful of pure-Python deps:

pip install reflexio-client

Set your API key as an environment variable, then create the client with no arguments:

export REFLEXIO_API_KEY="your-api-key"
from reflexio import ReflexioClient

client = ReflexioClient()  # url defaults to https://www.reflexio.ai/

# Ready to use immediately
response = client.get_config()
curl -X GET "https://www.reflexio.ai/api/get_config" \
  -H "User-Agent: my-agent-reflexio" \
  -H "Authorization: Bearer $REFLEXIO_API_KEY"

You can also pass the API key directly:

client = ReflexioClient(api_key="your-api-key")

API keys are shown only once when created. Store the value somewhere secure, because the web portal only displays the saved prefix afterward. If a key is lost, create a new key and delete the old one.

Install the full open-source package — it bundles the client, the FastAPI server, and the reflexio CLI:

pip install reflexio-ai

Start the local server:

reflexio services start  # listens on http://localhost:8081

Point the client at it. No API key is needed — the open-source server runs without authentication by default.

from reflexio import ReflexioClient

client = ReflexioClient(url_endpoint="http://localhost:8081")

# Ready to use immediately
response = client.get_config()
curl -X GET "http://localhost:8081/api/get_config" \
	  -H "User-Agent: my-agent-reflexio"

Or use the env var:

export REFLEXIO_URL="http://localhost:8081"
from reflexio import ReflexioClient

client = ReflexioClient()  # auto-reads REFLEXIO_URL

Environment variables

Variables the Python client reads. Explicit constructor parameters always take precedence.

VariablePurpose
REFLEXIO_API_KEYAPI key for authentication. Required for Hosted Enterprise; not required by default for Local OSS. API keys are shown only once when created.
REFLEXIO_URLBase URL for the API. Defaults to Hosted Enterprise at https://www.reflexio.ai/. Set to http://localhost:8081 for Local OSS.

The reflexio CLI reads the same REFLEXIO_URL env var, so a single setting configures both the SDK and the CLI. See the CLI Reference for details.


Client Behavior

Synchronous API

All client methods are synchronous — no await needed. The client handles async operations internally.

Fire-and-Forget Mode

Several methods use fire-and-forget by default: the call returns None immediately and the operation runs in the background. Set wait_for_response=True to block until the server confirms.

Methods with optional fire-and-forget (wait_for_response=False by default):

  • delete_interaction, delete_profile, delete_request, delete_session, delete_agent_playbook, delete_user_playbook, rerun_profile_generation, rerun_playbook_generation, run_playbook_aggregation

Methods that are always fire-and-forget (no blocking option):

  • manual_profile_generation, manual_playbook_generation

publish_interaction always blocks on the HTTP round-trip and returns a PublishUserInteractionResponse — the wait_for_response flag controls only whether the server processes extraction synchronously before returning, not the client transport.

Caching

get_profiles and get_agent_playbooks cache results locally for 10 minutes. After publishing new data, pass force_refresh=True to bypass the cache and fetch fresh results.