# Quickstart

Covers: signing up, making an API key, installing the CLI or the Python SDK, and running a first instance.

For: a developer, or a coding agent working for one, who has not used poema cloud yet.

poema cloud runs your organization's agents for you, each in an instance: an isolated Linux environment made from
poema's base image and a command. In a few minutes you will have an account, a key, a client, and an instance that
prints `hello`, which you can then suspend, resume or fork.

> **Note:** The API, the SDK and the CLI call an instance a task (`kind: Task`, `create_task`), and the MCP server's
> tools call it a sandbox (`sandbox_create`). The code on these pages uses those names as they are.

## Before you start

- A Google account, or an email address you can read, to sign up.
- For the Python SDK, Python 3.9 or later. For the CLI, Node 22.19 or later. Or neither: curl is enough for the HTTP API.
- To deploy an agent from its git repository on the dashboard instead, see [Deploy from git](https://client-test.poema.dev/docs/git.md).

```mermaid
flowchart TB
  subgraph first [" "]
    direction LR
    A[Sign up] --> B[Make an API key] --> C[Install the CLI or SDK]
  end
  subgraph then [" "]
    direction LR
    D[Create an instance] --> E[Read its output] --> F[Suspend, resume or fork it]
  end
  first --> then
  style first fill:none,stroke:none
  style then fill:none,stroke:none
```

A diagram of the six steps below: sign up, make a key, install a client, create an instance, read its output, then suspend, resume or fork it.

## 1. Sign up

[Sign up](https://client-test.poema.dev/sign-up) with Google, or with an email address and a password of at least 15 characters. For an email
sign-up poema sends a link to confirm the address: open it, or ask for it again with "Send the link again". Until then,
signing in answers "Verify your email first". A new account gets an organization of its own, which you manage as its
Admin ([Team and access](https://client-test.poema.dev/docs/team.md)). Then tell us your name; the other questions are optional.
Already have an account? [Sign in](https://client-test.poema.dev/sign-in). If your account has to wait to be let in, the dashboard opens once it is.

## 2. Make a key

In the dashboard's [Settings, Account](https://client-test.poema.dev/dashboard/settings?tab=account), under API keys, make a key by choosing Create key and giving it a name.
It looks like `poema_ns_XXXXXXXX_...`, with your organization's namespace in the middle,
and reaches your organization alone: it is made of `poema_ns_` and your namespace, then a secret. The CLI and the SDK read it from the variable `POEMA_API_KEY`.

> **Warning:** The key is shown once. Copy it before you close the form; if you lose it, revoke it and make another.

![Settings, Account: one member, the Admin who made the organization, a note that the plan allows the owner alone, an empty API keys table with a Create key button, and the variables and commands that use a key.](https://client-test.poema.dev/docs/img/team.png)

## 3. Install the CLI or the SDK

The Python SDK needs nothing but Python, and brings `poema-mcp`, the MCP server. The CLI needs Node.
Neither is on PyPI or npm: this site carries them. Anyone else's package of the same name is not poema's.

```
python3 -m venv ~/.venvs/poema
~/.venvs/poema/bin/pip install https://client-test.poema.dev/dl/poema-0.2.0-py3-none-any.whl
npm install -g https://client-test.poema.dev/dl/poema-cli-0.1.0.tgz
```

Installed the CLI? `poema login --url https://client-test.poema.dev` signs you in from the shell with no key to copy, for an Admin
([CLI](https://client-test.poema.dev/docs/cli.md)).

## 4. Your first instance

Pick the client you installed. Each makes an instance that runs `echo hello`.

Python:

With your key in place of `poema_ns_...`, run this in a shell:

```
export POEMA_URL=https://api.client-test.poema.dev
export POEMA_API_KEY=poema_ns_...

~/.venvs/poema/bin/python - <<'EOF'
from poema import Poema

p = Poema()
t = p.create_task("hello", ["sh", "-c", "echo hello"])
print(t.wait_exit(timeout=600), t.logs())
t.suspend()   # its files stay; t.resume() goes on
EOF
```

CLI:

The CLI makes the same instance, and also opens a shell in it:

```
export POEMA_URL=https://api.client-test.poema.dev
export POEMA_API_KEY=poema_ns_...

echo '{"apiVersion": "poema.dev/v1alpha1", "kind": "Task", "metadata": {"name": "hello"},
  "spec": {"command": ["sh", "-c", "echo hello; sleep 600"], "gateway": {"name": "default"}, "debug": true}}' | poema apply -f -
poema get tasks
poema logs hello
poema terminal hello             # a shell in it (debug: true turns the terminal on)
poema forward hello 3000:3000    # 127.0.0.1:3000 here, to port 3000 inside it
```

HTTP:

You need curl and your API key. Set the API address and key first:

```
export POEMA_URL=https://api.client-test.poema.dev
export POEMA_API_KEY=poema_ns_...
```

The [HTTP API](https://client-test.poema.dev/docs/api.md) page lists its routes. Replace `YOUR_NAMESPACE` with the namespace shown with your API key in Settings, Account. This creates an instance with no
network, prints hello and keeps it running so you can read its log:

```sh
export POEMA_NAMESPACE=YOUR_NAMESPACE
API="$POEMA_URL/v1alpha1/namespaces/$POEMA_NAMESPACE"
curl -fsS -X PUT "$API/tasks/http-hello" -H "X-API-Key: $POEMA_API_KEY" -H 'Content-Type: application/json' -d '{
  "apiVersion":"poema.dev/v1alpha1","kind":"Task","metadata":{"name":"http-hello"},
  "spec":{"command":["sh","-c","echo hello; sleep 600"]}}'
curl -fsS "$API/tasks/http-hello" -H "X-API-Key: $POEMA_API_KEY"
```

Repeat the last request until `status.phase` is `Running`, then read the log. Delete the instance when you finish:

```sh
curl -fsS "$API/tasks/http-hello/logs" -H "X-API-Key: $POEMA_API_KEY"
curl -fsS -X DELETE "$API/tasks/http-hello?wait=true" -H "X-API-Key: $POEMA_API_KEY"
```

The Python and HTTP examples create instances with no network, as `echo hello` needs none. Pass `gateway="default"`
to `create_task` to give an instance your organization's Gateway, which reaches package registries and git hosts
([Network rules](https://client-test.poema.dev/docs/network.md)). The CLI example already uses the `default` Gateway.

Delete what you made when you finish (step 6): a suspended instance still counts toward the objects your plan keeps.

## 5. See what it did

The dashboard's Instances page lists the instance, its status and its log. From the CLI, `poema logs hello` prints its
output (`http-hello` for the HTTP tab's), and `poema describe task hello` shows its spec, status, token usage and
recent activity, including any host it was refused.

## 6. Suspend, resume or fork it

Suspend an instance when it is idle: it uses no compute and keeps its memory and files, and `resume` carries on where it
stopped. Fork a suspended instance to make a new one on a copy of its workspace. With the CLI, for the instance above:

```
poema suspend hello
poema get tasks                   # again until hello is Suspended: suspend returns at once
poema fork hello hello-try        # a new instance on a copy of its /workspace
poema resume hello
poema delete task hello-try
poema delete task hello
```

The Python example left its instance suspended: in Python, `Poema().task("hello").resume()` carries it on and
`Poema().task("hello").delete()` deletes it. The
[Python SDK](https://client-test.poema.dev/docs/python.md) and [CLI](https://client-test.poema.dev/docs/cli.md) pages list what else they do.

## Use it from Claude Code

Let Claude Code create and work in instances through the MCP server:

```
claude mcp add poema -e POEMA_URL=https://api.client-test.poema.dev -e POEMA_API_KEY=poema_ns_... -- poema-mcp
```

Claude Code has to find `poema-mcp`: put `~/.venvs/poema/bin` on its `PATH`, or give the full path. The
[MCP](https://client-test.poema.dev/docs/mcp.md) page lists its tools.

## Next steps

- [Concepts](https://client-test.poema.dev/docs/concepts.md): instances, suspend and fork, the closed network and models, on one page.
- [Deploy from git](https://client-test.poema.dev/docs/git.md): run an agent from its repository, from the dashboard.
- [Secrets and keys](https://client-test.poema.dev/docs/secrets.md): give agents a model or a service without handing them the key.
- [Plans, limits and billing](https://client-test.poema.dev/docs/plans.md): what your plan allows, and how to see what you have used.

## For an agent reading this

- A human has to [sign up](https://client-test.poema.dev/sign-up) and make your key: you cannot. These are their steps:

  1. The human signs up or signs in on the home page, https://client-test.poema.dev/ (the Sign up and Sign in buttons).
  2. On [Settings, Account](https://client-test.poema.dev/dashboard/settings?tab=account) they choose "Create key" and copy it (shown once).
  3. They give it to you as `POEMA_API_KEY`, with the API's address as `POEMA_URL`.
- Send `X-API-Key: $POEMA_API_KEY` on every HTTP request. The key's third part, after `poema_ns_`, is your namespace.
- A model needs a provider key that the human saves on the Keys page ([Secrets and keys](https://client-test.poema.dev/docs/secrets.md)). You never see it.
- On the free plan 3 instances run at once, a session lasts up to 60 minutes and an
  instance that would go past a limit waits `Pending` ([Plans, limits and billing](https://client-test.poema.dev/docs/plans.md)).
- Every error is JSON, `{"error":{"code":"Invalid","message":"..."}}`, with the matching HTTP status. The routes are on
  [HTTP API](https://client-test.poema.dev/docs/api.md). A page that is not here:
  the index of all pages is `/llms.txt`, and all of them in one file `/llms-full.txt`.

Last checked: unreleased checkout.
