|
| 1 | +--- |
| 2 | +title: A2A Metadata and Extension Reference |
| 3 | +description: Reference the canonical A2A metadata keys and versioned extensions that Kagent supports. |
| 4 | +weight: 15 |
| 5 | +author: kagent.dev |
| 6 | +--- |
| 7 | + |
| 8 | +## Metadata |
| 9 | + |
| 10 | +A2A metadata is a set of key-value pairs on A2A elements that allows the A2A |
| 11 | +protocol to carry extra information. |
| 12 | + |
| 13 | +Kagent runtime adapters translate metadata that a harness produces into |
| 14 | +canonical Kagent metadata keys and discard metadata that they cannot translate. |
| 15 | +Although these metadata semantics and formats are stable unless otherwise |
| 16 | +noted, Kagent depends on individual harnesses to produce them. Harnesses that |
| 17 | +the Kagent project does not own might emit different metadata across versions. |
| 18 | +The [kagent harness]({{< link path="agents/agent-harness#kagent-harness" >}}) |
| 19 | +is owned by the Kagent project, and its emitted metadata is stable across |
| 20 | +versions. |
| 21 | + |
| 22 | +### `kagent.dev/a2a/timeline-position` |
| 23 | + |
| 24 | +**A2A element:** Message or artifact. |
| 25 | + |
| 26 | +An RFC 3339 timestamp that orders task history. |
| 27 | + |
| 28 | +### `kagent.dev/a2a/task-created-at` |
| 29 | + |
| 30 | +**A2A element:** Task. |
| 31 | + |
| 32 | +An RFC 3339 timestamp that records when the task was created. |
| 33 | + |
| 34 | +### `kagent.dev/a2a/part-type` |
| 35 | + |
| 36 | +**A2A element:** Data part. |
| 37 | + |
| 38 | +Identifies the semantic kind of a data part. The value depends on the runtime |
| 39 | +adapter. The supported values are: |
| 40 | + |
| 41 | +* `function_call` - The name and arguments of a function call. |
| 42 | +* `function_response` - The return value of a function call. |
| 43 | +* `executable_code` - A piece of code to execute. |
| 44 | +* `code_execution_result` - The result of a code execution. |
| 45 | + |
| 46 | +The [kagent harness]({{< link path="agents/agent-harness#kagent-harness" >}}) |
| 47 | +recognizes `function_call` and `function_response`. |
| 48 | + |
| 49 | +### `kagent.dev/a2a/usage` |
| 50 | + |
| 51 | +**A2A element:** Task event. |
| 52 | + |
| 53 | +Best-effort model usage reporting for one response when the runtime reports it. |
| 54 | +The format of this value is harness-specific and may change in the future. For |
| 55 | +normalized, task-lifetime usage totals, use the [token-usage extension](#token-usage). |
| 56 | + |
| 57 | +The [kagent harness]({{< link path="agents/agent-harness#kagent-harness" >}}) |
| 58 | +reports the following camelCase metadata for a single model response: |
| 59 | + |
| 60 | +```json |
| 61 | +{ |
| 62 | + "kagent.dev/a2a/usage": { |
| 63 | + "promptTokenCount": 1300, |
| 64 | + "candidatesTokenCount": 210, |
| 65 | + "thoughtsTokenCount": 40, |
| 66 | + "cachedContentTokenCount": 800, |
| 67 | + "totalTokenCount": 1550 |
| 68 | + } |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +### `kagent.dev/a2a/output-schema-sha256` |
| 73 | + |
| 74 | +**A2A element:** Result part. |
| 75 | + |
| 76 | +Binds a structured result to the SHA-256 digest of its compiled output schema. |
| 77 | +Consumers can use the digest to identify the schema of the result. |
| 78 | + |
| 79 | +### `kagent.dev/a2a/thought` |
| 80 | + |
| 81 | +**A2A element:** Text part. |
| 82 | + |
| 83 | +A boolean that indicates the text contains model reasoning rather than the |
| 84 | +model's answer. |
| 85 | + |
| 86 | +## A2A extensions |
| 87 | + |
| 88 | +[A2A extensions](https://a2a-protocol.org/latest/topics/extensions/) add |
| 89 | +semantics that the core A2A protocol does not define. Agents advertise |
| 90 | +extensions in their Agent Cards. Harness support varies by extension. |
| 91 | + |
| 92 | +### Human in the loop |
| 93 | + |
| 94 | +The human-in-the-loop (HITL) extension lets an agent pause a task for a |
| 95 | +person's decision and resume the same operation. See |
| 96 | +[Human in the loop]({{< link path="agents/human-in-the-loop" >}}). |
| 97 | + |
| 98 | +### Token usage |
| 99 | + |
| 100 | +The token-usage extension reports task-lifetime token usage. Its URI is: |
| 101 | + |
| 102 | +```text |
| 103 | +https://kagent.dev/extensions/usage/v1 |
| 104 | +``` |
| 105 | + |
| 106 | +The [kagent harness]({{< link path="agents/agent-harness#kagent-harness" >}}) |
| 107 | +advertises this optional extension when it supports usage reporting. The |
| 108 | +payload is stored under the extension URI in the metadata of the status update |
| 109 | +that ends an execution: `completed`, |
| 110 | +`input-required`, `failed`, or `canceled`. When a client reads the persisted |
| 111 | +task later, it finds the same payload in the task's metadata. The key is |
| 112 | +omitted when no model call reported usage. |
| 113 | + |
| 114 | +```json |
| 115 | +{ |
| 116 | + "id": "my-task", |
| 117 | + "contextId": "my-context", |
| 118 | + "status": { |
| 119 | + "state": "completed", |
| 120 | + "timestamp": "2026-10-30T19:10:00Z" |
| 121 | + }, |
| 122 | + "metadata": { |
| 123 | + "https://kagent.dev/extensions/usage/v1": { |
| 124 | + "inputTokens": 1300, |
| 125 | + "outputTokens": 210, |
| 126 | + "reasoningTokens": 40, |
| 127 | + "cachedInputTokens": 800, |
| 128 | + "totalTokens": 1550, |
| 129 | + "models": [ |
| 130 | + { |
| 131 | + "model": "gpt-4o-2024-11-20", |
| 132 | + "inputTokens": 1000, |
| 133 | + "outputTokens": 150, |
| 134 | + "reasoningTokens": 40, |
| 135 | + "cachedInputTokens": 800, |
| 136 | + "totalTokens": 1190 |
| 137 | + } |
| 138 | + ] |
| 139 | + } |
| 140 | + } |
| 141 | +} |
| 142 | +``` |
| 143 | + |
| 144 | +| Field | Meaning | |
| 145 | +| --- | --- | |
| 146 | +| `inputTokens` | Prompt tokens sent to the model. | |
| 147 | +| `outputTokens` | Generated tokens, excluding reasoning tokens. | |
| 148 | +| `reasoningTokens` | Reasoning tokens, when the provider reports them. | |
| 149 | +| `cachedInputTokens` | Provider-cached input tokens; a subset of `inputTokens`. | |
| 150 | +| `totalTokens` | The provider-reported total, or the sum of input, output, and reasoning tokens when the provider reports no total. | |
| 151 | +| `models` | The same counts per model, ordered by model name. | |
0 commit comments