Skip to content

Commit 94e010a

Browse files
authored
Bugfix/project base model required (#429)
* added base models required for projects * updated changeset * updated tests * updated quickstart
1 parent 7820571 commit 94e010a

File tree

10 files changed

+121
-6
lines changed

10 files changed

+121
-6
lines changed

.changeset/wise-signs-behave.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@inkeep/create-agents": patch
3+
"@inkeep/agents-core": patch
4+
"@inkeep/agents-manage-api": patch
5+
---
6+
7+
updated base model

agents-manage-api/src/__tests__/routes/crud/projectFull.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ describe('Project Full CRUD Routes - Integration Tests', () => {
131131
id: projectId,
132132
name: 'Minimal Project',
133133
description: 'Minimal test project',
134+
models: {
135+
base: {
136+
model: 'claude-sonnet-4',
137+
providerOptions: {},
138+
},
139+
},
134140
graphs: {},
135141
tools: {}, // Required field
136142
};

agents-manage-api/src/__tests__/routes/crud/projects.test.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ describe('Project CRUD Routes - Integration Tests', () => {
1212
id: `test-project${suffix.toLowerCase().replace(/\s+/g, '-')}-${nanoid(6)}`,
1313
name: `Test Project${suffix}`,
1414
description: `Test Description${suffix}`,
15+
models: {
16+
base: {
17+
model: 'claude-sonnet-4',
18+
providerOptions: {},
19+
},
20+
},
1521
});
1622

1723
// Helper function to create a project and return its ID
@@ -307,6 +313,12 @@ describe('Project CRUD Routes - Integration Tests', () => {
307313
body: JSON.stringify({
308314
id: 'test-id',
309315
description: 'Test description',
316+
models: {
317+
base: {
318+
model: 'claude-sonnet-4',
319+
providerOptions: {},
320+
},
321+
},
310322
}),
311323
});
312324
expect(res1.status).toBe(400);
@@ -317,6 +329,12 @@ describe('Project CRUD Routes - Integration Tests', () => {
317329
body: JSON.stringify({
318330
id: 'test-id',
319331
name: 'Test name',
332+
models: {
333+
base: {
334+
model: 'claude-sonnet-4',
335+
providerOptions: {},
336+
},
337+
},
320338
}),
321339
});
322340
expect(res2.status).toBe(400);
@@ -327,9 +345,43 @@ describe('Project CRUD Routes - Integration Tests', () => {
327345
body: JSON.stringify({
328346
name: 'Test name',
329347
description: 'Test description',
348+
models: {
349+
base: {
350+
model: 'claude-sonnet-4',
351+
providerOptions: {},
352+
},
353+
},
330354
}),
331355
});
332356
expect(res3.status).toBe(400);
357+
358+
// Missing models
359+
const res4 = await makeRequest(`/tenants/${tenantId}/projects`, {
360+
method: 'POST',
361+
body: JSON.stringify({
362+
id: 'test-id',
363+
name: 'Test name',
364+
description: 'Test description',
365+
}),
366+
});
367+
expect(res4.status).toBe(400);
368+
369+
// Missing base model within models
370+
const res5 = await makeRequest(`/tenants/${tenantId}/projects`, {
371+
method: 'POST',
372+
body: JSON.stringify({
373+
id: 'test-id',
374+
name: 'Test name',
375+
description: 'Test description',
376+
models: {
377+
structuredOutput: {
378+
model: 'claude-sonnet-4',
379+
providerOptions: {},
380+
},
381+
},
382+
}),
383+
});
384+
expect(res5.status).toBe(400);
333385
});
334386
});
335387

packages/agents-core/src/__tests__/data-access/projectFull.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ describe('projectFull data access', () => {
129129
id: projectId,
130130
name: 'Minimal Project',
131131
description: '',
132+
models: {
133+
base: {
134+
model: 'claude-sonnet-4',
135+
providerOptions: {},
136+
},
137+
},
132138
graphs: {},
133139
tools: {},
134140
createdAt: new Date().toISOString(),

packages/agents-core/src/__tests__/data-access/projects.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,12 @@ describe('Projects Data Access', () => {
611611
id: testProjectId1,
612612
name: 'New Project',
613613
description: 'A new test project',
614+
models: {
615+
base: {
616+
model: 'claude-sonnet-4',
617+
providerOptions: {},
618+
},
619+
},
614620
};
615621

616622
const expectedProject = {

packages/agents-core/src/__tests__/integration/data-access/tools.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ const createProjectData = ({ suffix = '' }: { suffix?: string } = {}) => {
2525
id: `test-project-${suffix}-${timestamp}-${randomId}`,
2626
name: `Test Project ${suffix}`,
2727
description: `Test project ${suffix} for tools integration tests`,
28+
models: {
29+
base: {
30+
model: 'claude-sonnet-4',
31+
providerOptions: {},
32+
},
33+
},
2834
};
2935
};
3036

packages/agents-core/src/__tests__/validation/fullProjectSchema.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ describe('FullProjectDefinitionSchema', () => {
66
id: 'test-project',
77
name: 'Test Project',
88
description: 'A test project for validation',
9+
models: {
10+
base: {
11+
model: 'claude-sonnet-4',
12+
providerOptions: {},
13+
},
14+
},
915
stopWhen: {
1016
transferCountIs: 10,
1117
stepCountIs: 50,
@@ -55,6 +61,12 @@ describe('FullProjectDefinitionSchema', () => {
5561
id: 'minimal-project',
5662
name: 'Minimal Project',
5763
description: '',
64+
models: {
65+
base: {
66+
model: 'claude-sonnet-4',
67+
providerOptions: {},
68+
},
69+
},
5870
graphs: {},
5971
tools: {},
6072
};
@@ -63,7 +75,7 @@ describe('FullProjectDefinitionSchema', () => {
6375
expect(result.success).toBe(true);
6476
});
6577

66-
it('should require id, name, graphs, and tools fields', () => {
78+
it('should require id, name, models, graphs, and tools fields', () => {
6779
const invalidProject = {
6880
description: 'Missing required fields',
6981
};
@@ -75,6 +87,7 @@ describe('FullProjectDefinitionSchema', () => {
7587
expect.arrayContaining([
7688
expect.objectContaining({ path: ['id'] }),
7789
expect.objectContaining({ path: ['name'] }),
90+
expect.objectContaining({ path: ['models'] }),
7891
expect.objectContaining({ path: ['graphs'] }),
7992
expect.objectContaining({ path: ['tools'] }),
8093
])
@@ -125,6 +138,12 @@ describe('FullProjectDefinitionSchema', () => {
125138
id: 'test-project',
126139
name: 'Test Project',
127140
description: 'A test project',
141+
models: {
142+
base: {
143+
model: 'claude-sonnet-4',
144+
providerOptions: {},
145+
},
146+
},
128147
graphs: {},
129148
tools: {},
130149
// credentialReferences omitted

packages/agents-core/src/data-access/projectFull.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,11 +976,18 @@ export const getFullProject =
976976
await Promise.all(graphPromises);
977977
}
978978

979+
// Ensure project has required models configuration
980+
if (!project.models) {
981+
throw new Error(
982+
`Project ${project.id} is missing required models configuration. Please update the project to include a base model.`
983+
);
984+
}
985+
979986
const fullProjectDefinition: FullProjectDefinition = {
980987
id: project.id,
981988
name: project.name,
982989
description: project.description,
983-
models: project.models || undefined,
990+
models: project.models,
984991
stopWhen: project.stopWhen || undefined,
985992
graphs,
986993
tools: projectTools,

packages/agents-core/src/validation/schemas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ export const RemovedResponseSchema = z.object({
709709
export const ProjectSelectSchema = createSelectSchema(projects);
710710
export const ProjectInsertSchema = createInsertSchema(projects)
711711
.extend({
712-
models: ProjectModelSchema.optional(),
712+
models: ProjectModelSchema,
713713
stopWhen: StopWhenSchema.optional(),
714714
})
715715
.omit({

packages/create-agents/src/utils.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ export const defaultAnthropicModelConfigurations = {
3737
model: 'anthropic/claude-sonnet-4-20250514',
3838
},
3939
structuredOutput: {
40-
model: 'anthropic/claude-3-5-haiku-20241022',
40+
model: 'anthropic/claude-sonnet-4-20250514',
4141
},
4242
summarizer: {
43-
model: 'anthropic/claude-3-5-haiku-20241022',
43+
model: 'anthropic/claude-sonnet-4-20250514',
4444
},
4545
};
4646

@@ -126,7 +126,7 @@ export const createAgents = async (
126126
// Project ID is already determined above based on template/customProjectId logic
127127

128128
// If keys aren't provided via CLI args, prompt for provider selection and keys
129-
if (!anthropicKey && !openAiKey) {
129+
if (!anthropicKey && !openAiKey && !googleKey) {
130130
const providerChoice = await p.select({
131131
message: 'Which AI provider would you like to use?',
132132
options: [
@@ -205,6 +205,12 @@ export const createAgents = async (
205205
defaultModelSettings = defaultGoogleModelConfigurations;
206206
}
207207

208+
// Ensure models are always configured - fail if none were set
209+
if (Object.keys(defaultModelSettings).length === 0) {
210+
p.cancel('Cannot continue without a model configuration for project. Please provide an API key for at least one AI provider.');
211+
process.exit(1);
212+
}
213+
208214
const s = p.spinner();
209215
s.start('Creating directory structure...');
210216

0 commit comments

Comments
 (0)