Actions
Overview
Once an action is authored and published in Agent Studio, developers must implement the handler code that executes the action in your application.
The agent routes user intent → your handler runs business logic → results return to the agent.
1. Accessing Actions
- Pull action definitions and schemas via the Foldspace SDK.
- Use MCP integrations (VS Code, Cursor, Windsurf) for autocompletion and schema-aware development.
➡ See: Vibe Coding
2. Implementing Handlers
Each action requires a handler function in your frontend codebase.
- Accepts the action’s input parameters from the schema.
- Executes your business logic (API calls, DB updates, navigation, etc.).
- Returns output or error to the agent.
3. Example Flow
- Publish Action in Agent Studio →
createUserwith schema (email,organizationRoleType). - Trigger → User says: “Invite Sarah as an account manager”.
- Agent → Calls
createUserwith extracted parameters. - Handler → Your code executes backend API call.
- Response → Agent confirms success in conversation.
4. Code Examples
Choose the example that matches how your action should behave:
-
Execute (Text-only) Action
For actions that only return text responses (e.g., “Create Task”, “Send Reminder”). -
Execute and Render Action
For actions that return and render UI components (cards, forms, tables) alongside the agent’s response.
5. Testing
- Run local dev mode with MCP to stub or mock actions.
- Validate schema updates in the SDK.
- Add unit tests for handlers to ensure reliability.
6. Deployment & Rollout
- Wrap actions in feature flags for safe rollout.
- Monitor telemetry: success/failure, latency.
- Keep code handlers backward-compatible with multiple action versions.
Developer Checklist ✅
- Pull action schemas via SDK or MCP
- Implement handler functions for each action
- Test locally with mocks
- Deploy behind feature flag
- Monitor action telemetry
Related Guides
Updated 7 months ago