Expand description
Per-tenant configuration for multi-tenant A2A servers.
PerTenantConfig allows operators to differentiate service levels across
tenants by setting per-tenant timeouts, capacity limits, rate limits, and
other resource constraints.
§Fairness under shared process-wide caps
Per-tenant limits bound what each tenant may use; they do not reserve
capacity. Process-wide resources — the event-queue manager’s
max_concurrent_queues, handler sweep thresholds, and the tenant-partition
cap of the tenant store wrappers — are shared pools, so a tenant running at
its own limit can still exhaust a shared pool and cause other tenants’
requests to be rejected as overloaded. Set per-tenant
max_concurrent_tasks so that the sum across active tenants stays within
the process-wide caps if noisy-neighbor isolation matters for your
deployment. Data isolation is unaffected — it is enforced per-partition
regardless of these limits.
§Example
use std::time::Duration;
use a2a_protocol_server::tenant_config::{PerTenantConfig, TenantLimits};
let config = PerTenantConfig::builder()
.default_limits(TenantLimits::builder()
.max_concurrent_tasks(100)
.rate_limit_rps(50)
.build())
.with_override("premium-corp", TenantLimits::builder()
.max_concurrent_tasks(1000)
.executor_timeout(Duration::from_secs(120))
.rate_limit_rps(500)
.build())
.build();
// "premium-corp" gets premium limits:
assert_eq!(config.get("premium-corp").max_concurrent_tasks, Some(1000));
// Unknown tenants get defaults:
assert_eq!(config.get("unknown").max_concurrent_tasks, Some(100));Structs§
- PerTenant
Config - Per-tenant configuration for timeouts, capacity limits, and executor selection.
- PerTenant
Config Builder - Builder for
PerTenantConfig. - Tenant
Limits - Resource limits and configuration for a single tenant.
- Tenant
Limits Builder - Builder for
TenantLimits.