AIPart
AI Parts represent discrete chunks of data sent by Puck AI. They are produced via generate’s onPart callback.
Types
A part is an object with a type, each with a different shape:
data-tool-status: What the agent is doingdata-client-request: Something the agent needs answereddata-page: The final page. Always the last partdata-build-op: A change to the page
data-tool-status
| Param | Example | Type |
|---|---|---|
type | type: "data-tool-status" | ”data-tool-status” |
data.toolCallId | toolCallId: "call_abc123" | String |
data.status | status: { label: "Updating page", loading: true } | ToolStatus |
ToolStatus
| Param | Example | Type |
|---|---|---|
label | label: "Updating page" | String |
loading | loading: true | Boolean |
summary | summary: "Added a hero" | String? |
error | error: { message: "..." } | Object? |
data-client-request
A request for data from the agent.
| Param | Example | Type |
|---|---|---|
type | type: "data-client-request" | ”data-client-request” |
data.requestId | requestId: "creq_123" | String |
data.action | action: "takeScreenshot" | "getPageData" | "takeScreenshot" |
data.params | params: { putUrl: "https://..." } | Object |
getPageData
A request for the current page data. This allows the model to make further adjustments if the page has changed since the request was first made.
Takes the shape:
| Param | Example | Type |
|---|---|---|
id | id: "current" | String |
Respond with Data.
takeScreenshot
A request for a screenshot of the page. Takes the shape:
| Param | Example | Type |
|---|---|---|
putUrl | putUrl: "https://..." | String |
Upload the screenshot to the URL using the PUT method, then respond with:
| Param | Example | Type | Status |
|---|---|---|---|
sizeBytes | sizeBytes: 1024 | Number | Required |
For example:
{ "sizeBytes": 1024 }data-page
The final page. Always the last part.
| Param | Example | Type |
|---|---|---|
type | type: "data-page" | ”data-page” |
data | data: { root: {}, content: [] } | Data |
data-build-op
A change to the page. Pass it to applyPart() to apply the change to a page in Puck.
| Param | Example | Type |
|---|---|---|
type | type: "data-build-op" | ”data-build-op” |
data | data: {} | Object |