Skip to content

Commit 84bb49d

Browse files
jesseturner21claude
andcommitted
refactor(cli): rename --agent flags to --runtime across all commands
Rename CLI flags from agent terminology to runtime: - --agent <name> → --runtime <name> (with -a → -r short alias) - --agent-runtime-id → --runtime-id - --agent-arn → --runtime-arn - --agents → --runtimes (gateway primitive) Update resolveAgent() to accept { runtime?: string }. Update all action handlers, option types, error messages, and tests. Keep --agent-id and --agent-alias-id unchanged (Bedrock Agent IDs). Keep 'agentcore add agent' / 'agentcore remove agent' commands unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ad08cd9 commit 84bb49d

23 files changed

Lines changed: 87 additions & 81 deletions

File tree

src/cli/commands/add/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export interface AddGatewayOptions {
5757
customClaims?: string;
5858
clientId?: string;
5959
clientSecret?: string;
60+
runtimes?: string;
6061
semanticSearch?: boolean;
6162
exceptionLevel?: string;
6263
policyEngine?: string;

src/cli/commands/dev/__tests__/dev.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('dev command', () => {
88

99
expect(result.exitCode).toBe(0);
1010
expect(result.stdout.includes('--port'), 'Should show --port option').toBeTruthy();
11-
expect(result.stdout.includes('--agent'), 'Should show --agent option').toBeTruthy();
11+
expect(result.stdout.includes('--runtime'), 'Should show --runtime option').toBeTruthy();
1212
expect(result.stdout.includes('--invoke'), 'Should show --invoke option').toBeTruthy();
1313
expect(result.stdout.includes('--stream'), 'Should show --stream option').toBeTruthy();
1414
expect(result.stdout.includes('--logs'), 'Should show --logs option').toBeTruthy();

src/cli/commands/dev/command.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ export const registerDev = (program: Command) => {
138138
.alias('d')
139139
.description(COMMAND_DESCRIPTIONS.dev)
140140
.option('-p, --port <port>', 'Port for development server', '8080')
141-
.option('-a, --agent <name>', 'Agent to run or invoke (required if multiple agents)')
142-
.option('-i, --invoke <prompt>', 'Invoke running dev server (use --agent if multiple) [non-interactive]')
141+
.option('-r, --runtime <name>', 'Runtime to run or invoke (required if multiple runtimes)')
142+
.option('-i, --invoke <prompt>', 'Invoke running dev server (use --runtime if multiple) [non-interactive]')
143143
.option('-s, --stream', 'Stream response when using --invoke [non-interactive]')
144144
.option('-l, --logs', 'Run dev server with logs to stdout [non-interactive]')
145145
.option('--tool <name>', 'MCP tool name (used with --invoke call-tool) [non-interactive]')
@@ -167,12 +167,12 @@ export const registerDev = (program: Command) => {
167167
// Determine which agent/port to invoke
168168
let invokePort = port;
169169
let targetAgent = invokeProject?.runtimes[0];
170-
if (opts.agent && invokeProject) {
171-
invokePort = getAgentPort(invokeProject, opts.agent, port);
172-
targetAgent = invokeProject.runtimes.find(a => a.name === opts.agent);
173-
} else if (invokeProject && invokeProject.runtimes.length > 1 && !opts.agent) {
170+
if (opts.runtime && invokeProject) {
171+
invokePort = getAgentPort(invokeProject, opts.runtime, port);
172+
targetAgent = invokeProject.runtimes.find(a => a.name === opts.runtime);
173+
} else if (invokeProject && invokeProject.runtimes.length > 1 && !opts.runtime) {
174174
const names = invokeProject.runtimes.map(a => a.name).join(', ');
175-
console.error(`Error: Multiple agents found. Use --agent to specify which one.`);
175+
console.error(`Error: Multiple runtimes found. Use --runtime to specify which one.`);
176176
console.error(`Available: ${names}`);
177177
process.exit(1);
178178
}
@@ -210,7 +210,7 @@ export const registerDev = (program: Command) => {
210210
}
211211

212212
// Warn about VPC mode limitations in local dev
213-
const targetDevAgent = opts.agent ? project.runtimes.find(a => a.name === opts.agent) : project.runtimes[0];
213+
const targetDevAgent = opts.runtime ? project.runtimes.find(a => a.name === opts.runtime) : project.runtimes[0];
214214
if (targetDevAgent?.networkMode === 'VPC') {
215215
console.log(
216216
'\x1b[33mWarning: This agent uses VPC network mode. Local dev server runs outside your VPC. Network behavior may differ from deployed environment.\x1b[0m\n'
@@ -228,14 +228,14 @@ export const registerDev = (program: Command) => {
228228
// If --logs provided, run non-interactive mode
229229
if (opts.logs) {
230230
// Require --agent if multiple agents
231-
if (project.runtimes.length > 1 && !opts.agent) {
231+
if (project.runtimes.length > 1 && !opts.runtime) {
232232
const names = project.runtimes.map(a => a.name).join(', ');
233-
console.error(`Error: Multiple agents found. Use --agent to specify which one.`);
233+
console.error(`Error: Multiple runtimes found. Use --runtime to specify which one.`);
234234
console.error(`Available: ${names}`);
235235
process.exit(1);
236236
}
237237

238-
const agentName = opts.agent ?? project.runtimes[0]?.name;
238+
const agentName = opts.runtime ?? project.runtimes[0]?.name;
239239
const configRoot = findConfigRoot(workingDir);
240240
const envVars = configRoot ? await readEnvFile(configRoot) : {};
241241
const gatewayEnvVars = await getGatewayEnvVars();
@@ -325,7 +325,7 @@ export const registerDev = (program: Command) => {
325325
}}
326326
workingDir={workingDir}
327327
port={port}
328-
agentName={opts.agent}
328+
agentName={opts.runtime}
329329
headers={headers}
330330
/>
331331
</LayoutProvider>

src/cli/commands/eval/command.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ export const registerEval = (program: Command) => {
1313
evalCmd
1414
.command('history')
1515
.description('Show past on-demand eval run results saved locally')
16-
.option('-a, --agent <name>', 'Filter results by agent name')
16+
.option('-r, --runtime <name>', 'Filter results by runtime name')
1717
.option('-n, --limit <count>', 'Max number of runs to display')
1818
.option('--json', 'Output as JSON')
19-
.action((cliOptions: { agent?: string; limit?: string; json?: boolean }) => {
19+
.action((cliOptions: { runtime?: string; limit?: string; json?: boolean }) => {
2020
requireProject();
2121

2222
try {
2323
const result = handleListEvalRuns({
24-
agent: cliOptions.agent,
24+
agent: cliOptions.runtime,
2525
limit: cliOptions.limit ? parseInt(cliOptions.limit, 10) : undefined,
2626
json: cliOptions.json,
2727
});

src/cli/commands/help/command.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ FLAGS THAT TRIGGER CLI MODE
3434
--name, --json, --yes, --force, --target, --stream, etc.
3535
3636
Some flags work in both modes:
37-
--session-id (invoke), --port (dev), --agent (dev)
37+
--session-id (invoke), --port (dev), --runtime (dev)
3838
`;
3939

4040
export const registerHelp = (program: Command) => {

src/cli/commands/invoke/__tests__/invoke.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('invoke command', () => {
6161

6262
describe('agent validation', () => {
6363
it('rejects non-existent agent', async () => {
64-
const result = await runCLI(['invoke', 'hello', '--agent', 'nonexistent', '--json'], projectDir);
64+
const result = await runCLI(['invoke', 'hello', '--runtime', 'nonexistent', '--json'], projectDir);
6565
expect(result.exitCode).toBe(1);
6666
const json = JSON.parse(result.stdout);
6767
expect(json.success).toBe(false);
@@ -82,7 +82,7 @@ describe('invoke command', () => {
8282
});
8383

8484
it('--stream with invalid agent returns error', async () => {
85-
const result = await runCLI(['invoke', 'hello', '--stream', '--agent', 'nonexistent', '--json'], projectDir);
85+
const result = await runCLI(['invoke', 'hello', '--stream', '--runtime', 'nonexistent', '--json'], projectDir);
8686
expect(result.exitCode).toBe(1);
8787
const json = JSON.parse(result.stdout);
8888
expect(json.success).toBe(false);

src/cli/commands/invoke/action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export async function handleInvoke(context: InvokeContext, options: InvokeOption
6363
const agentNames = project.runtimes.map(a => a.name);
6464

6565
if (!options.agentName && project.runtimes.length > 1) {
66-
return { success: false, error: `Multiple agents found. Use --agent to specify one: ${agentNames.join(', ')}` };
66+
return { success: false, error: `Multiple runtimes found. Use --runtime to specify one: ${agentNames.join(', ')}` };
6767
}
6868

6969
const agentSpec = options.agentName ? project.runtimes.find(a => a.name === options.agentName) : project.runtimes[0];

src/cli/commands/invoke/command.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const registerInvoke = (program: Command) => {
9696
.description(COMMAND_DESCRIPTIONS.invoke)
9797
.argument('[prompt]', 'Prompt to send to the agent [non-interactive]')
9898
.option('--prompt <text>', 'Prompt to send to the agent [non-interactive]')
99-
.option('--agent <name>', 'Select specific agent [non-interactive]')
99+
.option('--runtime <name>', 'Select specific runtime [non-interactive]')
100100
.option('--target <name>', 'Select deployment target [non-interactive]')
101101
.option('--session-id <id>', 'Use specific session ID for conversation continuity')
102102
.option('--user-id <id>', 'User ID for runtime invocation (default: "default-user")')
@@ -116,7 +116,7 @@ export const registerInvoke = (program: Command) => {
116116
positionalPrompt: string | undefined,
117117
cliOptions: {
118118
prompt?: string;
119-
agent?: string;
119+
runtime?: string;
120120
target?: string;
121121
sessionId?: string;
122122
userId?: string;
@@ -145,13 +145,13 @@ export const registerInvoke = (program: Command) => {
145145
cliOptions.json ||
146146
cliOptions.target ||
147147
cliOptions.stream ||
148-
cliOptions.agent ||
148+
cliOptions.runtime ||
149149
cliOptions.tool ||
150150
cliOptions.bearerToken
151151
) {
152152
await handleInvokeCLI({
153153
prompt,
154-
agentName: cliOptions.agent,
154+
agentName: cliOptions.runtime,
155155
targetName: cliOptions.target ?? 'default',
156156
sessionId: cliOptions.sessionId,
157157
userId: cliOptions.userId,

src/cli/commands/logs/__tests__/action.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe('resolveAgentContext', () => {
126126
const result = resolveAgentContext(context, {});
127127
expect(result.success).toBe(false);
128128
if (!result.success) {
129-
expect(result.error).toContain('Multiple agents found');
129+
expect(result.error).toContain('Multiple runtimes found');
130130
expect(result.error).toContain('AgentA');
131131
expect(result.error).toContain('AgentB');
132132
}
@@ -184,7 +184,7 @@ describe('resolveAgentContext', () => {
184184
},
185185
},
186186
});
187-
const result = resolveAgentContext(context, { agent: 'AgentB' });
187+
const result = resolveAgentContext(context, { runtime: 'AgentB' });
188188
expect(result.success).toBe(true);
189189
if (result.success) {
190190
expect(result.agentContext.agentName).toBe('AgentB');
@@ -193,10 +193,10 @@ describe('resolveAgentContext', () => {
193193
});
194194

195195
it('errors for unknown agent name', () => {
196-
const result = resolveAgentContext(makeContext(), { agent: 'UnknownAgent' });
196+
const result = resolveAgentContext(makeContext(), { runtime: 'UnknownAgent' });
197197
expect(result.success).toBe(false);
198198
if (!result.success) {
199-
expect(result.error).toContain("Agent 'UnknownAgent' not found");
199+
expect(result.error).toContain("Runtime 'UnknownAgent' not found");
200200
}
201201
});
202202

@@ -218,7 +218,7 @@ describe('resolveAgentContext', () => {
218218
const result = resolveAgentContext(context, {});
219219
expect(result.success).toBe(false);
220220
if (!result.success) {
221-
expect(result.error).toContain('No agents defined');
221+
expect(result.error).toContain('No runtimes defined');
222222
}
223223
});
224224

src/cli/commands/logs/command.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Text, render } from 'ink';
1010
import React from 'react';
1111

1212
export const registerLogs = (program: Command) => {
13-
// enablePositionalOptions + passThroughOptions ensure options like --since and --agent
13+
// enablePositionalOptions + passThroughOptions ensure options like --since and --runtime
1414
// are passed to the 'evals' subcommand rather than being consumed by the parent 'logs' command.
1515
program.enablePositionalOptions();
1616

@@ -20,7 +20,7 @@ export const registerLogs = (program: Command) => {
2020
.enablePositionalOptions()
2121
.passThroughOptions()
2222
.description(COMMAND_DESCRIPTIONS.logs)
23-
.option('--agent <name>', 'Select specific agent')
23+
.option('--runtime <name>', 'Select specific runtime')
2424
.option('--since <time>', 'Start time — defaults to 1h ago in search mode (e.g. "1h", "30m", "2d", ISO 8601)')
2525
.option('--until <time>', 'End time — defaults to now in search mode (e.g. "now", ISO 8601)')
2626
.option('--level <level>', 'Filter by log level (error, warn, info, debug)')
@@ -46,7 +46,7 @@ export const registerLogs = (program: Command) => {
4646
logsCmd
4747
.command('evals')
4848
.description('Stream or search online eval logs')
49-
.option('-a, --agent <name>', 'Select specific agent')
49+
.option('-r, --runtime <name>', 'Select specific runtime')
5050
.option('--since <time>', 'Start time (e.g. "1h", "30m", "2d", ISO 8601)')
5151
.option('--until <time>', 'End time (e.g. "now", ISO 8601)')
5252
.option('-n, --limit <count>', 'Maximum number of log lines')

0 commit comments

Comments
 (0)