Skip to content
9 changes: 9 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,19 @@ export default defineConfig([globalIgnores([
"types/**/*",
"./script_docs.ts",
"src/llm/anthropic/llm.spec.ts",
"src/llm/anthropic/inherited-strict.spec.ts",
"src/llm/anthropic/inherited-stream-events.spec.ts",
"src/llm/anthropic/inherited-content-utils.spec.ts",
"src/llm/google/llm.spec.ts",
"src/llm/google/inherited-stream-events.spec.ts",
"src/llm/openai/llm.spec.ts",
"src/llm/openai/inherited-deepseek.spec.ts",
"src/llm/openai/inherited-xai.spec.ts",
"src/llm/bedrock/llm.spec.ts",
"src/llm/bedrock/inherited-cache.spec.ts",
"src/llm/bedrock/inherited.spec.ts",
"src/llm/vertexai/llm.spec.ts",
"src/llm/vertexai/inherited-stream-events.spec.ts",
]), {
extends: fixupConfigRules(compat.extends(
"eslint:recommended",
Expand Down
2,058 changes: 486 additions & 1,572 deletions package-lock.json

Large diffs are not rendered by default.

31 changes: 13 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@librechat/agents",
"version": "3.2.46",
"version": "3.2.52",
"main": "./dist/cjs/main.cjs",
"module": "./dist/esm/main.mjs",
"types": "./dist/types/index.d.ts",
Expand Down Expand Up @@ -201,14 +201,9 @@
},
"overrides": {
"@langchain/openai": "1.5.3",
"@anthropic-ai/sdk": "$@anthropic-ai/sdk",
"@browserbasehq/stagehand": {
"openai": "$openai"
},
"@langchain/google-common": "$@langchain/google-common",
"@langchain/google-gauth": "$@langchain/google-gauth",
"@langchain/google-genai": "$@langchain/google-genai",
"@langchain/google-vertexai": "$@langchain/google-vertexai",
"uuid": "$uuid",
"fast-xml-parser": "5.7.2",
"ajv": "6.14.0",
Expand All @@ -217,21 +212,21 @@
"js-yaml": "^4.2.0"
},
"dependencies": {
"@anthropic-ai/sdk": "^0.92.0",
"@aws-sdk/client-bedrock-runtime": "^3.1013.0",
"@langchain/anthropic": "^1.3.28",
"@langchain/aws": "^1.3.5",
"@anthropic-ai/sdk": "^0.103.0",
"@aws-sdk/client-bedrock-runtime": "^3.1075.0",
"@langchain/anthropic": "^1.5.1",
"@langchain/aws": "^1.4.2",
"@langchain/core": "^1.2.1",
"@langchain/deepseek": "^1.0.25",
"@langchain/google-common": "2.1.31",
"@langchain/google-gauth": "2.1.31",
"@langchain/google-genai": "2.1.31",
"@langchain/google-vertexai": "2.1.31",
"@langchain/langgraph": "^1.2.9",
"@langchain/mistralai": "^1.0.8",
"@langchain/deepseek": "^1.1.3",
"@langchain/google-common": "2.2.0",
"@langchain/google-gauth": "2.2.0",
"@langchain/google-genai": "2.2.0",
"@langchain/google-vertexai": "2.2.0",
"@langchain/langgraph": "^1.4.5",
"@langchain/mistralai": "^1.2.0",
"@langchain/openai": "1.5.3",
"@langchain/textsplitters": "^1.0.1",
"@langchain/xai": "^1.3.17",
"@langchain/xai": "^1.4.3",
"@langfuse/langchain": "^5.4.1",
"@langfuse/otel": "^5.4.1",
"@langfuse/tracing": "^5.4.1",
Expand Down
19 changes: 7 additions & 12 deletions src/graphs/MultiAgentGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import {
Command,
StateGraph,
Annotation,
getCurrentTaskInput,
messagesStateReducer,
} from '@langchain/langgraph';
import type { BaseMessage, AIMessageChunk } from '@langchain/core/messages';
import type { LangGraphRunnableConfig } from '@langchain/langgraph';
import type { ToolRunnableConfig } from '@langchain/core/tools';
import type { ToolRuntime } from '@langchain/core/tools';
import type * as t from '@/types';
import { StandardGraph } from './Graph';
import { Constants } from '@/common';
Expand Down Expand Up @@ -330,12 +329,10 @@ export class MultiAgentGraph extends StandardGraph {

tools.push(
tool(
async (rawInput, config) => {
async (rawInput, runtime: ToolRuntime) => {
const input = rawInput as Record<string, unknown>;
const state = getCurrentTaskInput() as t.BaseGraphState;
const toolCallId =
(config as ToolRunnableConfig | undefined)?.toolCall?.id ??
'unknown';
const state = runtime.state as t.BaseGraphState;
const toolCallId = runtime.toolCall?.id ?? 'unknown';

/** Evaluated condition */
const result = edge.condition!(state);
Expand Down Expand Up @@ -414,11 +411,9 @@ export class MultiAgentGraph extends StandardGraph {

tools.push(
tool(
async (rawInput, config) => {
async (rawInput, runtime: ToolRuntime) => {
const input = rawInput as Record<string, unknown>;
const toolCallId =
(config as ToolRunnableConfig | undefined)?.toolCall?.id ??
'unknown';
const toolCallId = runtime.toolCall?.id ?? 'unknown';

let content = `Successfully transferred to ${destination}`;
if (
Expand All @@ -439,7 +434,7 @@ export class MultiAgentGraph extends StandardGraph {
},
});

const state = getCurrentTaskInput() as t.BaseGraphState;
const state = runtime.state as t.BaseGraphState;

/**
* For parallel handoff support:
Expand Down
15 changes: 13 additions & 2 deletions src/llm/anthropic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ export class CustomAnthropic extends ChatAnthropicMessages {
| Anthropic.Messages.ToolChoiceAuto
| Anthropic.Messages.ToolChoiceAny
| Anthropic.Messages.ToolChoiceTool
| Anthropic.Messages.ToolChoiceNone
| undefined = handleToolChoice(options?.tool_choice);

const callOptions = options as CustomAnthropicCallOptions | undefined;
Expand All @@ -508,12 +509,19 @@ export class CustomAnthropic extends ChatAnthropicMessages {
const toolBetas = getToolBetas(options?.tools);
const compactionBetas = getCompactionBetas(contextManagement);
const taskBudgetBetas = getTaskBudgetBetas(this.model, mergedOutputConfig);
const formattedTools = this.formatStructuredToolToAnthropic(options?.tools);
const formattedTools = this.formatStructuredToolToAnthropic(
options?.tools,
{
strict: options?.strict,
}
);

const sharedParams = {
tools: formattedTools,
tool_choice,
thinking: this.thinking,
// Match upstream: omit `thinking` unless the user set it, so we don't send
// `{ type: 'disabled' }` (an unsupported param on some models) by default.
thinking: this.thinkingExplicitlySet ? this.thinking : undefined,
context_management: contextManagement,
...this.invocationKwargs,
container: callOptions?.container,
Expand All @@ -527,6 +535,9 @@ export class CustomAnthropic extends ChatAnthropicMessages {
output_config: mergedOutputConfig,
inference_geo: inferenceGeo,
mcp_servers: callOptions?.mcp_servers,
// Top-level request cache_control (1.5.x): API auto-advances the cache
// breakpoint across turns. Additive — independent of our block-level cache.
cache_control: options?.cache_control,
};
validateInvocationParamCompatibility({
model: this.model,
Expand Down
Loading
Loading