Skip to main content

Integration Patterns

This guide covers common patterns for integrating AgentGate into your applications, from simple to production-ready.

Basic Integration

The simplest integration pattern uses polling to check run status.

Flow

  1. Submit work order
  2. Poll for status
  3. Handle result

Implementation

When to Use

  • Development and testing
  • Simple scripts
  • Low-volume usage

Limitations

  • Wastes API calls
  • Delays between status changes
  • Not scalable

Webhook-Driven Integration

The recommended pattern for production uses webhooks.

Flow

  1. Submit work order
  2. Return immediately
  3. Receive webhook on completion
  4. Process result asynchronously

Implementation

When to Use

  • Production applications
  • Any volume of requests
  • Real-time user notifications

Queue-Based Integration

For high-volume or reliability-critical systems, use a message queue.

Flow

  1. User request → Queue work order job
  2. Worker submits to AgentGate
  3. Webhook → Queue result job
  4. Worker processes result

Architecture

Implementation

When to Use

  • High-volume applications
  • Reliability-critical systems
  • Complex workflows
  • Multiple downstream systems

Multi-Tenant Integration

For B2B2C platforms serving multiple customers.

Flow

  1. Identify tenant from request
  2. Include tenant context in work order
  3. Route webhook to tenant
  4. Attribute usage to tenant

Implementation

Error Handling Patterns

Retry with Backoff

Graceful Degradation

Choosing a Pattern

Start with webhook-driven integration. Add queue infrastructure when you need guaranteed delivery or high scale.

Webhooks

Set up webhook endpoints

Error Handling

Handle errors gracefully