DocsReact CoretransportAgentConfig
Package: @hexos/react-core

Frontend configuration for connecting to an Hexos backend and customizing behavior.

Extends the base config with frontend-specific options: an approvalEndpoint for human-in-the-loop flows (defaults to endpoint + '/approve'), a systemMessage for client-side prompt, and an onToolApprovalRequired callback for programmatic approval handling.

The headers field supports both static objects and async functions for dynamic authentication (e.g., refreshing JWT tokens before each request).

Related: useAgent accepts this config, SSETransport uses it for connections, AgentProvider initializes atoms from this config.

interface AgentConfig {
    endpoint: string;
    approvalEndpoint?: string;
    agents?: string[];
    transport?: 'sse' | 'websocket' | 'fetch';
    headers?: Record<string, string> | (() => Promise<Record<string, string>>);
    conversationId?: string;
    systemMessage?: string;
    enableReasoning?: boolean;
    onToolApprovalRequired?: (request: ToolApprovalRequest) => Promise<boolean>;
}

endpoint

string

approvalEndpoint

string

agents

string[]

transport

'sse' | 'websocket' | 'fetch'

headers

Record | (() => Promise>)

conversationId

string

systemMessage

string

enableReasoning

boolean

onToolApprovalRequired

(request: ToolApprovalRequest) => Promise