Best Practices
Follow these guidelines to get the best results from AgentGate.Task Prompt Engineering
The task prompt is the most important factor in run success.Be Specific
- Good
- Bad
Provide Context
Include relevant background information:Define Acceptance Criteria
State what success looks like:Specify Constraints
Mention what to avoid:Workspace Optimization
Keep Repositories Focused
Smaller is Better
Smaller is Better
Large repositories take longer to clone and may hit size limits. Consider:
- Using sparse checkout for monorepos
- Excluding large binaries
- Removing unnecessary history
Use Templates for Common Setups
Use Templates for Common Setups
If you frequently start from scratch, create organization templates with:
- Standard project structure
- Common dependencies pre-installed
- Build and test configuration
Ensure Reproducibility
- Use lock files:
package-lock.json,poetry.lock, etc. - Pin versions: Avoid
latesttags in dependencies - Document environment: Include required environment variables
Configure for Automation
Ensure your workspace works without human interaction:- Tests run headlessly (no browser popups)
- Builds complete without prompts
- No required user input during setup
Cost Optimization
Right-Size Iteration Limits
| Task Type | Suggested Limit |
|---|---|
| Simple changes | 3-5 iterations |
| Medium complexity | 5-10 iterations |
| Complex refactors | 10-15 iterations |
Use Appropriate Verification
Match verification level to task needs:- Quick prototypes: L0 only
- Bug fixes: L0 + L1
- Production features: All levels
Break Down Complex Tasks
Instead of one complex work order:Security Considerations
API Key Management
- Use environment variables
- Rotate keys periodically
- Use minimum necessary scopes
- Different keys for different environments
Webhook Security
Always verify webhook signatures:Credential Handling
When work orders need credentials (private repos, APIs):- Configure credentials in AgentGate dashboard
- Use environment variables in workspaces
- Never include credentials in task prompts
Performance Tips
Use Webhooks
Webhooks are more efficient than polling:| Approach | API Calls per Run |
|---|---|
| Polling (5s interval, 5min run) | 60 calls |
| Webhooks | 1 callback |
Concurrent Work Orders
AgentGate can run multiple work orders in parallel. For batch operations:Webhook Processing
Process webhooks asynchronously to avoid timeouts:Monitoring and Observability
Track Key Metrics
- Success rate: Runs succeeded / total runs
- Convergence speed: Average iterations to success
- Cost per task: Credits used / tasks completed
- Webhook latency: Time from completion to processing
Set Up Alerts
Log for Debugging
Include correlation IDs for tracing:Common Pitfalls
Vague Task Prompts
Vague Task Prompts
Problem: “Make the code better”Solution: Be specific about what “better” means—faster, more readable, more secure, etc.
Missing Test Coverage
Missing Test Coverage
Problem: No tests to verify changesSolution: Include test requirements in prompts, or ensure existing tests cover the modified code.
Ignoring Verification Failures
Ignoring Verification Failures
Problem: High iteration counts indicate verification issuesSolution: Review failed runs to understand what’s failing and improve prompts or fix underlying issues.
Not Using Tenant Context
Not Using Tenant Context
Problem: Can’t attribute usage in B2B2C scenariosSolution: Always include tenant context for multi-tenant applications.