Skip to main content

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

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

Large repositories take longer to clone and may hit size limits. Consider:
  • Using sparse checkout for monorepos
  • Excluding large binaries
  • Removing unnecessary history
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 latest tags 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

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:
Submit multiple focused work orders:

Security Considerations

API Key Management

Never commit API keys to source control.
  • 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:

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

Problem: “Make the code better”Solution: Be specific about what “better” means—faster, more readable, more secure, etc.
Problem: No tests to verify changesSolution: Include test requirements in prompts, or ensure existing tests cover the modified code.
Problem: High iteration counts indicate verification issuesSolution: Review failed runs to understand what’s failing and improve prompts or fix underlying issues.
Problem: Can’t attribute usage in B2B2C scenariosSolution: Always include tenant context for multi-tenant applications.

Integration Patterns

Common integration architectures

Error Handling

Handle errors gracefully