---
title: "Address with agent"
description: "Makes the branch `<n>-<the title's first words, up to 30 characters>`\n(or `branch` when given) off main, or uses it as it is when it exists,\ntitled as the issue and linked to it, so\nmerging it closes the issue; then launches a session acting as the\ncaller, told the issue's title, body and comments and `prompt` when\ngiven. 409 `issue_closed` for a closed issue.\n"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.gitpando.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Pando API › agents

`POST /v1/monorepos/{owner}/{monorepo}/issues/{n}/agent`

Makes the branch `<n>-<the title's first words, up to 30 characters>`
(or `branch` when given) off main, or uses it as it is when it exists,
titled as the issue and linked to it, so
merging it closes the issue; then launches a session acting as the
caller, told the issue's title, body and comments and `prompt` when
given. 409 `issue_closed` for a closed issue.

## Authentication

Requires one of the following:

- `credential`, http, header `Authorization`
- `session`, apiKey, in cookie

## Path parameters

- `addressIssueWithAgent.path.owner` (string, required) — The monorepo's owner, a namespace (a person's login or an organization). Matched without case.
  - pattern `^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){0,38}$`
- `addressIssueWithAgent.path.monorepo` (string, required) — The monorepo's name within its owner (or an old name). Matched without case.
  - pattern `^[a-z0-9](?:[a-z0-9._]|-(?!-)){0,38}$`
- `addressIssueWithAgent.path.n` (integer, required)

## Request body

- `addressIssueWithAgent.prompt` (string, optional)
  - maxLength 65536
- `addressIssueWithAgent.repo` (string, optional)
- `addressIssueWithAgent.model` (string, optional)
- `addressIssueWithAgent.branch` (string, optional)

## Example request

```json
{
  "prompt": "string",
  "repo": "string",
  "model": "string",
  "branch": "string"
}
```

## Code samples

### cURL

```curl
curl --request POST \
  --url https://app.gitpando.com/v1/monorepos/string/string/issues/0/agent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "string",
  "repo": "string",
  "model": "string",
  "branch": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://app.gitpando.com/v1/monorepos/string/string/issues/0/agent';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({prompt: 'string', repo: 'string', model: 'string', branch: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://app.gitpando.com/v1/monorepos/string/string/issues/0/agent"

payload = {
    "prompt": "string",
    "repo": "string",
    "model": "string",
    "branch": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Launched

#### Example

```json
{
  "number": 0,
  "kind": "task",
  "status": "working",
  "reason": "string",
  "repo": "string",
  "branch": "string",
  "program": "string",
  "model": "string",
  "issue": 0,
  "launched_by": "string",
  "machine": "string",
  "workspace": "mount",
  "awaiting_checks": true,
  "first_message": "string",
  "branch_facts": {},
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
```

- `addressIssueWithAgent.response.201.number` (integer, required)
- `addressIssueWithAgent.response.201.kind` (string, required)
  - one of `"task"`, `"issue"`, `"review"`, `"chat"`
- `addressIssueWithAgent.response.201.status` (string, required)
  - one of `"working"`, `"waiting"`, `"failed"`, `"stopped"`
- `addressIssueWithAgent.response.201.reason` (string | null, required)
- `addressIssueWithAgent.response.201.repo` (string, required)
- `addressIssueWithAgent.response.201.branch` (string | null, required) — Named by a person or from its issue; null for an assistant's chat until the person names one.
- `addressIssueWithAgent.response.201.program` (string, required) — pi
- `addressIssueWithAgent.response.201.model` (string, required)
- `addressIssueWithAgent.response.201.issue` (integer | null, required)
- `addressIssueWithAgent.response.201.launched_by` (string, required)
- `addressIssueWithAgent.response.201.machine` (string, required) — The session's credential, cloud-<n>.
- `addressIssueWithAgent.response.201.workspace` (string | null, required)
  - one of `"mount"`, `"clone"`, `null`
- `addressIssueWithAgent.response.201.awaiting_checks` (boolean, required) — Its merge waits for required checks still running; Pando tells it when they are green.
- `addressIssueWithAgent.response.201.first_message` (string | null, required) — An assistant's chat: its first message, cut at 200 characters; null for other kinds.
- `addressIssueWithAgent.response.201.created_at` (string, required)
  - format `date-time`
- `addressIssueWithAgent.response.201.updated_at` (string, required)
  - format `date-time`
- `addressIssueWithAgent.response.201.branch_facts` (object | null, optional) — In a list only. Its branch now (state, ahead, merged_at, checks); null while the branch is not made yet.

### 409

An error

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "paths": [
      "string"
    ],
    "checks": {
      "sha": "string",
      "state": "success",
      "required": [
        "string"
      ],
      "checks_unknown": "string",
      "missing": [
        "string"
      ],
      "statuses": [
        {
          "sha": "string",
          "context": "string",
          "state": "pending",
          "target_url": "string",
          "description": "string",
          "creator": "string",
          "app": "string",
          "created_at": "2019-08-24T14:15:22Z"
        }
      ]
    }
  }
}
```

- `addressIssueWithAgent.response.409.error` (object, required)
  - `addressIssueWithAgent.response.409.error.code` (string, required)
  - `addressIssueWithAgent.response.409.error.message` (string, required)
  - `addressIssueWithAgent.response.409.error.paths` (array<string>, optional)
  - `addressIssueWithAgent.response.409.error.checks` (object, optional) — GitHub's combined status, plus the required contexts and which are missing.
    - `addressIssueWithAgent.response.409.error.checks.sha` (string | null, required)
    - `addressIssueWithAgent.response.409.error.checks.state` (string, required) — `success` when the merge gate passes; `missing` when a required context has not reported; `unknown` while the required checks are (an unforced merge is refused).
      - one of `"success"`, `"pending"`, `"failure"`, `"error"`, `"missing"`, `"unknown"`
    - `addressIssueWithAgent.response.409.error.checks.required` (array | null, required) — Null while unknown.
    - `addressIssueWithAgent.response.409.error.checks.checks_unknown` (string | null, required) — Why the required checks are unknown, in plain words: "Pando couldn't read this monorepo's required checks; try again", or "pando.toml line 3: expected comma or end of structure; fix it on main, or merge with force". Null otherwise.
    - `addressIssueWithAgent.response.409.error.checks.statuses` (array<object>, required) — The latest status per context.
      - `addressIssueWithAgent.response.409.error.checks.statuses.sha` (string, required)
      - `addressIssueWithAgent.response.409.error.checks.statuses.context` (string, required)
      - `addressIssueWithAgent.response.409.error.checks.statuses.state` (string, required)
        - one of `"pending"`, `"success"`, `"failure"`, `"error"`
      - `addressIssueWithAgent.response.409.error.checks.statuses.created_at` (string, required)
        - format `date-time`
      - `addressIssueWithAgent.response.409.error.checks.statuses.target_url` (string | null, optional)
      - `addressIssueWithAgent.response.409.error.checks.statuses.description` (string | null, optional)
      - `addressIssueWithAgent.response.409.error.checks.statuses.creator` (string, optional) — The member who posted it (a login); `app:<slug>` for a status posted with a status token or by a CI integration; `hook:<hook id>` for a status token from a web hook with no app.
      - `addressIssueWithAgent.response.409.error.checks.statuses.app` (string | null, optional) — The CI service that reported it (`buildkite`, `github-actions`, ...), stamped by Pando from a status token or a CI integration, never from the body or `target_url`. Null when a member posted it with their own credential. The web shows the service's mark for a slug it knows.
    - `addressIssueWithAgent.response.409.error.checks.missing` (array<string>, optional)


Source: https://docs.gitpando.com/api/agents/addressIssueWithAgent/index.md
