# getAgentTurn

One message sent to Ask Goliath (`conversationId`, `turnId`): `status` RUNNING, WAITING_FOR_CALLER (answer `questions` with answerAgentQuestions), COMPLETED (a card only Goliath answers is `inAppCard`), FAILED (`error`) or CANCELLED, and the `reply` so far. `waitSeconds` (0-25) holds until the reply finishes. Ask Goliath acts as the key owner, as in the app. Needs a WRITE key.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "getAgentTurn", "variables": {...} }`
- Scope: `WRITE`
- Type: query
- Idempotency: a read; rejects `Idempotency-Key`
- Rate-limited: no

## Variables

- `conversationId`: `ID!` (required)
- `turnId`: `ID!` (required)
- `waitSeconds`: `Int` (default `0`)

## Response (data, an example)

```json
{
  "externalAgentChatQuery": {
    "agentTurn": {
      "conversationId": "<ID>",
      "turnId": "<ID>",
      "runId": "<ID>",
      "status": "RUNNING",
      "reply": "…",
      "questions": [
        {
          "id": "<ID>",
          "prompt": "…",
          "kind": "…",
          "options": [
            "…"
          ],
          "multi": true,
          "allowOther": true,
          "approval": true,
          "tone": "…",
          "confirmLabel": "…",
          "draft": {
            "channel": "…",
            "contactId": "<ID>",
            "toName": "…",
            "toAddress": "…",
            "from": "…",
            "reply": true,
            "subject": "…",
            "body": "…",
            "cc": [
              "…"
            ]
          }
        }
      ],
      "inAppCard": {
        "title": "…",
        "url": "…"
      },
      "error": "…"
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operationId": "getAgentTurn",
    "variables": {
      "conversationId": "<conversationId>",
      "turnId": "<turnId>"
    }
  }'
```
