> For the complete documentation index, see [llms.txt](https://docs.terrakube.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terrakube.io/api/methods/agent.md).

# Agent

This endpoint is used to create, update, search or delete job agents for a Terrakube organization.

{% hint style="info" %}
You need to be part of the administrator group to work with this endpoint
{% endhint %}

### Entity fields:

| Path                        | Type   | Description                                                                                                           |
| --------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| data.type                   | string | Should be "agent"                                                                                                     |
| data.attributes.name        | string | Agent pool name                                                                                                       |
| data.attributes.description | string | Agent pool description                                                                                                |
| data.attributes.url         | string | URL where the executor component will be available. Example: <http://terrakube-executor-service.self-hosted-executor> |

### Example:

```
POST {{terrakubeApi}}/api/v1/organization/{{organizationId}}/agent
{
  "data": {
    "type": "agent",
    "attributes": {
      "name": "sample-agent",
      "url": "http://localhost:8090",
      "description": "This is a sample agent"
    }
  }
}
```

### Supported Operations:

####

{% openapi src="/files/SRDoGWJ2keFnStreqMbm" path="/organization/{organizationId}/agent" method="get" %}
[v2\_7.yaml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-a0835f006f08c9cf0115fe717f9c0da99ac9cfda%2Fv2_7.yaml?alt=media)
{% endopenapi %}

{% openapi src="/files/SRDoGWJ2keFnStreqMbm" path="/organization/{organizationId}/agent" method="post" %}
[v2\_7.yaml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-a0835f006f08c9cf0115fe717f9c0da99ac9cfda%2Fv2_7.yaml?alt=media)
{% endopenapi %}

{% openapi src="/files/SRDoGWJ2keFnStreqMbm" path="/organization/{organizationId}/agent/{agentId}" method="get" %}
[v2\_7.yaml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-a0835f006f08c9cf0115fe717f9c0da99ac9cfda%2Fv2_7.yaml?alt=media)
{% endopenapi %}

{% openapi src="/files/SRDoGWJ2keFnStreqMbm" path="/organization/{organizationId}/agent/{agentId}" method="delete" %}
[v2\_7.yaml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-a0835f006f08c9cf0115fe717f9c0da99ac9cfda%2Fv2_7.yaml?alt=media)
{% endopenapi %}

{% openapi src="/files/SRDoGWJ2keFnStreqMbm" path="/organization/{organizationId}/agent/{agentId}" method="patch" %}
[v2\_7.yaml](https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-a0835f006f08c9cf0115fe717f9c0da99ac9cfda%2Fv2_7.yaml?alt=media)
{% endopenapi %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.terrakube.io/api/methods/agent.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
