Skip to content

Commit 48dadfd

Browse files
refactor(schema): remove type fields from resource schemas and rename credential discriminator (#709)
- Remove `type` field from agent, memory, evaluator, online-eval-config schemas - Rename credential discriminator from `type` to `authorizerType` - Remove `modelProvider` from agent env schema - Update all source files, tests, and generated JSON schema - Regenerate agentcore.schema.v1.json Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c1c41ca commit 48dadfd

File tree

62 files changed

+172
-286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+172
-286
lines changed

integ-tests/add-agent-auth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('integration: add BYO agent with CUSTOM_JWT auth', () => {
116116
// Verify OAuth credential was auto-created
117117
const oauthCred = config.credentials.find(c => c.name === `${agent2}-oauth`);
118118
expect(oauthCred, 'OAuth credential should be auto-created').toBeTruthy();
119-
expect(oauthCred!.type).toBe('OAuthCredentialProvider');
119+
expect(oauthCred!.authorizerType).toBe('OAuthCredentialProvider');
120120
expect((oauthCred as { managed?: boolean }).managed).toBe(true);
121121

122122
// Verify .env.local has client secrets (namespaced per credential)

schemas/agentcore.schema.v1.json

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
"items": {
4242
"type": "object",
4343
"properties": {
44-
"type": {
45-
"type": "string",
46-
"const": "AgentCoreRuntime"
47-
},
4844
"name": {
4945
"type": "string",
5046
"minLength": 1,
@@ -134,10 +130,6 @@
134130
},
135131
"additionalProperties": false
136132
},
137-
"modelProvider": {
138-
"type": "string",
139-
"enum": ["Bedrock", "Gemini", "OpenAI", "Anthropic"]
140-
},
141133
"protocol": {
142134
"type": "string",
143135
"enum": ["HTTP", "MCP", "A2A"]
@@ -277,7 +269,7 @@
277269
"additionalProperties": false
278270
}
279271
},
280-
"required": ["type", "name", "build", "entrypoint", "codeLocation", "runtimeVersion"],
272+
"required": ["name", "build", "entrypoint", "codeLocation", "runtimeVersion"],
281273
"additionalProperties": false
282274
}
283275
},
@@ -287,10 +279,6 @@
287279
"items": {
288280
"type": "object",
289281
"properties": {
290-
"type": {
291-
"type": "string",
292-
"const": "AgentCoreMemory"
293-
},
294282
"name": {
295283
"type": "string",
296284
"minLength": 1,
@@ -310,7 +298,7 @@
310298
"properties": {
311299
"type": {
312300
"type": "string",
313-
"enum": ["SEMANTIC", "SUMMARIZATION", "USER_PREFERENCE", "EPISODIC"]
301+
"enum": ["SEMANTIC", "SUMMARIZATION", "USER_PREFERENCE", "EPISODIC", "CUSTOM"]
314302
},
315303
"name": {
316304
"type": "string",
@@ -332,6 +320,44 @@
332320
"items": {
333321
"type": "string"
334322
}
323+
},
324+
"semanticOverride": {
325+
"type": "object",
326+
"properties": {
327+
"extraction": {
328+
"type": "object",
329+
"properties": {
330+
"appendToPrompt": {
331+
"type": "string",
332+
"minLength": 1,
333+
"maxLength": 30000
334+
},
335+
"modelId": {
336+
"type": "string",
337+
"minLength": 1
338+
}
339+
},
340+
"required": ["appendToPrompt", "modelId"],
341+
"additionalProperties": false
342+
},
343+
"consolidation": {
344+
"type": "object",
345+
"properties": {
346+
"appendToPrompt": {
347+
"type": "string",
348+
"minLength": 1,
349+
"maxLength": 30000
350+
},
351+
"modelId": {
352+
"type": "string",
353+
"minLength": 1
354+
}
355+
},
356+
"required": ["appendToPrompt", "modelId"],
357+
"additionalProperties": false
358+
}
359+
},
360+
"additionalProperties": false
335361
}
336362
},
337363
"required": ["type"],
@@ -353,7 +379,7 @@
353379
}
354380
}
355381
},
356-
"required": ["type", "name", "eventExpiryDuration"],
382+
"required": ["name", "eventExpiryDuration"],
357383
"additionalProperties": false
358384
}
359385
},
@@ -365,32 +391,32 @@
365391
{
366392
"type": "object",
367393
"properties": {
368-
"type": {
394+
"authorizerType": {
369395
"type": "string",
370396
"const": "ApiKeyCredentialProvider"
371397
},
372398
"name": {
373399
"type": "string",
374-
"minLength": 3,
375-
"maxLength": 255,
376-
"pattern": "^[A-Za-z0-9_.-]+$"
400+
"minLength": 1,
401+
"maxLength": 128,
402+
"pattern": "^[a-zA-Z0-9\\-_]+$"
377403
}
378404
},
379-
"required": ["type", "name"],
405+
"required": ["authorizerType", "name"],
380406
"additionalProperties": false
381407
},
382408
{
383409
"type": "object",
384410
"properties": {
385-
"type": {
411+
"authorizerType": {
386412
"type": "string",
387413
"const": "OAuthCredentialProvider"
388414
},
389415
"name": {
390416
"type": "string",
391-
"minLength": 3,
392-
"maxLength": 255,
393-
"pattern": "^[A-Za-z0-9_.-]+$"
417+
"minLength": 1,
418+
"maxLength": 128,
419+
"pattern": "^[a-zA-Z0-9\\-_]+$"
394420
},
395421
"discoveryUrl": {
396422
"type": "string",
@@ -414,7 +440,7 @@
414440
"enum": ["inbound", "outbound"]
415441
}
416442
},
417-
"required": ["type", "name"],
443+
"required": ["authorizerType", "name"],
418444
"additionalProperties": false
419445
}
420446
]
@@ -426,10 +452,6 @@
426452
"items": {
427453
"type": "object",
428454
"properties": {
429-
"type": {
430-
"type": "string",
431-
"const": "CustomEvaluator"
432-
},
433455
"name": {
434456
"type": "string",
435457
"minLength": 1,
@@ -527,7 +549,7 @@
527549
}
528550
}
529551
},
530-
"required": ["type", "name", "level", "config"],
552+
"required": ["name", "level", "config"],
531553
"additionalProperties": false
532554
}
533555
},
@@ -537,10 +559,6 @@
537559
"items": {
538560
"type": "object",
539561
"properties": {
540-
"type": {
541-
"type": "string",
542-
"const": "OnlineEvaluationConfig"
543-
},
544562
"name": {
545563
"type": "string",
546564
"minLength": 1,
@@ -586,7 +604,7 @@
586604
}
587605
}
588606
},
589-
"required": ["type", "name", "agent", "evaluators", "samplingRate"],
607+
"required": ["name", "agent", "evaluators", "samplingRate"],
590608
"additionalProperties": false
591609
}
592610
},

src/cli/commands/add/__tests__/add-gateway.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ describe('add gateway command', () => {
197197
// Verify managed OAuth credential in agentcore.json
198198
const credential = projectSpec.credentials.find((c: { name: string }) => c.name === `${gatewayName}-oauth`);
199199
expect(credential, 'Managed OAuth credential should exist').toBeTruthy();
200-
expect(credential.type).toBe('OAuthCredentialProvider');
200+
expect(credential.authorizerType).toBe('OAuthCredentialProvider');
201201
expect(credential.managed).toBe(true);
202202
expect(credential.usage).toBe('inbound');
203203
});

src/cli/commands/add/__tests__/add-identity.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('add credential command', () => {
6161
const projectSpec = JSON.parse(await readFile(join(projectDir, 'agentcore/agentcore.json'), 'utf-8'));
6262
const credential = projectSpec.credentials.find((c: { name: string }) => c.name === identityName);
6363
expect(credential, 'Credential should be in project credentials').toBeTruthy();
64-
expect(credential.type).toBe('ApiKeyCredentialProvider');
64+
expect(credential.authorizerType).toBe('ApiKeyCredentialProvider');
6565
});
6666
});
6767

@@ -98,7 +98,7 @@ describe('add credential command', () => {
9898
const projectSpec = JSON.parse(await readFile(join(projectDir, 'agentcore/agentcore.json'), 'utf-8'));
9999
const credential = projectSpec.credentials.find((c: { name: string }) => c.name === identityName);
100100
expect(credential, 'Credential should be in project credentials').toBeTruthy();
101-
expect(credential.type).toBe('OAuthCredentialProvider');
101+
expect(credential.authorizerType).toBe('OAuthCredentialProvider');
102102
expect(credential.discoveryUrl).toBe('https://idp.example.com/.well-known/openid-configuration');
103103
expect(credential.vendor).toBe('CustomOauth2');
104104
expect(credential.scopes).toEqual(['read', 'write']);

src/cli/commands/add/__tests__/add-memory.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('add memory command', () => {
8282
const projectSpec = JSON.parse(await readFile(join(projectDir, 'agentcore/agentcore.json'), 'utf-8'));
8383
const memory = projectSpec.memories.find((m: { name: string }) => m.name === memoryName);
8484
expect(memory, 'Memory should be in project memories').toBeTruthy();
85-
expect(memory.type).toBe('AgentCoreMemory');
85+
expect(memory).toBeTruthy();
8686
});
8787

8888
it('creates memory with multiple strategies', async () => {

src/cli/commands/dev/command.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,6 @@ export const registerDev = (program: Command) => {
183183
if (protocol === 'A2A') invokePort = 9000;
184184
else if (protocol === 'MCP') invokePort = 8000;
185185

186-
// Show model info if available (not applicable to MCP)
187-
if (protocol !== 'MCP' && targetAgent?.modelProvider) {
188-
console.log(`Provider: ${targetAgent.modelProvider}`);
189-
}
190-
191186
// Protocol-aware dispatch
192187
if (protocol === 'MCP') {
193188
await handleMcpInvoke(invokePort, opts.invoke, opts.tool, opts.input, headers);
@@ -270,8 +265,7 @@ export const registerDev = (program: Command) => {
270265
}
271266

272267
// Get provider info from agent config
273-
const targetAgent = project.agents.find(a => a.name === config.agentName);
274-
const providerInfo = targetAgent?.modelProvider ?? '(see agent code)';
268+
const providerInfo = '(see agent code)';
275269

276270
console.log(`Starting dev server...`);
277271
console.log(`Agent: ${config.agentName}`);

src/cli/commands/import/__tests__/fixtures/cli-project-with-agent-and-memory.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"version": 1,
44
"agents": [
55
{
6-
"type": "AgentCoreRuntime",
76
"name": "existing_agent",
87
"build": "CodeZip",
98
"entrypoint": "main.py",
@@ -18,7 +17,6 @@
1817
],
1918
"memories": [
2019
{
21-
"type": "AgentCoreMemory",
2220
"name": "existing_agent_memory",
2321
"eventExpiryDuration": 30,
2422
"strategies": [
@@ -30,7 +28,7 @@
3028
],
3129
"credentials": [
3230
{
33-
"type": "ApiKeyCredentialProvider",
31+
"authorizerType": "ApiKeyCredentialProvider",
3432
"name": "my_api_key"
3533
}
3634
],

src/cli/commands/import/__tests__/idempotency.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ function makeProjectSpec(agents: { name: string }[] = [], memories: { name: stri
176176
name: 'TestProject',
177177
version: 1,
178178
agents: agents.map(a => ({
179-
type: 'AgentCoreRuntime',
180179
name: a.name,
181180
build: 'CodeZip',
182181
entrypoint: 'main.py',
@@ -187,7 +186,6 @@ function makeProjectSpec(agents: { name: string }[] = [], memories: { name: stri
187186
instrumentation: { enableOtel: true },
188187
})),
189188
memories: memories.map(m => ({
190-
type: 'AgentCoreMemory',
191189
name: m.name,
192190
eventExpiryDuration: 30,
193191
strategies: [{ type: 'SEMANTIC' }],
@@ -529,7 +527,7 @@ describe('Import Idempotency (Test Group 7)', () => {
529527
);
530528

531529
const existingSpec = makeProjectSpec();
532-
(existingSpec as any).credentials = [{ type: 'ApiKeyCredentialProvider', name: 'my-cred' }];
530+
(existingSpec as any).credentials = [{ authorizerType: 'ApiKeyCredentialProvider', name: 'my-cred' }];
533531
mockConfigIOInstance.readProjectSpec.mockResolvedValue(existingSpec);
534532

535533
const progressMessages: string[] = [];

src/cli/commands/import/__tests__/import-memory.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ function toMemorySpec(mem: ParsedStarterToolkitMemory): Memory {
3737
}
3838

3939
return {
40-
type: 'AgentCoreMemory',
4140
name: mem.name,
4241
eventExpiryDuration: Math.max(7, Math.min(365, mem.eventExpiryDays)),
4342
strategies,
@@ -367,7 +366,6 @@ describe('toMemorySpec', () => {
367366

368367
const result = toMemorySpec(mem);
369368

370-
expect(result.type).toBe('AgentCoreMemory');
371369
expect(result.name).toBe('test_memory');
372370
expect(result.eventExpiryDuration).toBe(30);
373371
expect(result.strategies).toHaveLength(3);
@@ -384,7 +382,6 @@ describe('toMemorySpec', () => {
384382

385383
const result = toMemorySpec(mem);
386384

387-
expect(result.type).toBe('AgentCoreMemory');
388385
expect(result.name).toBe('stm_memory');
389386
expect(result.eventExpiryDuration).toBe(14);
390387
expect(result.strategies).toHaveLength(0);
@@ -505,7 +502,6 @@ describe('Memory Merge Logic', () => {
505502
it('skips existing memories by name', () => {
506503
const existingMemories: Memory[] = [
507504
{
508-
type: 'AgentCoreMemory',
509505
name: 'existing_memory',
510506
eventExpiryDuration: 30,
511507
strategies: [{ type: 'SEMANTIC' }],

src/cli/commands/import/__tests__/import-no-deploy.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,6 @@ agents:
557557
const writtenSpec = mockWriteProjectSpec.mock.calls[0]![0];
558558
expect(writtenSpec.memories).toHaveLength(1);
559559
expect(writtenSpec.memories[0].name).toBe('test_agent_memory');
560-
expect(writtenSpec.memories[0].type).toBe('AgentCoreMemory');
561560
});
562561

563562
it('does NOT call CDK build/synth operations', async () => {

0 commit comments

Comments
 (0)