Invoke an agent

Once a deployment is Deployed and connected, expand its row on the Agents page. The expanded panel shows the endpoint and copy-paste examples built from the deployment’s algorithm and environment type.

You need a Deployed status and an Endpoint before snippets render. Classic RL and Advanced Training load them the same way after status is Deployed.

Inference HTTP calls authenticate with an Arena personal access token (PAT) from your profile (ARENA_API_KEY), not a per-deployment secret. Create and manage the PAT under Profile managementCLI API key. See CLI authentication.

Components block

At the top:

Field

Use

Endpoint

Base URL for the deployment; the Manual HTTP snippet adds the path suffix

Copy icons copy the endpoint value.

The Arena client tab uses the Python client with your deployment name. The Manual HTTP tab shows raw requests using the endpoint and ARENA_API_KEY. The Arena CLI tab appears for LLM deployments only.

Deployment code tabs

Under Deployment code, you get Arena client and Manual HTTP for every deployment, plus an Arena CLI tab for LLM deployments (beside Chat playground):

Tab

When to use

Arena client

Recommended Python path: ArenaClient from agilerl.arena, authenticated by arena login or ARENA_API_KEY

Arena CLI

LLM deployments only: arena agent generate after arena login or ARENA_API_KEY

Manual HTTP

Raw requests.post with URL and Bearer token from ARENA_API_KEY as shown in the snippet

Every snippet tab (Arena client, Manual HTTP, and Arena CLI when shown) carries a note that authorization uses ARENA_API_KEY (Arena PAT from profile), with a link to the CLI API key section of your profile. The note is on Deployment code, not Chat playground. ArenaClient() uses your arena login session, or the same ARENA_API_KEY variable when it is set. Manual HTTP and Arena CLI snippets read the Bearer token from that variable.

The snippet variant depends on algorithm and environment shape:

Situation

Arena client

Manual HTTP (paths shown in snippet)

Single-agent Gym

open_inference_agent + get_action loop

POST with get_action suffix and numpy serialize helpers

Recurrent PPO

Same with hidden_state threaded each step

Same suffix; body includes serialized hidden_state

PettingZoo / multi-agent

Dict observations per agent

Same suffix; action_mask and env_defined_actions in payload

LLM

open_inference_agent then generate

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)

The snippet names no credential. Run arena login first, or export ARENA_API_KEY with your PAT, and the client picks it up. See CLI authentication.

Gym loop:

from agilerl.arena import ArenaClient

with ArenaClient() as client:
    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 opens the agent with open_inference_agent(DEPLOYMENT_NAME), then calls generate on it (which posts to the generate path with a prompts list and params like max_new_tokens, temperature, top_p, do_sample). Copy the full example from the panel.

Arena CLI

Shown for LLM deployments only. After arena login (or ARENA_API_KEY):

arena agent generate YOUR_DEPLOYMENT_NAME --prompt "Your prompt here"

The command streams the completion to your terminal. Classic RL and supervised deployments have no Arena CLI tab — use the Arena client or Manual HTTP tab instead.

Manual HTTP

Manual examples base64-encode numpy observations for the get_action path. Authorization is Bearer plus your Arena PAT: set ARENA_API_KEY to the secret from Profile managementCLI API key, and the snippet builds Bearer {os.environ['ARENA_API_KEY']}. Paste the Endpoint from the Components block; the PAT comes from your profile, not from the deployment row.

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_stream path (singular prompt, text/plain token stream) using your signed-in Platform session. Each request sends the current user turn plus a session_id; the deployment loads and replays stored history for that session before generating. Streamed tokens append to one assistant message as they arrive.

Each open playground keeps one session_id for the panel (and mints a new one when you clear chat), so the deployment treats that panel as one conversation. After reload, the playground hydrates the thread from GET /sessions/{session_id} (full transcript); generate alone does not return prior messages. Manual HTTP and Arena client calls do not send one: add a session_id of your own and reuse the same value across turns if you want the same conversation memory.

To list existing conversations on that deployment, call GET /sessions on the same endpoint host with the same Bearer token as generate. Each item includes session_id, created_at, last_updated, optional created_by (display name; the playground shows creator only when the deployment’s memory scope is Organization), and optional title (string or null). The sidebar prefers a non-null title, otherwise a date from last_updated / created_at. Rename with PATCH /sessions/{session_id} and body { "title": "..." } (blank/"" clears to null; max 200 after trim); renaming does not change last_updated. Open a session with GET /sessions/{session_id} (transcript only — no created_by / title); delete with DELETE /sessions/{session_id}. Use a listed session_id on later generate_stream calls to continue that conversation (current turn only in prompt). User-scoped deployments keep sessions private to you; organization-scoped deployments let org members list and open each other’s sessions on that deployment.

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, Arena PAT as Bearer, 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.

See also