illuma-agents 1.0.47 → 1.0.50
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/cjs/agents/AgentContext.cjs +44 -14
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/common/enum.cjs +2 -1
- package/dist/cjs/common/enum.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +19 -0
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/graphs/MultiAgentGraph.cjs +26 -17
- package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
- package/dist/cjs/llm/openai/index.cjs +1 -0
- package/dist/cjs/llm/openai/index.cjs.map +1 -1
- package/dist/cjs/main.cjs +9 -3
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/stream.cjs +0 -14
- package/dist/cjs/stream.cjs.map +1 -1
- package/dist/cjs/tools/CodeExecutor.cjs +37 -27
- package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs +22 -18
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +100 -5
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/ToolSearch.cjs +38 -31
- package/dist/cjs/tools/ToolSearch.cjs.map +1 -1
- package/dist/cjs/tools/schema.cjs +31 -0
- package/dist/cjs/tools/schema.cjs.map +1 -0
- package/dist/cjs/tools/search/schema.cjs +25 -23
- package/dist/cjs/tools/search/schema.cjs.map +1 -1
- package/dist/cjs/tools/search/tool.cjs +9 -33
- package/dist/cjs/tools/search/tool.cjs.map +1 -1
- package/dist/cjs/utils/schema.cjs +27 -0
- package/dist/cjs/utils/schema.cjs.map +1 -0
- package/dist/cjs/utils/title.cjs +28 -14
- package/dist/cjs/utils/title.cjs.map +1 -1
- package/dist/esm/agents/AgentContext.mjs +44 -14
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/common/enum.mjs +2 -1
- package/dist/esm/common/enum.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +19 -0
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/graphs/MultiAgentGraph.mjs +26 -17
- package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
- package/dist/esm/llm/openai/index.mjs +1 -0
- package/dist/esm/llm/openai/index.mjs.map +1 -1
- package/dist/esm/main.mjs +3 -1
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/stream.mjs +0 -14
- package/dist/esm/stream.mjs.map +1 -1
- package/dist/esm/tools/CodeExecutor.mjs +37 -27
- package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
- package/dist/esm/tools/ProgrammaticToolCalling.mjs +22 -18
- package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +101 -6
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/ToolSearch.mjs +38 -31
- package/dist/esm/tools/ToolSearch.mjs.map +1 -1
- package/dist/esm/tools/schema.mjs +28 -0
- package/dist/esm/tools/schema.mjs.map +1 -0
- package/dist/esm/tools/search/schema.mjs +25 -23
- package/dist/esm/tools/search/schema.mjs.map +1 -1
- package/dist/esm/tools/search/tool.mjs +10 -34
- package/dist/esm/tools/search/tool.mjs.map +1 -1
- package/dist/esm/utils/schema.mjs +24 -0
- package/dist/esm/utils/schema.mjs.map +1 -0
- package/dist/esm/utils/title.mjs +28 -14
- package/dist/esm/utils/title.mjs.map +1 -1
- package/dist/types/agents/AgentContext.d.ts +13 -2
- package/dist/types/common/enum.d.ts +2 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/tools/CodeExecutor.d.ts +1 -15
- package/dist/types/tools/ProgrammaticToolCalling.d.ts +1 -13
- package/dist/types/tools/ToolNode.d.ts +12 -1
- package/dist/types/tools/ToolSearch.d.ts +1 -15
- package/dist/types/tools/schema.d.ts +12 -0
- package/dist/types/tools/search/schema.d.ts +25 -7
- package/dist/types/tools/search/tool.d.ts +1 -52
- package/dist/types/tools/search/types.d.ts +5 -23
- package/dist/types/types/graph.d.ts +6 -0
- package/dist/types/types/tools.d.ts +55 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/schema.d.ts +8 -0
- package/package.json +2 -3
- package/src/agents/AgentContext.ts +55 -19
- package/src/common/enum.ts +2 -1
- package/src/graphs/Graph.ts +27 -4
- package/src/graphs/MultiAgentGraph.ts +26 -17
- package/src/index.ts +2 -1
- package/src/scripts/test_code_api.ts +4 -4
- package/src/specs/agent-handoffs.test.ts +1 -2
- package/src/specs/azure.simple.test.ts +214 -175
- package/src/specs/thinking-prune.test.ts +6 -6
- package/src/specs/tool-error.test.ts +7 -2
- package/src/stream.ts +0 -17
- package/src/test/mockTools.ts +34 -14
- package/src/tools/CodeExecutor.ts +48 -31
- package/src/tools/ProgrammaticToolCalling.ts +25 -24
- package/src/tools/ToolNode.ts +137 -15
- package/src/tools/ToolSearch.ts +55 -44
- package/src/tools/__tests__/ProgrammaticToolCalling.integration.test.ts +10 -9
- package/src/tools/__tests__/ToolSearch.integration.test.ts +10 -9
- package/src/tools/schema.ts +37 -0
- package/src/tools/search/schema.ts +30 -25
- package/src/tools/search/tool.ts +23 -16
- package/src/tools/search/types.ts +5 -29
- package/src/types/graph.ts +6 -0
- package/src/types/tools.ts +58 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/schema.ts +35 -0
- package/src/utils/title.ts +31 -19
- package/LICENSE +0 -21
- package/dist/cjs/tools/PresentationTool.cjs +0 -291
- package/dist/cjs/tools/PresentationTool.cjs.map +0 -1
- package/dist/esm/tools/PresentationTool.mjs +0 -288
- package/dist/esm/tools/PresentationTool.mjs.map +0 -1
- package/dist/types/tools/PresentationTool.d.ts +0 -2358
- package/src/tools/PresentationTool.ts +0 -356
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
// src/agents/AgentContext.ts
|
|
3
|
-
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
4
3
|
import { SystemMessage } from '@langchain/core/messages';
|
|
5
4
|
import { RunnableLambda } from '@langchain/core/runnables';
|
|
6
5
|
import type {
|
|
@@ -11,7 +10,9 @@ import type {
|
|
|
11
10
|
import type { RunnableConfig, Runnable } from '@langchain/core/runnables';
|
|
12
11
|
import type * as t from '@/types';
|
|
13
12
|
import type { createPruneMessages } from '@/messages';
|
|
13
|
+
import { createSchemaOnlyTools } from '@/tools/schema';
|
|
14
14
|
import { ContentTypes, Providers } from '@/common';
|
|
15
|
+
import { toJsonSchema } from '@/utils/schema';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Encapsulates agent-specific state that can vary between agents in a multi-agent system
|
|
@@ -34,6 +35,7 @@ export class AgentContext {
|
|
|
34
35
|
toolMap,
|
|
35
36
|
toolEnd,
|
|
36
37
|
toolRegistry,
|
|
38
|
+
toolDefinitions,
|
|
37
39
|
instructions,
|
|
38
40
|
additional_instructions,
|
|
39
41
|
streamBuffer,
|
|
@@ -54,6 +56,7 @@ export class AgentContext {
|
|
|
54
56
|
tools,
|
|
55
57
|
toolMap,
|
|
56
58
|
toolRegistry,
|
|
59
|
+
toolDefinitions,
|
|
57
60
|
instructions,
|
|
58
61
|
additionalInstructions: additional_instructions,
|
|
59
62
|
reasoningKey,
|
|
@@ -122,6 +125,11 @@ export class AgentContext {
|
|
|
122
125
|
* Used for tool search and programmatic tool calling.
|
|
123
126
|
*/
|
|
124
127
|
toolRegistry?: t.LCToolRegistry;
|
|
128
|
+
/**
|
|
129
|
+
* Serializable tool definitions for event-driven execution.
|
|
130
|
+
* When provided, ToolNode operates in event-driven mode.
|
|
131
|
+
*/
|
|
132
|
+
toolDefinitions?: t.LCTool[];
|
|
125
133
|
/** Set of tool names discovered via tool search (to be loaded) */
|
|
126
134
|
discoveredToolNames: Set<string> = new Set();
|
|
127
135
|
/** Instructions for this agent */
|
|
@@ -207,6 +215,7 @@ export class AgentContext {
|
|
|
207
215
|
tools,
|
|
208
216
|
toolMap,
|
|
209
217
|
toolRegistry,
|
|
218
|
+
toolDefinitions,
|
|
210
219
|
instructions,
|
|
211
220
|
additionalInstructions,
|
|
212
221
|
dynamicContext,
|
|
@@ -226,6 +235,7 @@ export class AgentContext {
|
|
|
226
235
|
tools?: t.GraphTools;
|
|
227
236
|
toolMap?: t.ToolMap;
|
|
228
237
|
toolRegistry?: t.LCToolRegistry;
|
|
238
|
+
toolDefinitions?: t.LCTool[];
|
|
229
239
|
instructions?: string;
|
|
230
240
|
additionalInstructions?: string;
|
|
231
241
|
dynamicContext?: string;
|
|
@@ -245,6 +255,7 @@ export class AgentContext {
|
|
|
245
255
|
this.tools = tools;
|
|
246
256
|
this.toolMap = toolMap;
|
|
247
257
|
this.toolRegistry = toolRegistry;
|
|
258
|
+
this.toolDefinitions = toolDefinitions;
|
|
248
259
|
this.instructions = instructions;
|
|
249
260
|
this.additionalInstructions = additionalInstructions;
|
|
250
261
|
this.dynamicContext = dynamicContext;
|
|
@@ -600,15 +611,10 @@ export class AgentContext {
|
|
|
600
611
|
genericTool.schema != null &&
|
|
601
612
|
typeof genericTool.schema === 'object'
|
|
602
613
|
) {
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
(genericTool.description as string) || ''
|
|
608
|
-
);
|
|
609
|
-
const jsonSchema = zodToJsonSchema(
|
|
610
|
-
describedSchema as Parameters<typeof zodToJsonSchema>[0],
|
|
611
|
-
(genericTool.name as string) || ''
|
|
614
|
+
const jsonSchema = toJsonSchema(
|
|
615
|
+
genericTool.schema,
|
|
616
|
+
(genericTool.name as string | undefined) ?? '',
|
|
617
|
+
(genericTool.description as string | undefined) ?? ''
|
|
612
618
|
);
|
|
613
619
|
const toolName = (genericTool.name as string) || 'unknown';
|
|
614
620
|
const tokens = tokenCounter(
|
|
@@ -777,40 +783,70 @@ export class AgentContext {
|
|
|
777
783
|
|
|
778
784
|
/**
|
|
779
785
|
* Gets tools that should be bound to the LLM.
|
|
780
|
-
*
|
|
786
|
+
* In event-driven mode (toolDefinitions present, tools empty), creates schema-only tools.
|
|
787
|
+
* Otherwise filters tool instances based on:
|
|
781
788
|
* 1. Non-deferred tools with allowed_callers: ['direct']
|
|
782
789
|
* 2. Discovered tools (from tool search)
|
|
783
790
|
* @returns Array of tools to bind to model
|
|
784
791
|
*/
|
|
785
792
|
getToolsForBinding(): t.GraphTools | undefined {
|
|
793
|
+
/** Event-driven mode: create schema-only tools from definitions */
|
|
794
|
+
if (this.toolDefinitions && this.toolDefinitions.length > 0) {
|
|
795
|
+
return this.getEventDrivenToolsForBinding();
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/** Traditional mode: filter actual tool instances */
|
|
786
799
|
if (!this.tools || !this.toolRegistry) {
|
|
787
800
|
return this.tools;
|
|
788
801
|
}
|
|
789
802
|
|
|
790
|
-
|
|
803
|
+
return this.filterToolsForBinding(this.tools);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/** Creates schema-only tools from toolDefinitions for event-driven mode */
|
|
807
|
+
private getEventDrivenToolsForBinding(): t.GraphTools {
|
|
808
|
+
if (!this.toolDefinitions) {
|
|
809
|
+
return [];
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
const defsToInclude = this.toolDefinitions.filter((def) => {
|
|
813
|
+
const allowedCallers = def.allowed_callers ?? ['direct'];
|
|
814
|
+
if (!allowedCallers.includes('direct')) {
|
|
815
|
+
return false;
|
|
816
|
+
}
|
|
817
|
+
if (
|
|
818
|
+
def.defer_loading === true &&
|
|
819
|
+
!this.discoveredToolNames.has(def.name)
|
|
820
|
+
) {
|
|
821
|
+
return false;
|
|
822
|
+
}
|
|
823
|
+
return true;
|
|
824
|
+
});
|
|
825
|
+
|
|
826
|
+
return createSchemaOnlyTools(defsToInclude) as t.GraphTools;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
/** Filters tool instances for binding based on registry config */
|
|
830
|
+
private filterToolsForBinding(tools: t.GraphTools): t.GraphTools {
|
|
831
|
+
return tools.filter((tool) => {
|
|
791
832
|
if (!('name' in tool)) {
|
|
792
|
-
return true;
|
|
833
|
+
return true;
|
|
793
834
|
}
|
|
794
835
|
|
|
795
836
|
const toolDef = this.toolRegistry?.get(tool.name);
|
|
796
837
|
if (!toolDef) {
|
|
797
|
-
return true;
|
|
838
|
+
return true;
|
|
798
839
|
}
|
|
799
840
|
|
|
800
|
-
// Check if discovered (overrides defer_loading)
|
|
801
841
|
if (this.discoveredToolNames.has(tool.name)) {
|
|
802
|
-
// Discovered tools must still have allowed_callers: ['direct']
|
|
803
842
|
const allowedCallers = toolDef.allowed_callers ?? ['direct'];
|
|
804
843
|
return allowedCallers.includes('direct');
|
|
805
844
|
}
|
|
806
845
|
|
|
807
|
-
// Not discovered: must be direct-callable AND not deferred
|
|
808
846
|
const allowedCallers = toolDef.allowed_callers ?? ['direct'];
|
|
809
847
|
return (
|
|
810
848
|
allowedCallers.includes('direct') && toolDef.defer_loading !== true
|
|
811
849
|
);
|
|
812
850
|
});
|
|
813
|
-
|
|
814
|
-
return toolsToInclude;
|
|
815
851
|
}
|
|
816
852
|
}
|
package/src/common/enum.ts
CHANGED
|
@@ -23,6 +23,8 @@ export enum GraphEvents {
|
|
|
23
23
|
ON_CONTEXT_ANALYTICS = 'on_context_analytics',
|
|
24
24
|
/** [Custom] Structured output event - emitted when agent returns structured JSON */
|
|
25
25
|
ON_STRUCTURED_OUTPUT = 'on_structured_output',
|
|
26
|
+
/** [Custom] Request to execute tools - dispatched by ToolNode, handled by host */
|
|
27
|
+
ON_TOOL_EXECUTE = 'on_tool_execute',
|
|
26
28
|
|
|
27
29
|
/* Official Events */
|
|
28
30
|
|
|
@@ -163,7 +165,6 @@ export enum Callback {
|
|
|
163
165
|
export enum Constants {
|
|
164
166
|
OFFICIAL_CODE_BASEURL = 'https://api.illuma.ai/v1',
|
|
165
167
|
EXECUTE_CODE = 'execute_code',
|
|
166
|
-
CREATE_PRESENTATION = 'create_presentation',
|
|
167
168
|
TOOL_SEARCH = 'tool_search',
|
|
168
169
|
PROGRAMMATIC_TOOL_CALLING = 'run_tools_with_code',
|
|
169
170
|
WEB_SEARCH = 'web_search',
|
package/src/graphs/Graph.ts
CHANGED
|
@@ -66,6 +66,7 @@ import { getChatModelClass, manualToolStreamProviders } from '@/llm/providers';
|
|
|
66
66
|
import { ToolNode as CustomToolNode, toolsCondition } from '@/tools/ToolNode';
|
|
67
67
|
import { ChatOpenAI, AzureChatOpenAI } from '@/llm/openai';
|
|
68
68
|
import { safeDispatchCustomEvent } from '@/utils/events';
|
|
69
|
+
import { createSchemaOnlyTools } from '@/tools/schema';
|
|
69
70
|
import { AgentContext } from '@/agents/AgentContext';
|
|
70
71
|
import { createFakeStreamingLLM } from '@/llm/fake';
|
|
71
72
|
import { HandlerRegistry } from '@/events';
|
|
@@ -524,6 +525,28 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
|
|
|
524
525
|
currentToolMap?: t.ToolMap;
|
|
525
526
|
agentContext?: AgentContext;
|
|
526
527
|
}): CustomToolNode<t.BaseGraphState> | ToolNode<t.BaseGraphState> {
|
|
528
|
+
const toolDefinitions = agentContext?.toolDefinitions;
|
|
529
|
+
const eventDrivenMode =
|
|
530
|
+
toolDefinitions != null && toolDefinitions.length > 0;
|
|
531
|
+
|
|
532
|
+
if (eventDrivenMode) {
|
|
533
|
+
const schemaTools = createSchemaOnlyTools(toolDefinitions);
|
|
534
|
+
const toolDefMap = new Map(toolDefinitions.map((def) => [def.name, def]));
|
|
535
|
+
|
|
536
|
+
return new CustomToolNode<t.BaseGraphState>({
|
|
537
|
+
tools: schemaTools as t.GenericTool[],
|
|
538
|
+
toolMap: new Map(schemaTools.map((tool) => [tool.name, tool])),
|
|
539
|
+
toolCallStepIds: this.toolCallStepIds,
|
|
540
|
+
errorHandler: (data, metadata) =>
|
|
541
|
+
StandardGraph.handleToolCallErrorStatic(this, data, metadata),
|
|
542
|
+
toolRegistry: agentContext?.toolRegistry,
|
|
543
|
+
sessions: this.sessions,
|
|
544
|
+
eventDrivenMode: true,
|
|
545
|
+
toolDefinitions: toolDefMap,
|
|
546
|
+
agentId: agentContext?.agentId,
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
|
|
527
550
|
return new CustomToolNode<t.BaseGraphState>({
|
|
528
551
|
tools: (currentTools as t.GenericTool[] | undefined) ?? [],
|
|
529
552
|
toolMap: currentToolMap,
|
|
@@ -1073,7 +1096,7 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
|
|
|
1073
1096
|
// Get a fresh model WITHOUT tools bound - bindTools() returns RunnableBinding which lacks withStructuredOutput
|
|
1074
1097
|
// Also disable thinking mode - Anthropic/Bedrock doesn't allow tool_choice with thinking enabled
|
|
1075
1098
|
const structuredClientOptions = { ...agentContext.clientOptions } as t.ClientOptions;
|
|
1076
|
-
|
|
1099
|
+
|
|
1077
1100
|
// Remove thinking configuration for Bedrock
|
|
1078
1101
|
if (agentContext.provider === Providers.BEDROCK) {
|
|
1079
1102
|
const bedrockOpts = structuredClientOptions as t.BedrockAnthropicClientOptions;
|
|
@@ -1084,7 +1107,7 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
|
|
|
1084
1107
|
bedrockOpts.additionalModelRequestFields = additionalFields;
|
|
1085
1108
|
}
|
|
1086
1109
|
}
|
|
1087
|
-
|
|
1110
|
+
|
|
1088
1111
|
// Remove thinking configuration for Anthropic
|
|
1089
1112
|
if (agentContext.provider === Providers.ANTHROPIC) {
|
|
1090
1113
|
const anthropicOpts = structuredClientOptions as t.AnthropicClientOptions;
|
|
@@ -1092,12 +1115,12 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
|
|
|
1092
1115
|
delete anthropicOpts.thinking;
|
|
1093
1116
|
}
|
|
1094
1117
|
}
|
|
1095
|
-
|
|
1118
|
+
|
|
1096
1119
|
const structuredModel = this.getNewModel({
|
|
1097
1120
|
provider: agentContext.provider,
|
|
1098
1121
|
clientOptions: structuredClientOptions,
|
|
1099
1122
|
});
|
|
1100
|
-
|
|
1123
|
+
|
|
1101
1124
|
const { structuredResponse, rawMessage } =
|
|
1102
1125
|
await this.attemptStructuredInvoke(
|
|
1103
1126
|
{
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { tool } from '@langchain/core/tools';
|
|
3
2
|
import { PromptTemplate } from '@langchain/core/prompts';
|
|
4
3
|
import {
|
|
@@ -292,7 +291,8 @@ export class MultiAgentGraph extends StandardGraph {
|
|
|
292
291
|
|
|
293
292
|
tools.push(
|
|
294
293
|
tool(
|
|
295
|
-
async (
|
|
294
|
+
async (rawInput, config) => {
|
|
295
|
+
const input = rawInput as Record<string, unknown>;
|
|
296
296
|
const state = getCurrentTaskInput() as t.BaseGraphState;
|
|
297
297
|
const toolCallId =
|
|
298
298
|
(config as ToolRunnableConfig | undefined)?.toolCall?.id ??
|
|
@@ -343,13 +343,17 @@ export class MultiAgentGraph extends StandardGraph {
|
|
|
343
343
|
{
|
|
344
344
|
name: toolName,
|
|
345
345
|
schema: hasHandoffInput
|
|
346
|
-
?
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
346
|
+
? {
|
|
347
|
+
type: 'object',
|
|
348
|
+
properties: {
|
|
349
|
+
[promptKey]: {
|
|
350
|
+
type: 'string',
|
|
351
|
+
description: handoffInputDescription as string,
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
required: [],
|
|
355
|
+
}
|
|
356
|
+
: { type: 'object', properties: {}, required: [] },
|
|
353
357
|
description: toolDescription,
|
|
354
358
|
}
|
|
355
359
|
)
|
|
@@ -371,7 +375,8 @@ export class MultiAgentGraph extends StandardGraph {
|
|
|
371
375
|
|
|
372
376
|
tools.push(
|
|
373
377
|
tool(
|
|
374
|
-
async (
|
|
378
|
+
async (rawInput, config) => {
|
|
379
|
+
const input = rawInput as Record<string, unknown>;
|
|
375
380
|
const toolCallId =
|
|
376
381
|
(config as ToolRunnableConfig | undefined)?.toolCall?.id ??
|
|
377
382
|
'unknown';
|
|
@@ -470,13 +475,17 @@ export class MultiAgentGraph extends StandardGraph {
|
|
|
470
475
|
{
|
|
471
476
|
name: toolName,
|
|
472
477
|
schema: hasHandoffInput
|
|
473
|
-
?
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
478
|
+
? {
|
|
479
|
+
type: 'object',
|
|
480
|
+
properties: {
|
|
481
|
+
[promptKey]: {
|
|
482
|
+
type: 'string',
|
|
483
|
+
description: handoffInputDescription as string,
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
required: [],
|
|
487
|
+
}
|
|
488
|
+
: { type: 'object', properties: {}, required: [] },
|
|
480
489
|
description: toolDescription,
|
|
481
490
|
}
|
|
482
491
|
)
|
package/src/index.ts
CHANGED
|
@@ -11,10 +11,11 @@ export * from './graphs';
|
|
|
11
11
|
/* Tools */
|
|
12
12
|
export * from './tools/Calculator';
|
|
13
13
|
export * from './tools/CodeExecutor';
|
|
14
|
-
export * from './tools/PresentationTool';
|
|
15
14
|
export * from './tools/BrowserTools';
|
|
16
15
|
export * from './tools/ProgrammaticToolCalling';
|
|
17
16
|
export * from './tools/ToolSearch';
|
|
17
|
+
export * from './tools/ToolNode';
|
|
18
|
+
export * from './tools/schema';
|
|
18
19
|
export * from './tools/handlers';
|
|
19
20
|
export * from './tools/search';
|
|
20
21
|
|
|
@@ -11,13 +11,13 @@ config();
|
|
|
11
11
|
import fetch, { RequestInit } from 'node-fetch';
|
|
12
12
|
import { HttpsProxyAgent } from 'https-proxy-agent';
|
|
13
13
|
|
|
14
|
-
const API_KEY = process.env.
|
|
14
|
+
const API_KEY = process.env.CODE_EXECUTOR_API_KEY ?? '';
|
|
15
15
|
const BASE_URL =
|
|
16
|
-
process.env.
|
|
16
|
+
process.env.ILLUMA_CODE_BASEURL ?? 'https://api.illuma.ai/v1';
|
|
17
17
|
const PROXY = process.env.PROXY;
|
|
18
18
|
|
|
19
19
|
if (!API_KEY) {
|
|
20
|
-
console.error('
|
|
20
|
+
console.error('CODE_EXECUTOR_API_KEY not set');
|
|
21
21
|
process.exit(1);
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -52,7 +52,7 @@ async function makeRequest(
|
|
|
52
52
|
method: body ? 'POST' : 'GET',
|
|
53
53
|
headers: {
|
|
54
54
|
'Content-Type': 'application/json',
|
|
55
|
-
'User-Agent': '
|
|
55
|
+
'User-Agent': 'Illuma/1.0',
|
|
56
56
|
'X-API-Key': API_KEY,
|
|
57
57
|
},
|
|
58
58
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// src/specs/agent-handoffs.test.ts
|
|
2
|
-
import { z } from 'zod';
|
|
3
2
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
4
3
|
import { HumanMessage, ToolMessage } from '@langchain/core/messages';
|
|
5
4
|
import type { ToolCall } from '@langchain/core/messages/tool';
|
|
@@ -708,7 +707,7 @@ describe('Agent Handoffs Tests', () => {
|
|
|
708
707
|
const customTool = new DynamicStructuredTool({
|
|
709
708
|
name: 'custom_tool',
|
|
710
709
|
description: 'A custom tool',
|
|
711
|
-
schema:
|
|
710
|
+
schema: { type: 'object', properties: {}, required: [] },
|
|
712
711
|
func: async (): Promise<string> => 'Tool result',
|
|
713
712
|
});
|
|
714
713
|
|