Skip to main content

Tenant Context

Tenant context enables B2B2C (Business-to-Business-to-Consumer) integrations. Pass tenant information with work orders to track usage, route webhooks, and attribute costs to your end users.

Understanding B2B2C

In the B2B2C model:
  • AgentGate is the first B (we provide the platform)
  • Your Platform is the second B (you build products with AgentGate)
  • End Users are the C (your customers use your product)
Tenant context connects actions to the end users in your platform.

What Is Tenant Context

Tenant context is metadata that travels with work orders:

Tenant Context Fields

All fields are optional, but providing them enables usage tracking and attribution.

Tenant ID

Identifies the organization or account in your system:
Use cases:
  • Billing aggregation by customer
  • Usage limits per tenant
  • Tenant-specific webhooks

Tenant User ID

Identifies the specific end user:
Use cases:
  • Per-user usage tracking
  • User-level rate limiting
  • Audit trails

Metadata

Custom information for your use:
Metadata is passed through to webhooks and available in usage reports.

Passing Tenant Context

Include tenant context when creating work orders:

Tenant Context in Webhooks

Webhooks include tenant context, enabling you to route notifications:

Webhook Routing

Use tenant context to route webhooks to tenant-specific endpoints:

Usage Attribution

Tenant context enables usage tracking and billing:

Query Usage by Tenant

Response:

Billing Integration

Use usage data to bill your customers:

Best Practices

Consistent Tenant IDs

Use consistent, stable identifiers:

Metadata Guidelines

Include useful context in metadata:

Privacy Considerations

Don’t include personally identifiable information (PII) in tenant context unless necessary. Use opaque identifiers when possible.

Credits

Track and manage credit usage

Webhooks

Receive tenant-aware notifications