Client-Side Action
Ask code on your embedding page to run a named client-side action and return a result to the agent.
Client-Side Action connects an agent to a function that your embedding page owns. Configure an action name and a description. The description tells the model when to call the action. Add typed parameters: string, number, or boolean. The configuration dialog generates an example that uses window.agentstack.registerTools(...). Register a matching handler in the parent page. Make the handler return a JSON-serializable result.
When the agent calls the action, the widget asks the embedding page to run the registered handler. The host site owns the side effect and the result. AgentStack's server does not own them. The widget validates required parameters before it sends the request. The widget waits only a limited time for the host response. Design the handler to fail clearly and to protect any privileged client-side behavior. Do not assume that the handler has generic browser permissions or that a host result is guaranteed.
Client-Side Action is high-risk. Client-Side Action works only in widget chat. It does not work in email, Slack, or REST flows. If action approval is enabled in widget chat, visitors must confirm the action before it runs. MCP does not filter out Client-Side Action. An MCP client can still receive this action, but it cannot run the client-side handler. Test the action on the real embedding page. Playground and other contexts cannot prove that your host handler is registered correctly.