---
search:
  tags:
    - AI
    - GET
seo:
  description: >-
    Fetch an agent by its (org_id, name) handle. Reference for the GET
    /v1/ai/agents/name/{name} endpoint in the Roboto REST API.
sidebar:
  label: Get agent by name
  badge: GET
title: Get agent by name
type: openapi-operation
---
Fetch an agent by its ``(org_id, name)`` handle.

Mirrors :meth:`Action.from_name`: name + owning org are jointly unique
(enforced by the ``agents_unique_org_name`` constraint from chats_018),
so a name plus an org always addresses at most one
agent. The dedicated ``/name/`` subpath avoids collision with
``/agents/<agent_id>`` for agent ids that happen to look like names.
Unlike :func:`get_agent` (which derives the org from the looked-up
record), name lookup needs the org up-front, so it reads the request's
org (``Router.request_org_id``), which the caller is admitted to.

Agent names are free text, so the path segment arrives percent-encoded
and has to be decoded before it can match a stored name. API Gateway
hands the proxy path through verbatim -- without this, an agent named
"Food Preference User Triage" is looked up as
``Food%20Preference%20User%20Triage`` and always 404s.

#### Access control
 - requires_org
 - Restricted tokens need the API scope `api.everything_else`

`GET /v1/ai/agents/name/{name}`

**Responses**

- `200` — OK
- `400` — A conversation with Roboto's AI is longer than the AI model can read at once. The conversation's messages and tool results, together with the AI's instructions, exceed the model's context window. The exception does not carry the token count or the model's limit.
- `401` — The caller's token is expired or malformed.
- `403` — The request would take the user or organization past a limit on a resource, such as AI credits.
- `404` — The request names an API route Roboto does not serve.
- `409` — The request conflicts with an existing resource, such as by giving a name another resource already has.
- `410` — The resource the request names is missing or has expired.
- `500` — Roboto reported an error that this release of the SDK cannot match to a specific exception class. Reported for an element of a :py:class:\`\~roboto.http.BatchResponse\` whose error names a code this release defines no class for, or that arrived without a code, without a message, or as text that is not an error envelope at all. It carries whatever code and message Roboto sent, so a caller handling the failure still learns what went wrong; when no message could be read, the message is the error's raw text. :py:meth:\`\~roboto.domain.devices.Device.create\_session\` raises it, and :py:meth:\`\~roboto.domain.devices.Device.create\_sessions\` lists it in the batch's :py:attr:\`\~roboto.http.BatchResponse.failed\`. The error envelope carries no status code, so \`\`http\_status\_code\`\` reports the 500 inherited from \`\`RobotoDomainException\`\` rather than the status the failure had.
- `501` — The request asks for an operation this deployment of Roboto does not provide.
- `503` — Roboto could not accept the request, such as under heavy load. Retrying later may succeed.
- `504` — Roboto ran out of time while processing the request. Retrying may succeed.
- `507` — The response to the request is larger than Roboto can send. Retrying the same request fails the same way; request less data at a time.

Response example, 200:

```json
{
  "data": {
    "agent_id": "string",
    "org_id": "string",
    "name": "string",
    "description": null,
    "request_template": {
      "client_context": null,
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "text": "string"
            }
          ],
          "status": "not_started",
          "created": "2019-08-24T14:15:22Z",
          "created_by": null
        }
      ],
      "system_prompt": null,
      "client_tools": null,
      "model_profile": null,
      "analysis_scope": null,
      "goals": null,
      "invoke_skills": [
        {
          "skill_id": "string",
          "version": null
        }
      ],
      "available_skills": null,
      "visibility": "private",
      "client_tab_id": null,
      "page_state": null
    },
    "variables": [
      {
        "name": "string",
        "type": "string",
        "description": null,
        "required": true,
        "default": null,
        "collection_content_type": null
      }
    ],
    "created": "2019-08-24T14:15:22Z",
    "created_by": "string",
    "modified": "2019-08-24T14:15:22Z",
    "modified_by": "string",
    "subject": null
  }
}
```
