Invoke an agent¶
Send prompts to a deployed agent from the Chat Playground, the terminal, Python, or any HTTP client.
Prerequisites¶
An agent with status Deployed. See Deploy an agent.
For the CLI, Python or HTTP: the
arenaCLI signed in, or a CLI API key inARENA_API_KEY. See Install and sign in.
Send a prompt¶
Open Agents in the sidebar and click the agent’s card.
The agent page opens on Chat Playground. Type a message and send it. The reply streams in as it is generated.
The playground keeps each conversation as a session. Start a new one, search, rename or reopen earlier ones from the session list beside the chat. If the agent’s memory scope is Organization, you also see sessions other members started.
The other tabs hold code to copy, already filled in with this agent’s name and endpoint:
Tab |
What it shows |
|---|---|
Arena client |
Python, using |
Arena CLI |
The |
Manual HTTP |
Python |
The Endpoint row in the left panel has a copy button for the endpoint URL.
arena agent generate gsm8k-cispo --prompt "Natalia sold 48 clips in April and half as many in May. How many in total?"
The completion streams to your terminal. Later prompts continue the same conversation, so the agent remembers what you asked. Add --new-session to start over.
To skip the name on every call, select the agent once with arena agent run gsm8k-cispo, then run arena agent generate --prompt "...".
arena agent sessions list lists your conversations with the agent, and arena agent sessions resume picks one up again. Flags are in the command reference.
from agilerl import ArenaClient
with ArenaClient() as client:
with client.open_inference_agent("gsm8k-cispo") as agent:
result = agent.generate("Your prompt here")
if result.results:
print(result.results[0].completion)
ArenaClient() uses your arena login session, or ARENA_API_KEY when it is set. More methods are on the Python client page.
Call the endpoint from your own code¶
Anything that can send HTTPS requests can call the agent. Copy the Manual HTTP snippet from the agent page: it has the full URL and request body. Authenticate with your CLI API key as a Bearer token. The key belongs to you, not to the agent, so the same key works for every agent you can see.
Request and response fields, streaming, and chat sessions over HTTP are in the Inference contract.
If calls fail¶
Calls only succeed while the agent shows Deployed. If it shows Deploying, wait. If it shows Stopped, Not deployed or Deployment failed, start it again with Deploy on its page. Statuses are explained in Deploy an agent.