Invoke an agent¶
Once a deployment is Deployed and connected, expand its row on the Agents page. The expanded panel shows credentials and copy-paste examples built from the deployment’s algorithm and environment type.
You need both API key and Endpoint before snippets render. Classic RL and Advanced Training load them the same way after status is Deployed.
Components block¶
At the top:
Field |
Use |
|---|---|
API key |
Bearer token for inference HTTP |
Endpoint |
Base URL for the deployment; the Manual HTTP snippet adds the path suffix |
Copy icons copy each value. Rotate deployment API key opens a confirmation dialog; after confirm, the old key stops working immediately.
The Arena client tab uses the Python client with your deployment name. Arena CLI and Manual HTTP tabs show commands or raw requests using the values in this block.
Deployment code tabs¶
Three sub-tabs under Deployment code (or beside Chat playground for LLM agents):
Tab |
When to use |
|---|---|
Arena client |
Recommended Python path: |
Arena CLI |
After |
Manual HTTP |
Raw |
The snippet variant depends on algorithm and environment shape:
Situation |
Arena client |
Manual HTTP (paths shown in snippet) |
|---|---|---|
Single-agent Gym |
|
POST with get_action suffix and numpy serialize helpers |
Recurrent PPO |
Same with |
Same suffix; body includes serialized |
PettingZoo / multi-agent |
Dict observations per agent |
Same suffix; |
LLM |
|
POST with generate suffix |
Supervised |
Arena client tab as shown |
POST with predict suffix |
Classic RL uses gym-style examples. Recurrent PPO is detected by algorithm name. LLM algorithms use generate examples and expose the chat UI.
Payload and URL details match what the Manual HTTP tab prints. See Inference contract for status and suffix overview.
Arena client (sketch)¶
Gym loop:
from agilerl.arena.client import ArenaClient
with ArenaClient() as client:
client.login()
with client.open_inference_agent("YOUR_DEPLOYMENT_NAME") as agent:
state, info = env.reset()
for _ in range(10):
_, action, _ = agent.get_action(state, batched=False, info=info)
state, *_, info = env.step(action)
LLM: the UI snippet calls ensure_inference_binding(DEPLOYMENT_NAME) for base URL and key, then posts to generate with a prompts list and params (max_new_tokens, temperature, top_p, do_sample). Copy the full example from the panel.
Arena CLI¶
arena login
arena inference run YOUR_DEPLOYMENT_NAME --obs '<YOUR_OBS_HERE>'
For LLM deployments the CLI tab shows arena inference list --name YOUR_DEPLOYMENT_NAME. Use the Arena client or Manual HTTP tab for generate calls.
Manual HTTP¶
Manual examples base64-encode numpy observations for the get_action path. Authorization is Bearer <api_key> (the snippet adds the prefix). You paste Endpoint and API key from the Components block; no separate Platform login.
Copy the Classic RL or LLM snippet exactly as rendered in the Manual HTTP tab. It already combines your endpoint with the correct path suffix.
Chat playground¶
For advanced LLM deployments only, the panel defaults to a Chat playground tab when the algorithm is in the LLM family. Supervised, LatentPPO, and Classic RL do not get this tab.
The playground posts to your endpoint on the generate path with the deployment API key. It formats multi-turn text as User: / Assistant: lines and reads completions from the first result row.
Switch to Deployment code for the Python examples.
Expand row requirements¶
Tab |
Row expands when |
|---|---|
Classic RL |
Status is Deployed and the agent is connected |
Advanced Training |
Linked deployment status is Deployed |
If you see “No deployment found for this agent”, click Connect first or wait until status leaves Pending.
External callers¶
Anything that can send HTTPS requests can call the endpoint if it uses the same URL, Bearer token, and JSON body as the Manual HTTP snippet:
Classic RL: get_action (full URL in snippet)
LLM: generate
Supervised and LatentPPO: predict
If status drops from Deployed to Pending or Failed, calls may fail until you reconnect. See Inference contract.