Configuration parameters for the navigation handler.
Configuration parameters for creating a navigation handler to a triage agent. Defines optional messages or functions to handle flush, execution, and tool output scenarios during navigation.
INavigateToTriageParams
Optional
executeMessage?: string | (clientId: string, defaultAgent: string) => string | Promise<string>Optional message or function to execute when no navigation is needed. If a function, it receives the client ID and default agent name, returning a string or promise of a string.
Optional
flushMessage?: string | (clientId: string, defaultAgent: string) => string | Promise<string>Optional message or function to emit after flushing the session. If a function, it receives the client ID and default agent name, returning a string or promise of a string.
Optional
lastMessage?: (Optional
toolOutputAccept?: string | (clientId: string, defaultAgent: string) => string | Promise<string>Optional message or function for tool output when navigation to the default agent occurs. If a function, it receives the client ID and default agent name, returning a string or promise of a string. Defaults to a message indicating successful navigation.
Optional
toolOutputReject?: string | (clientId: string, defaultAgent: string) => string | Promise<string>Optional message or function for tool output when already on the default agent. If a function, it receives the client ID and default agent name, returning a string or promise of a string. Defaults to a message indicating no navigation was needed.
A promise resolving to a function that handles navigation to the triage agent.
Creates a function to navigate to a triage agent for a specific client, handling navigation, message execution, and tool output. The factory generates a handler that checks navigation state, commits tool outputs with accept/reject messages, and triggers execution or emission based on provided parameters. It operates outside any existing method or execution contexts to ensure isolation, leveraging
beginContext
for a clean execution scope. Logs the navigation operation if logging is enabled in the global configuration.Throws
If neither
flushMessage
norexecuteMessage
is provided, or if any internal operation (e.g., navigation, commit, or execution) fails.Example
Example