Context API
ctx.input
ctx.input contains the current turn input that the host fetched for the strategy worker.
Shape
interface Input {
text: string
attachments: Attachment[]
}
interface Attachment {
id: string
name: string
size: number
modality: 'document' | 'image' | 'audio' | 'video'
mimeType?: string
}Fields
text
The textual content of the user message. If the user sends attachments without text, this will be an empty string.
attachments
A normalized list of uploaded assets associated with the current user turn.
Attachment Fields
- id – asset identifier used to reference the attachment in AfferLab APIs
- name – original file name
- size – file size in bytes
- modality – the attachment modality (document, image, audio, video)
- mimeType – MIME type
Usage
Strategies can pass the full user input directly into the prompt:
ctx.slots.add('input', ctx.input)This forwards both the message text and its attachments.
Strategies may also access specific fields when needed:
const text = ctx.input.text
const files = ctx.input.attachmentsNotes
ctx.input is read-only from the strategy point of view.
If a strategy wants to ingest new material into memory, that happens through ctx.memory.ingest(...), not by mutating ctx.input.