Skip to content

Commit 39e1108

Browse files
committed
feat: add agentcore-cli User-Agent to all API calls
1 parent 27c47ca commit 39e1108

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';
@@ -28,6 +29,7 @@ function createAgentCoreClient(region: string, headers?: Record<string, string>)
2829
const client = new BedrockAgentCoreClient({
2930
region,
3031
credentials: getCredentialProvider(),
32+
customUserAgent: [['agentcore-cli', PACKAGE_VERSION]],
3133
...(endpoint && { endpoint }),
3234
});
3335

@@ -473,6 +475,7 @@ export async function evaluate(options: EvaluateOptions): Promise<EvaluateResult
473475
const client = new BedrockAgentCoreClient({
474476
region: options.region,
475477
credentials: getCredentialProvider(),
478+
customUserAgent: [['agentcore-cli', PACKAGE_VERSION]],
476479
});
477480

478481
const evaluationTarget = options.targetSpanIds
@@ -1066,6 +1069,7 @@ export async function stopRuntimeSession(options: StopRuntimeSessionOptions): Pr
10661069
const client = new BedrockAgentCoreClient({
10671070
region: options.region,
10681071
credentials: getCredentialProvider(),
1072+
customUserAgent: [['agentcore-cli', PACKAGE_VERSION]],
10691073
});
10701074

10711075
const command = new StopRuntimeSessionCommand({

0 commit comments

Comments
 (0)