---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/llm/transformers_js/helpers/functions/renderArtifactHandleBody.md
---

# Function: renderArtifactHandleBody()

```ts
function renderArtifactHandleBody(input: {
  artifact: unknown;
  byteLength: number;
  callId: string;
  encoding?: string;
  estimatedTokens?: number;
  lineCount: number;
}): string;
```

Defined in: [src/batteries/llm/chat\_common/helpers.ts:394](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/llm/chat_common/helpers.ts#L394)

Render the "handle" body for a spooled-artifact tool result that the producer marked
`inline: false`: a directions-bearing text block telling the model the result was NOT inlined (to
preserve context budget) and exactly which forged `artifact_*` tools to call — with this
`callId` — to read it incrementally.

## Parameters

| Parameter                | Type                                                                                                                                                 |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `input`                  | { `artifact`: `unknown`; `byteLength`: `number`; `callId`: `string`; `encoding?`: `string`; `estimatedTokens?`: `number`; `lineCount`: `number`; } |
| `input.artifact`         | `unknown`                                                                                                                                            |
| `input.byteLength`       | `number`                                                                                                                                             |
| `input.callId`           | `string`                                                                                                                                             |
| `input.encoding?`        | `string`                                                                                                                                             |
| `input.estimatedTokens?` | `number`                                                                                                                                             |
| `input.lineCount`        | `number`                                                                                                                                             |

## Returns

`string`

## Remarks

This is THE machinery that makes the spool/thrift pattern usable by the model: a large tool result
(a tool catalog, a search-hit set, a scraped doc) stays out of the prompt, and the model pulls only
the slices it needs via `artifact_json_get`/`artifact_grep`/etc. Without it the adapter would either
dump the whole body (defeating the purpose) or hand the model an opaque artifact it cannot read.
Shared verbatim across the OpenAI, Ollama, transformers.js, and LiteRT-LM batteries so the model
sees the SAME contract regardless of backend. The `toolMethods` list is read off the artifact's
constructor (each SpooledArtifact subclass advertises its own query tools).
