@@ -270,6 +270,22 @@ export interface BaseGenerationOptions extends Partial<CallSettings> {
270270 userId ?: string ;
271271 conversationId ?: string ;
272272 tenantId ?: string ;
273+ /**
274+ * Optional key metadata for per-key rate limits.
275+ */
276+ apiKeyId ?: string ;
277+ /**
278+ * Optional region metadata for per-region rate limits.
279+ */
280+ region ?: string ;
281+ /**
282+ * Optional endpoint metadata for per-endpoint rate limits.
283+ */
284+ endpoint ?: string ;
285+ /**
286+ * Optional tenant tier metadata for per-tier rate limits.
287+ */
288+ tenantTier ?: string ;
273289 context ?: ContextInput ;
274290 elicitation ?: ( request : unknown ) => Promise < unknown > ;
275291 /**
@@ -2336,6 +2352,10 @@ export class Agent {
23362352 const startTimeDate = new Date ( ) ;
23372353 const priority = this . resolveTrafficPriority ( options ) ;
23382354 const tenantId = this . resolveTenantId ( options ) ;
2355+ const apiKeyId = options ?. apiKeyId ?? options ?. parentOperationContext ?. apiKeyId ;
2356+ const region = options ?. region ?? options ?. parentOperationContext ?. region ;
2357+ const endpoint = options ?. endpoint ?? options ?. parentOperationContext ?. endpoint ;
2358+ const tenantTier = options ?. tenantTier ?? options ?. parentOperationContext ?. tenantTier ;
23392359
23402360 // Prefer reusing an existing context instance to preserve reference across calls/subagents
23412361 const runtimeContext = toContextMap ( options ?. context ) ;
@@ -2445,6 +2465,10 @@ export class Agent {
24452465 userId : options ?. userId ,
24462466 conversationId : options ?. conversationId ,
24472467 tenantId,
2468+ apiKeyId,
2469+ region,
2470+ endpoint,
2471+ tenantTier,
24482472 parentAgentId : options ?. parentAgentId ,
24492473 traceContext,
24502474 startTime : startTimeDate ,
@@ -4152,6 +4176,10 @@ export class Agent {
41524176 this . resolveProvider ( this . model ) ??
41534177 undefined ;
41544178 const priority = this . resolveTrafficPriority ( options ) ;
4179+ const apiKeyId = options ?. apiKeyId ?? options ?. parentOperationContext ?. apiKeyId ;
4180+ const region = options ?. region ?? options ?. parentOperationContext ?. region ;
4181+ const endpoint = options ?. endpoint ?? options ?. parentOperationContext ?. endpoint ;
4182+ const tenantTier = options ?. tenantTier ?? options ?. parentOperationContext ?. tenantTier ;
41554183
41564184 return {
41574185 agentId : this . id , // Identify which agent issued the request
@@ -4160,6 +4188,10 @@ export class Agent {
41604188 provider, // Allows per-provider throttling later
41614189 priority,
41624190 tenantId : this . resolveTenantId ( options ) ,
4191+ apiKeyId,
4192+ region,
4193+ endpoint,
4194+ tenantTier,
41634195 taskType : options ?. taskType ,
41644196 fallbackPolicyId : options ?. fallbackPolicyId ,
41654197 } ;
0 commit comments