> For the complete documentation index, see [llms.txt](https://docs.amigo.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amigo.ai/developer-guide/platform-api/functions/agent-runs.md).

# Agent Runs

Agent runs execute a partner agent framework against a workspace's world-tools surface. The platform meets the framework at its open edges: authored configuration for initialization, world tools for data access, and a normalized trajectory of native framework output.

Supported frameworks are `claude-agent-sdk` and `openai-agents`.

## Dispatch a Run

Dispatch returns immediately with a run ID while execution continues asynchronously. A run is either a **platform run**, using a service and framework, or a **native run**, using a registered or inline [agent definition](/developer-guide/platform-api/functions/agent-definitions.md). Provide exactly one configuration style.

{% openapi src="<https://api.platform.amigo.ai/v1/openapi.json>" path="/v1/{workspace\_id}/agent-runs" method="post" %}
<https://api.platform.amigo.ai/v1/openapi.json>
{% endopenapi %}

```bash
curl -X POST https://api.platform.amigo.ai/v1/{workspace_id}/agent-runs \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "service_id": "a1b2c3d4-...",
    "framework": "openai-agents",
    "message": "What appointments does the patient have this week?",
    "timeout_s": 120
  }'
```

## Get a Run

Poll the run until it reaches `succeeded`, `failed`, or `timed_out`. Completed results include final text, provider token usage, duration, and a normalized framework trajectory.

{% openapi src="<https://api.platform.amigo.ai/v1/openapi.json>" path="/v1/{workspace\_id}/agent-runs/{run\_id}" method="get" %}
<https://api.platform.amigo.ai/v1/openapi.json>
{% endopenapi %}

## Authentication and Limits

Both operations require a workspace bearer credential whose workspace matches the path. The caller's credential is forwarded to the world-tools surface, so data access remains subject to the caller's workspace permissions. Dispatch uses the write-rate policy; polling uses the read-rate policy.

## Runtime Notes

* The timeout covers configuration loading and framework execution.
* Trajectory steps are a normalized representation of native framework output. Treat kind-specific fields as informational and forward-compatible.
* Each framework uses the version set's pinned engage model when it belongs to that framework's provider. Otherwise, the runner uses its platform default for that framework.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.amigo.ai/developer-guide/platform-api/functions/agent-runs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
