Skip to main content
In this quickstart you write one short program that:
  1. Creates an agent (the model and its instructions).
  2. Opens a session (a conversation) and sends a first message.
  3. Waits for the agent to finish its turn.
  4. Prints the saved conversation.
  5. Sends a follow-up message in the same conversation.
It takes about five minutes. No sandbox is involved, so it uses no machine time. If any of these words are new, how Orca works explains them, but you do not need it to follow along.
1

Get your connection details

You need three connection details:
  • Base URL: https://api.orcapods.ai/v1. Not /agents, and not api.openai.com.
  • API key: create an Orca key in the dashboard under Settings, API keys (it is shown once). An OpenAI key does not work here.
  • Model: orca/openrouter/<OpenRouter id> to run on your Orca credit, or <provider>/<id> with your own provider key. If you are unsure, list the Orca credit models.
Treat the key like a password: keep it in your backend or a secret manager, never in browser code or source control.
2

Install the OpenAI client

Orca works with the official openai package. These docs are tested against the versions below; the Agents API is still a beta, so other versions may differ.
For TypeScript, use Node 22.18+ or Node 24+, which can run .ts files directly, or your usual TypeScript runner.
3

Write the program

Save this as quickstart.py or quickstart.ts. The comments mark each of the five steps above. The finally block deletes the agent and session at the end so the demo leaves nothing behind.
4

Run it

You should see the agent and session IDs, the turn finishing with status completed, token usage, the conversation (your message and the haiku), and then the follow-up turn completing.

What just happened

agents.create saved a configuration. Nothing ran yet, and no tokens were used. sessions.create with input opened a conversation and sent the first message. The call returned right away, while the agent was still working. That is why the program has a finished() helper: it checks the session’s turn list every half second until the newest turn reaches a final status (completed, failed, or cancelled). Turns and statuses explains why Orca works this way and what each status means. sessions.items.list read the saved history. The history includes your message, the agent’s reply, and (for agents with tools) every tool call. The list is newest first, so the program reverses it to print in order. sessions.events.create sent a follow-up message as an input event. Because it is the same session, the agent remembers the poem. The program passes the first turn’s ID to finished() so it waits for the new turn instead of seeing the old one as already done. Polling is the simplest way to wait. To show the reply word by word as it is generated, use streaming instead.
In your own application, treat failed and cancelled as real outcomes, not just log lines. Also, if your wait times out, the turn is still running on the server: check its status before you send the same message again, or the agent will do the work twice.

If something went wrong

More in troubleshooting.

Next steps

Stream responses

Show text as it is generated instead of polling.

Give your agent tools

Let the agent call functions in your code.

Run code in a sandbox

Let the agent run commands and produce files.

How Orca works

The full picture of agents, sessions, turns, and tools.