Skip to content

Commit 223b6cd

Browse files
committed
feat: add agentcore-cli User-Agent to all API calls
1 parent 933bac8 commit 223b6cd

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/cli/aws/agentcore-control.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { EvaluationLevel } from '../../schema/schemas/primitives/evaluator';
2+
import { PACKAGE_VERSION } from '../constants';
23
import { getCredentialProvider } from './account';
34
import {
45
BedrockAgentCoreControlClient,
@@ -23,6 +24,7 @@ export function createControlClient(region: string): BedrockAgentCoreControlClie
2324
return new BedrockAgentCoreControlClient({
2425
region,
2526
credentials: getCredentialProvider(),
27+
customUserAgent: [['agentcore-cli', PACKAGE_VERSION]],
2628
});
2729
}
2830

src/cli/aws/agentcore.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { parseJsonRpcResponse } from '../../lib/utils/json-rpc';
2+
import { PACKAGE_VERSION } from '../constants';
23
import { getCredentialProvider } from './account';
34
import { parseAguiSSEStream } from './agui-parser';
45
import { serviceEndpoint } from './partition';
@@ -20,6 +21,7 @@ function createAgentCoreClient(region: string, headers?: Record<string, string>)
2021
const client = new BedrockAgentCoreClient({
2122
region,
2223
credentials: getCredentialProvider(),
24+
customUserAgent: [['agentcore-cli', PACKAGE_VERSION]],
2325
});
2426

2527
if (headers && Object.keys(headers).length > 0) {
@@ -464,6 +466,7 @@ export async function evaluate(options: EvaluateOptions): Promise<EvaluateResult
464466
const client = new BedrockAgentCoreClient({
465467
region: options.region,
466468
credentials: getCredentialProvider(),
469+
customUserAgent: [['agentcore-cli', PACKAGE_VERSION]],
467470
});
468471

469472
const evaluationTarget = options.targetSpanIds
@@ -1057,6 +1060,7 @@ export async function stopRuntimeSession(options: StopRuntimeSessionOptions): Pr
10571060
const client = new BedrockAgentCoreClient({
10581061
region: options.region,
10591062
credentials: getCredentialProvider(),
1063+
customUserAgent: [['agentcore-cli', PACKAGE_VERSION]],
10601064
});
10611065

10621066
const command = new StopRuntimeSessionCommand({

0 commit comments

Comments
 (0)