# Run Mets (Runs)

A **Run** is one execution of your workspace's Met over an `input`. It is the core of agentic infrastructure as a service: the same Met that answers in the chat, now triggered by your code.

## A basic run

```ts
const run = await met.runs.create({ input: 'Summarize the leads from today' });

console.log(run.status);  // 'completed'
console.log(run.output);  // what the Met produced
```
```python
run = met.runs.create("Summarize the leads from today")

print(run["status"])  # 'completed'
print(run["output"])  # what the Met produced
```
```bash
curl -X POST https://api.met.meteor.com.co/api/v1/workspaces/7/runs \
  -H "Authorization: Bearer $MET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"Summarize the leads from today"}'
```

The request is `POST /workspaces/:id/runs`. The response is a `run` resource with an opaque id (`run_…`), `status`, `output`, `livemode` and `metadata`.

## Pick the Met (deterministic bind)

Pass `met` — the name or id of a Met in the workspace — to run **that** Met directly, with its Functions and tools, skipping the orchestrator:

```ts
await met.runs.create({ met: 'Valeria', input: 'How many leads did I close?' });
```
```python
met.runs.create("How many leads did I close?", met="Valeria")
```

Names resolve case-insensitively: exact match first, then prefix. If you omit `met`, the workspace **orchestrator** routes to the right Met, exactly as it does in the chat.

## Memory: conversations

Without a `conversation_id`, the run happens in an **ephemeral conversation** with no prior memory. To give it continuity, pass an existing conversation:

```ts
await met.runs.create({ input: 'And last month?', conversation_id: 1234 });
```

With a `conversation_id`, the first `met` you send becomes the **conversation default**: later runs that omit `met` use that same Met. An explicit `met` always wins over the default.

## Vision: images and files

Pass attachments in `attachments` so the Met can see an image or read a document, with automatic OCR for text inside an image:

```ts
await met.runs.create({
  met: 'Valeria',
  input: 'Does the installed sign match the approved design?',
  attachments: [{ url: 'https://…/photo.jpg', kind: 'image' }],
});
```

Each attachment is `{ url, mime_type?, name?, kind? }`, where `kind` is `image` · `document` · `audio` · `video` · `file`. A bare URL inside `input` is **not** seen — it has to go in `attachments`.

## Read runs

```ts
const run = await met.runs.retrieve('run_01J8…');   // status + output

for await (const r of met.runs.iterate()) {           // full history
  console.log(r.id, r.status);
}
```
```python
run = met.runs.retrieve("run_01J8…")   # status + output

for r in met.runs.iterate():           # full history
    print(r["id"], r["status"])
```

`iterate()` walks every page for you — see [Errors and pagination](errors-and-idempotency.html).

## Cost

Every run debits **Energy** through the usual ledger, marked `execution_type='api'` and attributed to the key. In your dashboard, API usage is reported separately from the internal chat.

> Want the result as it is generated? See the [Streaming](streaming.html) guide.
