Skip to content

convertMessage

convertMessage(msg, allowedToolNames?, options?): BaseMessage

Defined in: _worktrees/docs-release/gaunt-sloth/packages/agent/src/modules/apiAgUiModule.ts:153

Convert AG-UI message format to LangChain BaseMessage.

allowedToolNames is the set of tool names bound to this run (config.tools + any run-input client tools). It gates EXT-35 plain-text tool-call repair on the assistant branch: an incoming assistant message with NO native toolCalls whose content is a STANDALONE text-emitted call (bracket / <function=…> / Harmony — the dialects small/local models produce) is promoted to a native tool_call so a replayed history turn is a real tool call rather than inert prose. An empty (or absent) allow-list promotes nothing — the prose-safe default. This runs alongside parseToolArguments (which rescues malformed args on an ALREADY-native tool_call).

EXT-43: options.allowTextCallPromotion (default true) lets a caller suppress promotion for a single message; convertMessages uses it to leave a DANGLING history call as text.

AgUiWireMessage

Set<string>

ConvertMessageOptions

BaseMessage