Loading AgentsKit ecosystem navigation…
AgentsKit Chat
Components

File attachment

Named file with mime, size, and optional URL. Component key `file-attachment`.

View canonical Markdown

File attachment

file-attachment surfaces a file in the transcript: name, mime type, optional size, optional open URL. Emits open with the URL when present.

Live preview

File attachment
Named file with mime type, size, and optional open URL.
file-attachment
report.pdfapplication/pdf1024 bytesOpen

Demos use docs host CSS. Package primitives are intentionally unstyled so your product theme owns the look.

When to use

  • Generated reports, exports, or uploaded artifacts
  • When the host should open/download on click

Prefer something else when

  • Generic external links → link-card
  • Multi-file citations → source-list

Props (schema)

FieldTypeNotes
namestringFile name
mimeTypestringMIME type
sizeBytesint ≥ 0?Optional size
urlportable URL?If set, open/download affordance

Frame example

code
{
  "protocol": "agentskit.chat.component",
  "version": 1,
  "type": "render",
  "componentKey": "file-attachment",
  "instanceId": "file-attachment-fixture",
  "props": {
    "name": "report.pdf",
    "mimeType": "application/pdf",
    "sizeBytes": 1024,
    "url": "/report.pdf"
  },
  "fallback": {
    "kind": "file-attachment",
    "summary": "Attached report.pdf."
  }
}

Events

EventValueMeaning
openurlURL opened (when url is set)

Host wiring

code
import { FileAttachmentComponent, defineComponentManifest, defineChat } from '@agentskit/chat'
import { AgentChat } from '@agentskit/chat/react'

const definition = defineChat({
  id: 'app',
  components: defineComponentManifest([FileAttachmentComponent]),
  chat: { adapter },
})

export function App() {
  return (
    <AgentChat
      definition={definition}
      onComponentInteract={(event) => {
        // event === 'open'; value is url
        // { type: 'interact', componentKey: 'file-attachment', instanceId, event: 'open', value: url }
      }}
    />
  )
}

For agents

FieldValue
componentKeyfile-attachment
ExportFileAttachmentComponent
Protocolagentskit.chat.component v1
Envelopetype: "render" + instanceId + props + fallback
Eventsopen (url)
Host callbackonComponentInteract
Event shapetype always interact; event is open; value is url
FallbackAlways include fallback.kind + fallback.summary

Do not invent props or events outside the schema. Unknown keys and invalid props stay inert.

Shells

ShellNotes
React / Vue / Svelte / Solid / AngularSame frame; replaceable slots
React NativeAccessibility roles from the catalog definition
InkTerminal-safe fallback when interactive chrome is limited