@inkeep/agents-run-api 0.0.0-dev-20250911002844 → 0.0.0-dev-20250911052037
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +71 -49
- package/dist/index.js +71 -49
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1429,11 +1429,14 @@ var logger6 = getLogger("ModelFactory");
|
|
|
1429
1429
|
var _ModelFactory = class _ModelFactory {
|
|
1430
1430
|
/**
|
|
1431
1431
|
* Create a language model instance from configuration
|
|
1432
|
-
*
|
|
1432
|
+
* Throws error if no config provided - models must be configured at project level
|
|
1433
1433
|
*/
|
|
1434
1434
|
static createModel(config2) {
|
|
1435
|
-
|
|
1436
|
-
|
|
1435
|
+
if (!config2?.model?.trim()) {
|
|
1436
|
+
throw new Error("Model configuration is required. Please configure models at the project level.");
|
|
1437
|
+
}
|
|
1438
|
+
const modelSettings = config2;
|
|
1439
|
+
const modelString = modelSettings.model.trim();
|
|
1437
1440
|
const { provider, modelName } = _ModelFactory.parseModelString(modelString);
|
|
1438
1441
|
logger6.debug(
|
|
1439
1442
|
{
|
|
@@ -1451,11 +1454,7 @@ var _ModelFactory = class _ModelFactory {
|
|
|
1451
1454
|
case "openai":
|
|
1452
1455
|
return _ModelFactory.createOpenAIModel(modelName, modelSettings.providerOptions);
|
|
1453
1456
|
default:
|
|
1454
|
-
|
|
1455
|
-
{ provider, modelName },
|
|
1456
|
-
"Unknown or unsupported provider, falling back to default Anthropic model"
|
|
1457
|
-
);
|
|
1458
|
-
return _ModelFactory.createAnthropicModel("claude-4-sonnet-20250514");
|
|
1457
|
+
throw new Error(`Unsupported provider: ${provider}. Supported providers are: ${_ModelFactory.SUPPORTED_PROVIDERS.join(", ")}`);
|
|
1459
1458
|
}
|
|
1460
1459
|
} catch (error) {
|
|
1461
1460
|
logger6.error(
|
|
@@ -1464,9 +1463,9 @@ var _ModelFactory = class _ModelFactory {
|
|
|
1464
1463
|
model: modelName,
|
|
1465
1464
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
1466
1465
|
},
|
|
1467
|
-
"Failed to create model
|
|
1466
|
+
"Failed to create model"
|
|
1468
1467
|
);
|
|
1469
|
-
|
|
1468
|
+
throw new Error(`Failed to create model ${modelString}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1470
1469
|
}
|
|
1471
1470
|
}
|
|
1472
1471
|
/**
|
|
@@ -1601,13 +1600,6 @@ var _ModelFactory = class _ModelFactory {
|
|
|
1601
1600
|
return errors;
|
|
1602
1601
|
}
|
|
1603
1602
|
};
|
|
1604
|
-
/**
|
|
1605
|
-
* Default model settingsuration to use when no model settings is provided
|
|
1606
|
-
* Uses provider defaults for all parameters
|
|
1607
|
-
*/
|
|
1608
|
-
__publicField(_ModelFactory, "DEFAULT_MODEL_CONFIG", {
|
|
1609
|
-
model: "anthropic/claude-4-sonnet-20250514"
|
|
1610
|
-
});
|
|
1611
1603
|
/**
|
|
1612
1604
|
* Supported providers for security validation
|
|
1613
1605
|
*/
|
|
@@ -1664,13 +1656,14 @@ var GraphSession = class {
|
|
|
1664
1656
|
/**
|
|
1665
1657
|
* Initialize status updates for this session
|
|
1666
1658
|
*/
|
|
1667
|
-
initializeStatusUpdates(config2, summarizerModel) {
|
|
1659
|
+
initializeStatusUpdates(config2, summarizerModel, baseModel) {
|
|
1668
1660
|
const now = Date.now();
|
|
1669
1661
|
this.statusUpdateState = {
|
|
1670
1662
|
lastUpdateTime: now,
|
|
1671
1663
|
lastEventCount: 0,
|
|
1672
1664
|
startTime: now,
|
|
1673
1665
|
summarizerModel,
|
|
1666
|
+
baseModel,
|
|
1674
1667
|
config: {
|
|
1675
1668
|
numEvents: config2.numEvents || 10,
|
|
1676
1669
|
timeInSeconds: config2.timeInSeconds || 30,
|
|
@@ -2113,7 +2106,7 @@ var GraphSession = class {
|
|
|
2113
2106
|
"graph_session.id": this.sessionId,
|
|
2114
2107
|
"events.count": newEvents.length,
|
|
2115
2108
|
"elapsed_time.seconds": Math.round(elapsedTime / 1e3),
|
|
2116
|
-
"llm.model": summarizerModel?.model
|
|
2109
|
+
"llm.model": summarizerModel?.model,
|
|
2117
2110
|
"previous_summaries.count": previousSummaries.length
|
|
2118
2111
|
}
|
|
2119
2112
|
},
|
|
@@ -2159,9 +2152,14 @@ Describe the ACTUAL finding, result, or specific information discovered (e.g., "
|
|
|
2159
2152
|
|
|
2160
2153
|
${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
2161
2154
|
const prompt = basePrompt;
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2155
|
+
let modelToUse = summarizerModel;
|
|
2156
|
+
if (!summarizerModel?.model?.trim()) {
|
|
2157
|
+
if (!this.statusUpdateState?.baseModel?.model?.trim()) {
|
|
2158
|
+
throw new Error("Either summarizer or base model is required for progress summary generation. Please configure models at the project level.");
|
|
2159
|
+
}
|
|
2160
|
+
modelToUse = this.statusUpdateState.baseModel;
|
|
2161
|
+
}
|
|
2162
|
+
const model = ModelFactory.createModel(modelToUse);
|
|
2165
2163
|
const { text } = await ai.generateText({
|
|
2166
2164
|
model,
|
|
2167
2165
|
prompt,
|
|
@@ -2203,7 +2201,7 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
|
2203
2201
|
"graph_session.id": this.sessionId,
|
|
2204
2202
|
"events.count": newEvents.length,
|
|
2205
2203
|
"elapsed_time.seconds": Math.round(elapsedTime / 1e3),
|
|
2206
|
-
"llm.model": summarizerModel?.model
|
|
2204
|
+
"llm.model": summarizerModel?.model,
|
|
2207
2205
|
"status_components.count": statusComponents.length,
|
|
2208
2206
|
"previous_summaries.count": previousSummaries.length
|
|
2209
2207
|
}
|
|
@@ -2282,9 +2280,14 @@ REMEMBER YOU CAN ONLY USE 'no_relevant_updates' ALONE! IT CANNOT BE CONCATENATED
|
|
|
2282
2280
|
|
|
2283
2281
|
${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
2284
2282
|
const prompt = basePrompt;
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2283
|
+
let modelToUse = summarizerModel;
|
|
2284
|
+
if (!summarizerModel?.model?.trim()) {
|
|
2285
|
+
if (!this.statusUpdateState?.baseModel?.model?.trim()) {
|
|
2286
|
+
throw new Error("Either summarizer or base model is required for status update generation. Please configure models at the project level.");
|
|
2287
|
+
}
|
|
2288
|
+
modelToUse = this.statusUpdateState.baseModel;
|
|
2289
|
+
}
|
|
2290
|
+
const model = ModelFactory.createModel(modelToUse);
|
|
2288
2291
|
const { object } = await ai.generateObject({
|
|
2289
2292
|
model,
|
|
2290
2293
|
prompt,
|
|
@@ -2567,9 +2570,14 @@ Summary: ${JSON.stringify(artifactData.summaryProps, null, 2)}
|
|
|
2567
2570
|
Full: ${JSON.stringify(artifactData.fullProps, null, 2)}
|
|
2568
2571
|
|
|
2569
2572
|
Make it specific and relevant.`;
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
+
let modelToUse = this.statusUpdateState?.summarizerModel;
|
|
2574
|
+
if (!modelToUse?.model?.trim()) {
|
|
2575
|
+
if (!this.statusUpdateState?.baseModel?.model?.trim()) {
|
|
2576
|
+
throw new Error("Either summarizer or base model is required for artifact name generation. Please configure models at the project level.");
|
|
2577
|
+
}
|
|
2578
|
+
modelToUse = this.statusUpdateState.baseModel;
|
|
2579
|
+
}
|
|
2580
|
+
const model = ModelFactory.createModel(modelToUse);
|
|
2573
2581
|
const schema = z5.z.object({
|
|
2574
2582
|
name: z5.z.string().max(50).describe("Concise, descriptive name for the artifact"),
|
|
2575
2583
|
description: z5.z.string().max(150).describe("Brief description of the artifact's relevance to the user's question")
|
|
@@ -2578,7 +2586,7 @@ Make it specific and relevant.`;
|
|
|
2578
2586
|
createSpanName("graph_session.generate_artifact_metadata"),
|
|
2579
2587
|
{
|
|
2580
2588
|
attributes: {
|
|
2581
|
-
"llm.model": this.statusUpdateState?.summarizerModel?.model
|
|
2589
|
+
"llm.model": this.statusUpdateState?.summarizerModel?.model,
|
|
2582
2590
|
"llm.operation": "generate_object",
|
|
2583
2591
|
"artifact.id": artifactData.artifactId,
|
|
2584
2592
|
"prompt.length": prompt.length
|
|
@@ -5201,8 +5209,6 @@ var logger16 = getLogger("Agent");
|
|
|
5201
5209
|
var tracer2 = getGlobalTracer();
|
|
5202
5210
|
var CONSTANTS = {
|
|
5203
5211
|
MAX_GENERATION_STEPS: 12,
|
|
5204
|
-
DEFAULT_PRIMARY_MODEL: "anthropic/claude-4-sonnet-20250514",
|
|
5205
|
-
DEFAULT_STRUCTURED_OUTPUT_MODEL: "openai/gpt-4.1-mini-2025-04-14",
|
|
5206
5212
|
PHASE_1_TIMEOUT_MS: 27e4,
|
|
5207
5213
|
// 4.5 minutes for streaming phase 1
|
|
5208
5214
|
NON_STREAMING_PHASE_1_TIMEOUT_MS: 9e4,
|
|
@@ -5210,8 +5216,13 @@ var CONSTANTS = {
|
|
|
5210
5216
|
PHASE_2_TIMEOUT_MS: 9e4
|
|
5211
5217
|
// 1.5 minutes for phase 2 structured output
|
|
5212
5218
|
};
|
|
5213
|
-
function
|
|
5214
|
-
|
|
5219
|
+
function validateModel(modelString, modelType) {
|
|
5220
|
+
if (!modelString?.trim()) {
|
|
5221
|
+
throw new Error(
|
|
5222
|
+
`${modelType} model is required. Please configure models at the project level.`
|
|
5223
|
+
);
|
|
5224
|
+
}
|
|
5225
|
+
return modelString.trim();
|
|
5215
5226
|
}
|
|
5216
5227
|
function isValidTool(tool4) {
|
|
5217
5228
|
return tool4 && typeof tool4 === "object" && typeof tool4.description === "string" && tool4.inputSchema && typeof tool4.execute === "function";
|
|
@@ -5264,36 +5275,45 @@ var Agent = class {
|
|
|
5264
5275
|
}
|
|
5265
5276
|
/**
|
|
5266
5277
|
* Get the primary model settings for text generation and thinking
|
|
5267
|
-
*
|
|
5278
|
+
* Requires model to be configured at project level
|
|
5268
5279
|
*/
|
|
5269
5280
|
getPrimaryModel() {
|
|
5270
5281
|
if (!this.config.models?.base) {
|
|
5271
|
-
|
|
5282
|
+
throw new Error(
|
|
5283
|
+
"Base model configuration is required. Please configure models at the project level."
|
|
5284
|
+
);
|
|
5272
5285
|
}
|
|
5273
5286
|
return {
|
|
5274
|
-
model:
|
|
5287
|
+
model: validateModel(this.config.models.base.model, "Base"),
|
|
5275
5288
|
providerOptions: this.config.models.base.providerOptions
|
|
5276
5289
|
};
|
|
5277
5290
|
}
|
|
5278
5291
|
/**
|
|
5279
5292
|
* Get the model settings for structured output generation
|
|
5280
|
-
*
|
|
5293
|
+
* Falls back to base model if structured output not configured
|
|
5281
5294
|
*/
|
|
5282
5295
|
getStructuredOutputModel() {
|
|
5283
5296
|
if (!this.config.models) {
|
|
5284
|
-
|
|
5297
|
+
throw new Error(
|
|
5298
|
+
"Model configuration is required. Please configure models at the project level."
|
|
5299
|
+
);
|
|
5285
5300
|
}
|
|
5286
5301
|
const structuredConfig = this.config.models.structuredOutput;
|
|
5287
5302
|
const baseConfig = this.config.models.base;
|
|
5288
5303
|
if (structuredConfig) {
|
|
5289
5304
|
return {
|
|
5290
|
-
model:
|
|
5305
|
+
model: validateModel(structuredConfig.model, "Structured output"),
|
|
5291
5306
|
providerOptions: structuredConfig.providerOptions
|
|
5292
5307
|
};
|
|
5293
5308
|
}
|
|
5309
|
+
if (!baseConfig) {
|
|
5310
|
+
throw new Error(
|
|
5311
|
+
"Base model configuration is required for structured output fallback. Please configure models at the project level."
|
|
5312
|
+
);
|
|
5313
|
+
}
|
|
5294
5314
|
return {
|
|
5295
|
-
model:
|
|
5296
|
-
providerOptions: baseConfig
|
|
5315
|
+
model: validateModel(baseConfig.model, "Base (fallback for structured output)"),
|
|
5316
|
+
providerOptions: baseConfig.providerOptions
|
|
5297
5317
|
};
|
|
5298
5318
|
}
|
|
5299
5319
|
setConversationId(conversationId) {
|
|
@@ -5969,11 +5989,14 @@ Key requirements:
|
|
|
5969
5989
|
const configuredTimeout = modelSettings.maxDuration ? Math.min(modelSettings.maxDuration * 1e3, MAX_ALLOWED_TIMEOUT_MS) : shouldStreamPhase1 ? CONSTANTS.PHASE_1_TIMEOUT_MS : CONSTANTS.NON_STREAMING_PHASE_1_TIMEOUT_MS;
|
|
5970
5990
|
const timeoutMs = Math.min(configuredTimeout, MAX_ALLOWED_TIMEOUT_MS);
|
|
5971
5991
|
if (modelSettings.maxDuration && modelSettings.maxDuration * 1e3 > MAX_ALLOWED_TIMEOUT_MS) {
|
|
5972
|
-
logger16.warn(
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5992
|
+
logger16.warn(
|
|
5993
|
+
{
|
|
5994
|
+
requestedTimeout: modelSettings.maxDuration * 1e3,
|
|
5995
|
+
appliedTimeout: timeoutMs,
|
|
5996
|
+
maxAllowed: MAX_ALLOWED_TIMEOUT_MS
|
|
5997
|
+
},
|
|
5998
|
+
"Requested timeout exceeded maximum allowed, capping to 10 minutes"
|
|
5999
|
+
);
|
|
5977
6000
|
}
|
|
5978
6001
|
const phase1SystemPrompt = hasStructuredOutput ? thinkingSystemPrompt : systemPrompt;
|
|
5979
6002
|
const messages = [];
|
|
@@ -6148,8 +6171,7 @@ Key requirements:
|
|
|
6148
6171
|
**Task ID:** ${taskId2}
|
|
6149
6172
|
|
|
6150
6173
|
### Summary
|
|
6151
|
-
${typeof summaryData === "string" ? summaryData : JSON.stringify(summaryData, null, 2)}
|
|
6152
|
-
`;
|
|
6174
|
+
${typeof summaryData === "string" ? summaryData : JSON.stringify(summaryData, null, 2)}`;
|
|
6153
6175
|
reasoningFlow.push({
|
|
6154
6176
|
role: "assistant",
|
|
6155
6177
|
content: formattedArtifact
|
package/dist/index.js
CHANGED
|
@@ -1032,11 +1032,14 @@ var logger6 = getLogger("ModelFactory");
|
|
|
1032
1032
|
var _ModelFactory = class _ModelFactory {
|
|
1033
1033
|
/**
|
|
1034
1034
|
* Create a language model instance from configuration
|
|
1035
|
-
*
|
|
1035
|
+
* Throws error if no config provided - models must be configured at project level
|
|
1036
1036
|
*/
|
|
1037
1037
|
static createModel(config) {
|
|
1038
|
-
|
|
1039
|
-
|
|
1038
|
+
if (!config?.model?.trim()) {
|
|
1039
|
+
throw new Error("Model configuration is required. Please configure models at the project level.");
|
|
1040
|
+
}
|
|
1041
|
+
const modelSettings = config;
|
|
1042
|
+
const modelString = modelSettings.model.trim();
|
|
1040
1043
|
const { provider, modelName } = _ModelFactory.parseModelString(modelString);
|
|
1041
1044
|
logger6.debug(
|
|
1042
1045
|
{
|
|
@@ -1054,11 +1057,7 @@ var _ModelFactory = class _ModelFactory {
|
|
|
1054
1057
|
case "openai":
|
|
1055
1058
|
return _ModelFactory.createOpenAIModel(modelName, modelSettings.providerOptions);
|
|
1056
1059
|
default:
|
|
1057
|
-
|
|
1058
|
-
{ provider, modelName },
|
|
1059
|
-
"Unknown or unsupported provider, falling back to default Anthropic model"
|
|
1060
|
-
);
|
|
1061
|
-
return _ModelFactory.createAnthropicModel("claude-4-sonnet-20250514");
|
|
1060
|
+
throw new Error(`Unsupported provider: ${provider}. Supported providers are: ${_ModelFactory.SUPPORTED_PROVIDERS.join(", ")}`);
|
|
1062
1061
|
}
|
|
1063
1062
|
} catch (error) {
|
|
1064
1063
|
logger6.error(
|
|
@@ -1067,9 +1066,9 @@ var _ModelFactory = class _ModelFactory {
|
|
|
1067
1066
|
model: modelName,
|
|
1068
1067
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
1069
1068
|
},
|
|
1070
|
-
"Failed to create model
|
|
1069
|
+
"Failed to create model"
|
|
1071
1070
|
);
|
|
1072
|
-
|
|
1071
|
+
throw new Error(`Failed to create model ${modelString}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1073
1072
|
}
|
|
1074
1073
|
}
|
|
1075
1074
|
/**
|
|
@@ -1204,13 +1203,6 @@ var _ModelFactory = class _ModelFactory {
|
|
|
1204
1203
|
return errors;
|
|
1205
1204
|
}
|
|
1206
1205
|
};
|
|
1207
|
-
/**
|
|
1208
|
-
* Default model settingsuration to use when no model settings is provided
|
|
1209
|
-
* Uses provider defaults for all parameters
|
|
1210
|
-
*/
|
|
1211
|
-
__publicField(_ModelFactory, "DEFAULT_MODEL_CONFIG", {
|
|
1212
|
-
model: "anthropic/claude-4-sonnet-20250514"
|
|
1213
|
-
});
|
|
1214
1206
|
/**
|
|
1215
1207
|
* Supported providers for security validation
|
|
1216
1208
|
*/
|
|
@@ -1263,13 +1255,14 @@ var GraphSession = class {
|
|
|
1263
1255
|
/**
|
|
1264
1256
|
* Initialize status updates for this session
|
|
1265
1257
|
*/
|
|
1266
|
-
initializeStatusUpdates(config, summarizerModel) {
|
|
1258
|
+
initializeStatusUpdates(config, summarizerModel, baseModel) {
|
|
1267
1259
|
const now = Date.now();
|
|
1268
1260
|
this.statusUpdateState = {
|
|
1269
1261
|
lastUpdateTime: now,
|
|
1270
1262
|
lastEventCount: 0,
|
|
1271
1263
|
startTime: now,
|
|
1272
1264
|
summarizerModel,
|
|
1265
|
+
baseModel,
|
|
1273
1266
|
config: {
|
|
1274
1267
|
numEvents: config.numEvents || 10,
|
|
1275
1268
|
timeInSeconds: config.timeInSeconds || 30,
|
|
@@ -1712,7 +1705,7 @@ var GraphSession = class {
|
|
|
1712
1705
|
"graph_session.id": this.sessionId,
|
|
1713
1706
|
"events.count": newEvents.length,
|
|
1714
1707
|
"elapsed_time.seconds": Math.round(elapsedTime / 1e3),
|
|
1715
|
-
"llm.model": summarizerModel?.model
|
|
1708
|
+
"llm.model": summarizerModel?.model,
|
|
1716
1709
|
"previous_summaries.count": previousSummaries.length
|
|
1717
1710
|
}
|
|
1718
1711
|
},
|
|
@@ -1758,9 +1751,14 @@ Describe the ACTUAL finding, result, or specific information discovered (e.g., "
|
|
|
1758
1751
|
|
|
1759
1752
|
${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
1760
1753
|
const prompt = basePrompt;
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1754
|
+
let modelToUse = summarizerModel;
|
|
1755
|
+
if (!summarizerModel?.model?.trim()) {
|
|
1756
|
+
if (!this.statusUpdateState?.baseModel?.model?.trim()) {
|
|
1757
|
+
throw new Error("Either summarizer or base model is required for progress summary generation. Please configure models at the project level.");
|
|
1758
|
+
}
|
|
1759
|
+
modelToUse = this.statusUpdateState.baseModel;
|
|
1760
|
+
}
|
|
1761
|
+
const model = ModelFactory.createModel(modelToUse);
|
|
1764
1762
|
const { text } = await generateText({
|
|
1765
1763
|
model,
|
|
1766
1764
|
prompt,
|
|
@@ -1802,7 +1800,7 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
|
1802
1800
|
"graph_session.id": this.sessionId,
|
|
1803
1801
|
"events.count": newEvents.length,
|
|
1804
1802
|
"elapsed_time.seconds": Math.round(elapsedTime / 1e3),
|
|
1805
|
-
"llm.model": summarizerModel?.model
|
|
1803
|
+
"llm.model": summarizerModel?.model,
|
|
1806
1804
|
"status_components.count": statusComponents.length,
|
|
1807
1805
|
"previous_summaries.count": previousSummaries.length
|
|
1808
1806
|
}
|
|
@@ -1881,9 +1879,14 @@ REMEMBER YOU CAN ONLY USE 'no_relevant_updates' ALONE! IT CANNOT BE CONCATENATED
|
|
|
1881
1879
|
|
|
1882
1880
|
${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
1883
1881
|
const prompt = basePrompt;
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1882
|
+
let modelToUse = summarizerModel;
|
|
1883
|
+
if (!summarizerModel?.model?.trim()) {
|
|
1884
|
+
if (!this.statusUpdateState?.baseModel?.model?.trim()) {
|
|
1885
|
+
throw new Error("Either summarizer or base model is required for status update generation. Please configure models at the project level.");
|
|
1886
|
+
}
|
|
1887
|
+
modelToUse = this.statusUpdateState.baseModel;
|
|
1888
|
+
}
|
|
1889
|
+
const model = ModelFactory.createModel(modelToUse);
|
|
1887
1890
|
const { object } = await generateObject({
|
|
1888
1891
|
model,
|
|
1889
1892
|
prompt,
|
|
@@ -2166,9 +2169,14 @@ Summary: ${JSON.stringify(artifactData.summaryProps, null, 2)}
|
|
|
2166
2169
|
Full: ${JSON.stringify(artifactData.fullProps, null, 2)}
|
|
2167
2170
|
|
|
2168
2171
|
Make it specific and relevant.`;
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
+
let modelToUse = this.statusUpdateState?.summarizerModel;
|
|
2173
|
+
if (!modelToUse?.model?.trim()) {
|
|
2174
|
+
if (!this.statusUpdateState?.baseModel?.model?.trim()) {
|
|
2175
|
+
throw new Error("Either summarizer or base model is required for artifact name generation. Please configure models at the project level.");
|
|
2176
|
+
}
|
|
2177
|
+
modelToUse = this.statusUpdateState.baseModel;
|
|
2178
|
+
}
|
|
2179
|
+
const model = ModelFactory.createModel(modelToUse);
|
|
2172
2180
|
const schema = z.object({
|
|
2173
2181
|
name: z.string().max(50).describe("Concise, descriptive name for the artifact"),
|
|
2174
2182
|
description: z.string().max(150).describe("Brief description of the artifact's relevance to the user's question")
|
|
@@ -2177,7 +2185,7 @@ Make it specific and relevant.`;
|
|
|
2177
2185
|
createSpanName("graph_session.generate_artifact_metadata"),
|
|
2178
2186
|
{
|
|
2179
2187
|
attributes: {
|
|
2180
|
-
"llm.model": this.statusUpdateState?.summarizerModel?.model
|
|
2188
|
+
"llm.model": this.statusUpdateState?.summarizerModel?.model,
|
|
2181
2189
|
"llm.operation": "generate_object",
|
|
2182
2190
|
"artifact.id": artifactData.artifactId,
|
|
2183
2191
|
"prompt.length": prompt.length
|
|
@@ -4795,8 +4803,6 @@ var logger16 = getLogger("Agent");
|
|
|
4795
4803
|
var tracer2 = getGlobalTracer();
|
|
4796
4804
|
var CONSTANTS = {
|
|
4797
4805
|
MAX_GENERATION_STEPS: 12,
|
|
4798
|
-
DEFAULT_PRIMARY_MODEL: "anthropic/claude-4-sonnet-20250514",
|
|
4799
|
-
DEFAULT_STRUCTURED_OUTPUT_MODEL: "openai/gpt-4.1-mini-2025-04-14",
|
|
4800
4806
|
PHASE_1_TIMEOUT_MS: 27e4,
|
|
4801
4807
|
// 4.5 minutes for streaming phase 1
|
|
4802
4808
|
NON_STREAMING_PHASE_1_TIMEOUT_MS: 9e4,
|
|
@@ -4804,8 +4810,13 @@ var CONSTANTS = {
|
|
|
4804
4810
|
PHASE_2_TIMEOUT_MS: 9e4
|
|
4805
4811
|
// 1.5 minutes for phase 2 structured output
|
|
4806
4812
|
};
|
|
4807
|
-
function
|
|
4808
|
-
|
|
4813
|
+
function validateModel(modelString, modelType) {
|
|
4814
|
+
if (!modelString?.trim()) {
|
|
4815
|
+
throw new Error(
|
|
4816
|
+
`${modelType} model is required. Please configure models at the project level.`
|
|
4817
|
+
);
|
|
4818
|
+
}
|
|
4819
|
+
return modelString.trim();
|
|
4809
4820
|
}
|
|
4810
4821
|
function isValidTool(tool4) {
|
|
4811
4822
|
return tool4 && typeof tool4 === "object" && typeof tool4.description === "string" && tool4.inputSchema && typeof tool4.execute === "function";
|
|
@@ -4858,36 +4869,45 @@ var Agent = class {
|
|
|
4858
4869
|
}
|
|
4859
4870
|
/**
|
|
4860
4871
|
* Get the primary model settings for text generation and thinking
|
|
4861
|
-
*
|
|
4872
|
+
* Requires model to be configured at project level
|
|
4862
4873
|
*/
|
|
4863
4874
|
getPrimaryModel() {
|
|
4864
4875
|
if (!this.config.models?.base) {
|
|
4865
|
-
|
|
4876
|
+
throw new Error(
|
|
4877
|
+
"Base model configuration is required. Please configure models at the project level."
|
|
4878
|
+
);
|
|
4866
4879
|
}
|
|
4867
4880
|
return {
|
|
4868
|
-
model:
|
|
4881
|
+
model: validateModel(this.config.models.base.model, "Base"),
|
|
4869
4882
|
providerOptions: this.config.models.base.providerOptions
|
|
4870
4883
|
};
|
|
4871
4884
|
}
|
|
4872
4885
|
/**
|
|
4873
4886
|
* Get the model settings for structured output generation
|
|
4874
|
-
*
|
|
4887
|
+
* Falls back to base model if structured output not configured
|
|
4875
4888
|
*/
|
|
4876
4889
|
getStructuredOutputModel() {
|
|
4877
4890
|
if (!this.config.models) {
|
|
4878
|
-
|
|
4891
|
+
throw new Error(
|
|
4892
|
+
"Model configuration is required. Please configure models at the project level."
|
|
4893
|
+
);
|
|
4879
4894
|
}
|
|
4880
4895
|
const structuredConfig = this.config.models.structuredOutput;
|
|
4881
4896
|
const baseConfig = this.config.models.base;
|
|
4882
4897
|
if (structuredConfig) {
|
|
4883
4898
|
return {
|
|
4884
|
-
model:
|
|
4899
|
+
model: validateModel(structuredConfig.model, "Structured output"),
|
|
4885
4900
|
providerOptions: structuredConfig.providerOptions
|
|
4886
4901
|
};
|
|
4887
4902
|
}
|
|
4903
|
+
if (!baseConfig) {
|
|
4904
|
+
throw new Error(
|
|
4905
|
+
"Base model configuration is required for structured output fallback. Please configure models at the project level."
|
|
4906
|
+
);
|
|
4907
|
+
}
|
|
4888
4908
|
return {
|
|
4889
|
-
model:
|
|
4890
|
-
providerOptions: baseConfig
|
|
4909
|
+
model: validateModel(baseConfig.model, "Base (fallback for structured output)"),
|
|
4910
|
+
providerOptions: baseConfig.providerOptions
|
|
4891
4911
|
};
|
|
4892
4912
|
}
|
|
4893
4913
|
setConversationId(conversationId) {
|
|
@@ -5563,11 +5583,14 @@ Key requirements:
|
|
|
5563
5583
|
const configuredTimeout = modelSettings.maxDuration ? Math.min(modelSettings.maxDuration * 1e3, MAX_ALLOWED_TIMEOUT_MS) : shouldStreamPhase1 ? CONSTANTS.PHASE_1_TIMEOUT_MS : CONSTANTS.NON_STREAMING_PHASE_1_TIMEOUT_MS;
|
|
5564
5584
|
const timeoutMs = Math.min(configuredTimeout, MAX_ALLOWED_TIMEOUT_MS);
|
|
5565
5585
|
if (modelSettings.maxDuration && modelSettings.maxDuration * 1e3 > MAX_ALLOWED_TIMEOUT_MS) {
|
|
5566
|
-
logger16.warn(
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5586
|
+
logger16.warn(
|
|
5587
|
+
{
|
|
5588
|
+
requestedTimeout: modelSettings.maxDuration * 1e3,
|
|
5589
|
+
appliedTimeout: timeoutMs,
|
|
5590
|
+
maxAllowed: MAX_ALLOWED_TIMEOUT_MS
|
|
5591
|
+
},
|
|
5592
|
+
"Requested timeout exceeded maximum allowed, capping to 10 minutes"
|
|
5593
|
+
);
|
|
5571
5594
|
}
|
|
5572
5595
|
const phase1SystemPrompt = hasStructuredOutput ? thinkingSystemPrompt : systemPrompt;
|
|
5573
5596
|
const messages = [];
|
|
@@ -5742,8 +5765,7 @@ Key requirements:
|
|
|
5742
5765
|
**Task ID:** ${taskId2}
|
|
5743
5766
|
|
|
5744
5767
|
### Summary
|
|
5745
|
-
${typeof summaryData === "string" ? summaryData : JSON.stringify(summaryData, null, 2)}
|
|
5746
|
-
`;
|
|
5768
|
+
${typeof summaryData === "string" ? summaryData : JSON.stringify(summaryData, null, 2)}`;
|
|
5747
5769
|
reasoningFlow.push({
|
|
5748
5770
|
role: "assistant",
|
|
5749
5771
|
content: formattedArtifact
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250911052037",
|
|
4
4
|
"description": "Execution API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"traverse": "^0.6.11",
|
|
46
46
|
"ts-pattern": "^5.7.1",
|
|
47
47
|
"zod": "^4.1.5",
|
|
48
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
48
|
+
"@inkeep/agents-core": "^0.0.0-dev-20250911052037"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@biomejs/biome": "2.1.4",
|