Defining a Custom Action
A custom action requires three things:- type: A descriptive name for the action
- actionParams: A Zod schema describing the parameters
- run: A function that executes the action
Using Custom Actions
Pass custom actions when creating the agent:Real-World Example: Web Search
Integrate with a search API like Exa:Action Context
TheActionContext provides access to:
Action Output
Return anActionOutput object:
Multiple Custom Actions
Combine multiple actions for complex workflows:Next Steps
MCP Integration
Connect to MCP servers for more tools
page.ai()
Learn about task execution