What are Frontend Actions?
Frontend Actions allow your AI agent to trigger client-side behaviors in your application. Instead of just responding with text, the agent can initiate UI interactions—opening modals, navigating to pages, showing notifications, or calling custom functions in your app.How Frontend Actions Work
When the agent determines a frontend action should be triggered, it invokes the action as a tool call. Your client application receives this via the SDK’s real-time events. The tool call events include the trigger function identifier and any parameters, which your app interprets and executes.Adding a Frontend Action
- In Agent Builder, open the Tools section.
- Switch to the Frontend Actions tab.
- Click + Add Frontend Action.
- Configure the action:
- Name* – display name for the action (e.g., “Open Settings Modal”)
- Description* – explain what the action does so the agent knows when to use it
- Trigger Function* – the function or method identifier your client app will handle (e.g.,
openSettingsModal) - Parameters – optional parameters the action accepts
- Save to register the action.
Using Frontend Actions
Enable/Disable per Agent
Each frontend action has a toggle to enable or disable it for the current agent. Once enabled, the agent can use the action based on its description—even without explicit mention in instructions.Referencing in Instructions (Optional)
While enabled actions are automatically available to the agent, you can reference them in instructions to provide additional context about when to use them. This helps the agent make better decisions, especially when:- Multiple actions could apply to similar situations
- You want to specify exact conditions for triggering an action
- The action description alone may not capture all nuances
- Type
@in the Instructions Editor. - Navigate to the Frontend Actions category.
- Select an action to insert a reference.
@action:triggerFunctionName (e.g., @action:openModal)
You can also copy the syntax from the Frontend Actions list and paste it directly into the Instructions Editor.
Registering Frontend Actions
To handle these tool calls, register your action handlers with the UIKit component. Create a mapping of action names to callback functions, where each key matches a trigger function defined in your agent’s configuration, and each value is a function that executes when that action is invoked. Pass this mapping to the message list or AI assistant chat component using theaiAssistantTools property (or equivalent setter method depending on your platform). When the agent triggers a tool call, UIKit automatically routes it to your registered handler, passing along any arguments the agent provided.
This approach lets you:
- Dynamically update UI elements based on agent decisions
- Trigger navigation, modals, or other app-specific behaviors
- Execute business logic in response to conversational context
Common Use Cases
- Navigation – guide users to specific pages or sections
- Modals/Dialogs – open forms, confirmations, or detail views
- Notifications – display success messages or alerts
- Form Actions – pre-fill forms or trigger submissions
- UI State – toggle sidebars, expand sections, or change views
Orphaned Actions
If a frontend action is deleted, renamed, or disabled after being referenced in instructions, it will display with a warning indicator. Update your instructions to use the correct action name or remove the orphaned reference.Best Practices
- Write clear descriptions so the agent understands when to trigger each action.
- Use consistent naming conventions for trigger functions across your app.
- Handle missing or invalid parameters gracefully in your client code.
- Test actions in the Test console to verify the agent triggers them appropriately.
- Keep the number of actions manageable—too many options can confuse the agent’s decision-making.