feat: Serverless Functions as AI Tools (#16919)

## Summary

This PR enables serverless functions to be exposed as AI tools, allowing
them to be used by AI agents.

### Changes

- Added new `SERVERLESS_FUNCTION` tool category
- Added `toolDescription`, `toolInputSchema`, and `toolOutputSchema`
fields to serverless functions
- Created database migration for the new schema columns
- Added tool index query and resolver for fetching available tools
- Added Settings AI page tabs (Skills, Tools, Settings) with new tools
table
- Added utility to convert tool schema to JSON schema format
- Updated frontend to display tools in the settings page

### Implementation Details

- Serverless functions can now define tool metadata (description,
input/output schemas)
- These functions are automatically registered in the tool registry
- The tool index endpoint allows querying available tools with their
schemas
- Settings page now has a dedicated Tools tab showing all available
tools
This commit is contained in:
Félix Malfait
2026-01-05 11:13:06 +01:00
committed by GitHub
parent c0d71f7f96
commit 0173e40a20
76 changed files with 2137 additions and 1304 deletions
@@ -116,7 +116,13 @@ export const useWorkflowAiAgentPermissionActions = ({
},
});
await refetchAgentAndRoles();
const { refetchedAgent } = await refetchAgentAndRoles();
// Update Recoil state with the refetched agent to ensure roleId is available
// Apollo's onCompleted is not called on refetch, so we need to update manually
if (isDefined(refetchedAgent)) {
setWorkflowAiAgentActionAgent(refetchedAgent);
}
return generatedRoleId;
};
@@ -294,7 +300,6 @@ export const useWorkflowAiAgentPermissionActions = ({
return;
}
const hadRoleBefore = isDefined(roleId);
const ensuredRoleId = await ensureRoleId();
if (!ensuredRoleId || permissionFlagKeys.includes(permissionFlagKey)) {
@@ -310,14 +315,7 @@ export const useWorkflowAiAgentPermissionActions = ({
},
});
const { refetchedAgent } = await refetchAgentAndRoles();
if (
!hadRoleBefore &&
isDefined(refetchedAgent) &&
isDefined(setWorkflowAiAgentActionAgent)
) {
setWorkflowAiAgentActionAgent(refetchedAgent);
}
await refetchAgentAndRoles();
setWorkflowAiAgentPermissionsIsAddingPermission(false);
setWorkflowAiAgentPermissionsSelectedObjectId(undefined);
};