Header menu logo Nao

ConversationContextRender Module

Render recent conversation transcript for a spawned async agent. An async agent runs in a brand-new sub-session that shares none of the parent conversation's history, so without this a follow-up like "convert it to html" arrives with no idea what "it" is. We surface the recent turns (and any attachment names, which are usually the subject of the follow-up) so the agent can resolve the reference.

Functions and values

Function or value Description

recentTranscript maxMessages messages

Full Usage: recentTranscript maxMessages messages

Parameters:
Returns: string

The last `maxMessages` messages rendered as "Role: content [attached: a, b]" lines. Returns "" when there is no prior history.

maxMessages : int
messages : MessageRecord seq
Returns: string

withHistory maxMessages messages input

Full Usage: withHistory maxMessages messages input

Parameters:
Returns: string

Prefix `input` with the recent transcript so the agent has conversational context. When there is no prior history the input is returned unchanged.

maxMessages : int
messages : MessageRecord seq
input : string
Returns: string

Type something to start searching.