Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/agents/executor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const logger = require("../logger");
const { executeToolCall, listTools } = require("../tools");

Check failure on line 2 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (23.x)

'listTools' is assigned a value but never used

Check failure on line 2 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (20.x)

'listTools' is assigned a value but never used

Check failure on line 2 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (24.x)

'listTools' is assigned a value but never used

Check failure on line 2 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (22.x)

'listTools' is assigned a value but never used
const { invokeModel } = require("../clients/databricks");
const { STANDARD_TOOLS } = require("../clients/standard-tools");
const ContextManager = require("./context-manager");
Expand Down Expand Up @@ -162,14 +162,22 @@
payload.tools = filteredTools;
}

// Determine provider based on model - subagents should use the specified model
// Determine provider based on model family.
// Subagents should use the currently configured MODEL_PROVIDER and avoid
// hard-fallbacks to Azure when Azure is not selected/configured.
let forceProvider = null;
if (payload.model?.includes('claude') || payload.model?.includes('sonnet') || payload.model?.includes('haiku') || payload.model?.includes('opus')) {
// Route Claude models to the configured Claude provider (azure-openai, databricks, etc.)
const modelLower = String(payload.model || "").toLowerCase();
const isClaudeFamilyModel =
modelLower.includes("claude") ||
modelLower.includes("sonnet") ||
modelLower.includes("haiku") ||
modelLower.includes("opus");
const isGptFamilyModel = modelLower.includes("gpt");

if (isClaudeFamilyModel || isGptFamilyModel) {
const config = require('../config');
forceProvider = config.modelProvider?.provider || 'azure-openai';
} else if (payload.model?.includes('gpt')) {
forceProvider = 'azure-openai';
// `type` is the canonical key; `provider` kept as legacy fallback.
forceProvider = config.modelProvider?.type || config.modelProvider?.provider || null;
}

logger.debug({
Expand Down Expand Up @@ -241,7 +249,7 @@
isSubagent: true
});

const toolDuration = Date.now() - toolStart;

Check failure on line 252 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (23.x)

'toolDuration' is assigned a value but never used

Check failure on line 252 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (20.x)

'toolDuration' is assigned a value but never used

Check failure on line 252 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (24.x)

'toolDuration' is assigned a value but never used

Check failure on line 252 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (22.x)

'toolDuration' is assigned a value but never used

// Record in transcript
contextManager.recordToolCall(
Expand All @@ -259,7 +267,7 @@
});

} catch (error) {
const toolDuration = Date.now() - toolStart;

Check failure on line 270 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (23.x)

'toolDuration' is assigned a value but never used

Check failure on line 270 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (20.x)

'toolDuration' is assigned a value but never used

Check failure on line 270 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (24.x)

'toolDuration' is assigned a value but never used

Check failure on line 270 in src/agents/executor.js

View workflow job for this annotation

GitHub Actions / Run Tests (22.x)

'toolDuration' is assigned a value but never used

logger.warn({
agentId: context.agentId,
Expand Down
Loading