---
title: "Invoke an agent (SSE when stream=true, else 202 + task_id)"
method: POST
path: "/agents/{agent_id}/invoke"
---

# Invoke an agent (SSE when stream=true, else 202 + task_id)

`POST /agents/{agent_id}/invoke`

## Request

- Base URL: `https://api.mechanofab.com/v1`
- URL: `https://api.mechanofab.com/v1/agents/{agent_id}/invoke`
- Auth: HTTP bearer

## Path parameters

- `agent_id` string, required

## Request body

- object
  - `message` string, required
  - `session_id` string
  - `stream` boolean
  - `file_urls` string[]
  - `file_names` string[]
  - `config` object

## Response `200`

SSE stream (text/event-stream)

## Other responses

- `202`: Async task accepted
- `400`: Invalid request/input.
- `401`: Missing/invalid credentials.
- `402`: Insufficient credits.
- `403`: Scope/tool forbidden.
- `404`: Unknown resource.
- `409`: Idempotency conflict.
- `429`: Rate limited.
- `503`: Control plane / runtime unavailable.

---

[API](https://skmtc.dev/mechanofab/apis/mechanofab-api.md) · [All operations](https://skmtc.dev/mechanofab/apis/mechanofab-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mechanofab/apis/mechanofab-api/revisions/5945a6fad621?raw)
