Take complete control over the Cloud Coding API by scripting your AI agent’s exact behavior. Custom messages let you define precise conversation flows, control tool usage, and create powerful development workflows that adapt to your specific needs.
New to Cloud Coding API? Start with prebuilt templates for quick results, then return here when you need complete control over AI behavior.
{ "content": "Your instruction for the AI agent", "tools": "all", // or ["Read", "Edit", "Bash"] "continueConversation": true, // Continue previous context "workingDir": "./src/components" // Focus on specific directory}
Critical Limitation: You cannot change workingDir and use continueConversation: true in the same request. When changing directories, you must start a fresh conversation (omit continueConversation or set it to false).
curl -X POST "https://api.cloudcoding.ai/invoke" \ -H "Content-Type: application/json" \ -H "x-api-key: your_api_key" \ -d '{ "messages": [ { "tools": ["Task", "Read", "LS"], "content": "Analyze this project and create a detailed plan for setting up a CI/CD pipeline" }, { "tools": "all", "content": "Implement the CI/CD pipeline based on the analysis and plan", "continueConversation": true } ], "repo_url": "https://github.com/username/deployment-project", "github_token": "ghp_...", "branch": "cicd-setup", "haiku": false }'
Important: This example shows an incorrect pattern. You cannot change workingDir and use continueConversation: true. Each directory requires a separate API call.
Focus the agent on specific parts of your codebase using separate API calls:
# ❌ INCORRECT - Will not work as expectedcurl -X POST "https://api.cloudcoding.ai/invoke" \ -H "Content-Type: application/json" \ -H "x-api-key: your_api_key" \ -d '{ "messages": [ { "tools": "all", "content": "Convert React components to TypeScript", "workingDir": "./src/components" }, { "tools": "all", "content": "Update hooks to TypeScript", "workingDir": "./src/hooks", "continueConversation": true // ❌ This will fail! } ] }'# ✅ CORRECT - Separate API calls for each directory# Call 1: Componentscurl -X POST "https://api.cloudcoding.ai/invoke" \ -H "Content-Type: application/json" \ -H "x-api-key: your_api_key" \ -d '{ "messages": [ { "tools": "all", "content": "Convert all React components to TypeScript with proper prop types", "workingDir": "./src/components" } ], "repo_url": "https://github.com/username/typescript-migration", "github_token": "ghp_...", "branch": "typescript-conversion", "haiku": false }'# Call 2: Hookscurl -X POST "https://api.cloudcoding.ai/invoke" \ -H "Content-Type: application/json" \ -H "x-api-key: your_api_key" \ -d '{ "messages": [ { "tools": "all", "content": "Update the custom hooks to use TypeScript interfaces", "workingDir": "./src/hooks" } ], "repo_url": "https://github.com/username/typescript-migration", "github_token": "ghp_...", "branch": "typescript-conversion", "haiku": false }'# Call 3: Utilscurl -X POST "https://api.cloudcoding.ai/invoke" \ -H "Content-Type: application/json" \ -H "x-api-key: your_api_key" \ -d '{ "messages": [ { "tools": "all", "content": "Add TypeScript types to the utility functions", "workingDir": "./src/utils" } ], "repo_url": "https://github.com/username/typescript-migration", "github_token": "ghp_...", "branch": "typescript-conversion", "haiku": false }'
Use continueConversation: true to maintain context across messages:
{ "messages": [ { "content": "Create a comprehensive user authentication system with JWT tokens" }, { "content": "Now add password reset functionality to the authentication system we just created", "continueConversation": true }, { "content": "Finally, implement two-factor authentication as an additional security layer", "continueConversation": true } ]}
Use workingDir to focus the agent on specific parts of your repository:
Note: The example below shows an incorrect pattern - you cannot change workingDir and use continueConversation: true together.
// ❌ INCORRECT - This will not work{ "messages": [ { "content": "Optimize all database queries in this directory", "workingDir": "./backend/database" }, { "content": "Update the API routes to use the optimized queries", "workingDir": "./backend/routes", "continueConversation": true // ❌ Will fail with directory change } ]}// ✅ CORRECT - Use separate API calls// First call:{ "messages": [ { "content": "Optimize all database queries in this directory", "workingDir": "./backend/database" } ]}// Second call:{ "messages": [ { "content": "Update the API routes to use the optimized queries from the database directory", "workingDir": "./backend/routes" } ]}
// ❌ This will NOT work - will fail or behave unexpectedly{ "messages": [ { "workingDir": "./frontend", "content": "Update React components" }, { "workingDir": "./backend", "content": "Now update the API", "continueConversation": true // ❌ FAILS with directory change } ]}
Separate API calls (cannot use continueConversation)
TypeScript migration per directory
Critical Pattern Limitation: Multi-directory workflows must use separate API calls. You cannot change workingDir and use continueConversation: true in the same request. This is a system-level constraint, not a documentation suggestion.
Directory focusing - Use workingDir for targeted development
Complex workflows - Combine all features for powerful automation
Pro Tip
Custom messages give you the power to script any development workflow. Start simple and gradually build more sophisticated automation as you learn the patterns.