# ensureChildAgentRun

```graphql
mutation EnsureChildAgentRun($input: EnsureChildAgentRunInput!) {
  ensureChildAgentRun(input: $input) {
    childConversationId
    childRunId
    childMessageId
    agentId
    duplicate
  }
}
```

Create or recover the child run of a parent run tool call.

## Arguments

| Name                | Type                      | Required | Description                                                                           |
| ------------------- | ------------------------- | -------- | ------------------------------------------------------------------------------------- |
| `input`             | EnsureChildAgentRunInput! | Yes      |                                                                                       |
| `input.parentRunId` | ID!                       | Yes      | Run that delegates the work; the caller must hold its current execution credential.   |
| `input.toolCallId`  | String!                   | Yes      | Tool call in the parent run that starts the child; the pair identifies the child run. |
| `input.request`     | JSON!                     | Yes      | Child agent and the input to start it with.                                           |

## Variables

```json
{
  "input": {
    "parentRunId": "string",
    "toolCallId": "string",
    "request": {}
  }
}
```

## Responses

| Status | Description                                                 |
| ------ | ----------------------------------------------------------- |
| 200    | The EnsureChildAgentRunResult! in data.ensureChildAgentRun. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation EnsureChildAgentRun($input: EnsureChildAgentRunInput!) {\n  ensureChildAgentRun(input: $input) {\n    childConversationId\n    childRunId\n    childMessageId\n    agentId\n    duplicate\n  }\n}",
  "variables": {
    "input": {
      "parentRunId": "string",
      "toolCallId": "string",
      "request": {}
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "ensureChildAgentRun": {
      "childConversationId": "string",
      "childRunId": "string",
      "childMessageId": "string",
      "agentId": "string",
      "duplicate": false
    }
  }
}
```
