Overview
The Generate Workflow endpoint uses GPT-4o to automatically create complete workflows from natural language descriptions. This is one of Agility’s most powerful features, allowing users to describe their automation needs in plain English and receive a fully structured workflow.Endpoint
Authentication
Requires a valid Supabase JWT token in the Authorization header:Request
Request Body
Natural language description of the desired workflow. Describe what you want to automate, including the services and actions involved.Examples:
- “Read emails from Gmail, summarize them with AI, and send summaries to Discord”
- “Monitor GitHub commits and generate release notes using GPT-4”
- “Automatically respond to support emails with AI-generated responses”
Example Request
Response
Success Response (200)
The generated workflow structure
Example Response
Error Responses
400 Bad Request
Returned when the prompt is missing or invalid:401 Unauthorized
Returned when authentication fails:500 Internal Server Error
Returned when workflow generation fails:How It Works
- AI Processing: Your prompt is sent to GPT-4o with instructions about available agents
- Agent Matching: The AI selects appropriate agents from the 5 available types
- Linear Flow: Agents are arranged in a left-to-right linear sequence
- Auto-Positioning: Elements are automatically positioned on the canvas with proper spacing
- Connection Creation: Connections are created between adjacent agents
Available Agents
The AI can only use these 5 agents when generating workflows:- Text Generator - AI-powered text generation
- Gmail Sender - Send emails via Gmail
- Gmail Reader - Read emails from Gmail
- Discord Messenger - Send Discord messages
- GitHub Reader - Monitor GitHub repositories
Workflow Constraints
Generated workflows are linear (start to finish, left to right) and use 3-7 agents maximum for optimal usability.
Configuration Required
After generating a workflow:- Each agent must be individually configured with credentials
- Prompts and parameters need to be customized
- Connections can be adjusted if needed
- Test each agent before running the full workflow
Environment Requirements
Usage in Agility UI
This endpoint is called when users:- Type a workflow description in the AI generation input
- Click the “Generate Workflow” button
- The generated workflow appears on the canvas ready for configuration
Best Practices
- Be Specific: Include service names (Gmail, Discord, GitHub) in your prompt
- Describe Actions: Use verbs like “read”, “send”, “generate”, “monitor”
- Linear Flow: Describe workflows as sequential steps
- Keep it Simple: Focus on 3-5 main steps for best results
Example Prompts
Email Automation
Email Automation
“Read support emails from Gmail, generate AI responses using GPT-4, and send replies back via Gmail”
DevOps Notifications
DevOps Notifications
“Monitor GitHub commits, summarize changes with AI, and post updates to Discord”
Content Pipeline
Content Pipeline
“Generate blog content using AI and send it to my email for review”