Skip to main content

ActionRegistrar

Agent Runtimes


Agent Runtimes / components/hooks/useTools / ActionRegistrar

Function: ActionRegistrar()

ActionRegistrar<TArgs, TResult>(__namedParameters): null

Defined in: hooks/useTools.tsx:198

Component to register a single action/tool Used with useFrontendTool for compatibility with existing patterns

Type Parameters

TArgs

TArgs = Record<string, unknown>

TResult

TResult = unknown

Parameters

__namedParameters

action

{ description: string; handler?: (args) => Promise<TResult>; location?: ToolLocation; name: string; parameters: ToolParameter[]; render?: (props) => ReactNode; renderAndWaitForResponse?: (props) => ReactNode; }

action.description

string

action.handler?

(args) => Promise<TResult>

action.location?

ToolLocation

action.name

string

action.parameters

ToolParameter[]

action.render?

(props) => ReactNode

action.renderAndWaitForResponse?

(props) => ReactNode

useFrontendTool

UseFrontendToolFn

Returns

null

Example

{actions.map((action, i) => (
<ActionRegistrar
key={action.name || i}
action={action}
useFrontendTool={useFrontendTool}
/>
))}