Compose API
End-to-end workflow generation and execution API
The Compose API is the main entry point for AI-powered workflow generation. It handles everything from understanding your request to generating and optionally executing workflows.
Overview
The compose()
method provides a unified interface for:
- Natural language to workflow transformation
- Automatic validation and refinement
- Optional execution with streaming
- Multiple output formats (JSON, YAML, streaming)
HTTP Endpoint
Request Body
The task description in natural language. Be specific and include requirements.
Examples:
- “Create a workflow to backup PostgreSQL databases daily”
- “Deploy a containerized app to Kubernetes with health checks”
- “Set up CI/CD pipeline for Python project with tests”
Additional context to guide workflow generation.
Execution parameters (only used in act
mode).
Operation mode:
"plan"
: Generate workflow only"act"
: Generate and execute workflow
Enable streaming response. When true
, returns Server-Sent Events.
Streaming format:
"sse"
: Server-Sent Events format"vercel"
: Vercel AI SDK formatnull
: Raw ADK events
Session ID for conversation continuity. Automatically generated if not provided.
User ID for namespacing and tracking. Defaults to "default_user"
.
Response Format
Usage Examples
Streaming Examples
Event Types
When streaming is enabled, various event types are emitted:
Error Handling
The compose API handles various error scenarios:
Advanced Configuration
Custom Models
Performance Tuning
Custom Filters
Integration Examples
FastAPI Endpoint
WebSocket Streaming
Best Practices
Be Specific
Provide detailed task descriptions for better results
Use Context
Include relevant context about your environment
Handle Errors
Always implement proper error handling
Monitor Usage
Track token usage and generation times