Package:
@hexos/react-coreReturn type of the useAgent hook, providing full agent interaction controls and state.
Exposes the message history (including the live streaming message), send/edit/regenerate functions, streaming state, active agent info, handoff history, and pending tool approvals.
interface UseAgentReturn {
messages: AgentMessage[];
sendMessage: (content: string, attachments?: Attachment[]) => Promise<void>;
isStreaming: boolean;
activeAgent: string | null;
error: Error | null;
clearError: () => void;
reset: () => void;
stop: () => void;
regenerate: () => Promise<void>;
editMessage: (messageId: string, newContent: string) => Promise<void>;
conversationId: string | null;
handoffHistory: HandoffEvent[];
lastHandoff: HandoffEvent | null;
pendingApprovals: ToolApprovalRequest[];
}messages
sendMessage
(content: string, attachments?: Attachment[]) => PromiseisStreaming
booleanactiveAgent
string | nullerror
Error | nullclearError
() => voidreset
() => voidstop
() => voidregenerate
() => PromiseeditMessage
(messageId: string, newContent: string) => PromiseconversationId
string | nullhandoffHistory
lastHandoff
HandoffEvent | null