---
title: "Deferred tool result"
description: "App backend は user message を作らず、model に tool を再呼び出しさせずに現在の tool call result を defer できます。Core が理解するのは operation id と opaque app data だけで、login、approval、payment、device pairing など…"
url: "https://sotaagents.ai/ja/manual/developer-guide/deferred-tool-results"
generated_by: "sotaagents-ldp"
docs_index: "https://sotaagents.ai/manual/llms.txt"
locale: "ja"
---

# Deferred tool result

App backend は user message を作らず、model に tool を再呼び出しさせずに現在の tool call result を defer できます。Core が理解するのは operation id と opaque app data だけで、login、approval、payment、device pairing などは app logic です。

JSON

```json
{
  "_sota": {
    "deferredToolResult": {
      "operationId": "app-defined-globally-unique-id",
      "data": { "anyAppOwnedValue": true }
    }
  }
}
```

Core は exact run、tool call、tool name、installation、environment を登録し、`output-pending` と exact panel の `pendingToolResults` を公開します。Model はまだ tool result を受け取りません。

YAML

```yaml
coreToolGrants:
  - tool: core.app-operations.complete
    scope: write
  # 長寿命 job callback token が必要な場合のみ:
  - tool: core.tokens.issueJobCallback
    scope: write
```

Callback は app backend から Core origin へ送ります。Bearer value は original invocation の `x-sota-core-token` header で受け取った delegated capability です。

コード

```
POST /v1/app-operations/app-defined-globally-unique-id/complete
Authorization: Bearer <delegated-token>
Content-Type: application/json

{
  "status": "completed",
  "result": { "events": [] }
}
```

Failure は任意の `error` と `status: "failed"` で返します。Completion は original tool result に atomic に結び付き、同じ agent run が続きます。Parallel call は個別 operation id を持ち、その step の全 call が settle 後に model が続行します。

JSON

```json
{
  "status": "failed",
  "error": {
    "code": "ACTION_NOT_COMPLETED",
    "message": "The requested action was not completed"
  }
}
```

- `core.app-operations.complete:write` を grant します。
- Operation id は trim 済み 1–200 文字で、tool call ごとに globally unique。Identical retry は idempotent です。
- 登録は deferred response 受信後なので `app_operation_not_found` を bounded backoff で retry します。
- 60 秒 delegation token より長い場合、original invocation が valid な間に job callback token へ交換し、安全に保存して `x-sota-job-id` を送ります。
- `data` は小さく secret を含めません。Core には opaque でも client-visible であり、app UI で shape を narrow します。
- 現在の primitive は live run に結び付きます。Stop／steer は pending operation を `operation_cancelled` にします。App expiry は failed completion で表現し、background job queue として使いません。
