graphai 0.0.10 → 0.0.12

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.
Files changed (64) hide show
  1. package/README.md +104 -10
  2. package/lib/experimental_agents/array_agents.d.ts +4 -0
  3. package/lib/experimental_agents/array_agents.js +30 -0
  4. package/lib/experimental_agents/data_agent.d.ts +3 -0
  5. package/lib/experimental_agents/data_agent.js +25 -0
  6. package/lib/experimental_agents/index.d.ts +4 -0
  7. package/lib/experimental_agents/index.js +4 -0
  8. package/lib/experimental_agents/nested_agent.d.ts +6 -0
  9. package/lib/experimental_agents/nested_agent.js +24 -0
  10. package/lib/experimental_agents/slashgpt_agent.js +11 -6
  11. package/lib/experimental_agents/sleeper_agent.d.ts +10 -0
  12. package/lib/experimental_agents/sleeper_agent.js +28 -0
  13. package/lib/experimental_agents/string_agent.js +9 -5
  14. package/lib/graphai.d.ts +31 -8
  15. package/lib/graphai.js +138 -43
  16. package/lib/graphai_cli.js +1 -1
  17. package/lib/utils/utils.d.ts +1 -0
  18. package/lib/utils/utils.js +7 -0
  19. package/package.json +14 -4
  20. package/.eslintrc.js +0 -30
  21. package/.github/workflows/node.js.yml +0 -28
  22. package/.prettierrc +0 -3
  23. package/samples/agents/arxiv_agent.ts +0 -45
  24. package/samples/agents/parroting_agent.ts +0 -5
  25. package/samples/agents/slashgpt_agent.ts +0 -19
  26. package/samples/express.ts +0 -47
  27. package/samples/graphs/arxiv.yml +0 -25
  28. package/samples/graphs/slash_gpt.yml +0 -28
  29. package/samples/home.json +0 -112
  30. package/samples/home.ts +0 -51
  31. package/samples/interaction.ts +0 -42
  32. package/samples/runner.ts +0 -15
  33. package/samples/sample_co2.ts +0 -80
  34. package/samples/sample_gpt.ts +0 -8
  35. package/samples/sample_paper_ai.ts +0 -10
  36. package/src/experimental_agents/index.ts +0 -2
  37. package/src/experimental_agents/slashgpt_agent.ts +0 -30
  38. package/src/experimental_agents/string_agent.ts +0 -10
  39. package/src/graphai.ts +0 -417
  40. package/src/graphai_cli.ts +0 -37
  41. package/src/index.ts +0 -3
  42. package/tests/agents/agents.ts +0 -23
  43. package/tests/agents/test_string_agent.ts +0 -28
  44. package/tests/graphai/test_dispatch.ts +0 -41
  45. package/tests/graphai/test_fork.ts +0 -106
  46. package/tests/graphai/test_http_client.ts +0 -40
  47. package/tests/graphai/test_multiple_functions.ts +0 -46
  48. package/tests/graphai/test_sample_flow.ts +0 -71
  49. package/tests/graphs/test_base.yml +0 -19
  50. package/tests/graphs/test_cli.yaml +0 -4
  51. package/tests/graphs/test_dispatch.yml +0 -29
  52. package/tests/graphs/test_error.yml +0 -22
  53. package/tests/graphs/test_multiple_functions_1.yml +0 -30
  54. package/tests/graphs/test_retry.yml +0 -23
  55. package/tests/graphs/test_source.yml +0 -18
  56. package/tests/graphs/test_source2.yml +0 -19
  57. package/tests/graphs/test_timeout.yml +0 -22
  58. package/tests/http-server/README.md +0 -10
  59. package/tests/http-server/docs/llm.json +0 -4
  60. package/tests/http-server/docs/llm2.json +0 -4
  61. package/tests/utils/file_utils.ts +0 -33
  62. package/tests/utils/runner.ts +0 -40
  63. package/tests/utils/utils.ts +0 -3
  64. package/tsconfig.json +0 -113
package/README.md CHANGED
@@ -52,16 +52,103 @@ GraphAI is designed to simplify this process by decoupling the complexity of mul
52
52
 
53
53
  Furthermore, GraphAI's robust mechanisms for error handling, retry strategies, timeouts, and logging empower developers to concentrate on refining the application logic.
54
54
 
55
+ ## Quick Install
56
+
57
+ ```
58
+ npm install graphai
59
+ ```
60
+
61
+ or
62
+
63
+ ```
64
+ yarn add graphai
65
+ ```
66
+
67
+ ## Collaboration
68
+
69
+ Step 1. Install git, node and yarn
70
+
71
+ Step 2. Clone the project and install necessary node modules
72
+
73
+ ```
74
+ git clone git@github.com:snakajima/graphai.git
75
+ cd graphai
76
+ yarn install
77
+ ```
78
+
79
+ Step 3. Set the environment variable OPENAI_API_KEY to your own key (=sk-...)
80
+
81
+ You need to set ANTHROPIC_API_KEY as well, if you want to use Claude.
82
+
83
+ Step 4. Run the test script
84
+
85
+ Start web server for http agent
86
+
87
+ ```
88
+ cd tests/http-server/docs/
89
+ npx http-server
90
+ ```
91
+
92
+ then run the test
93
+
94
+ ```
95
+ npm run test
96
+ ```
97
+
98
+ Step 5. Run one of sample scripts
99
+
100
+ ```
101
+ npm run sample ./samples/home.ts
102
+ ```
103
+
104
+ Step 6. Write some code and send pull requests
105
+
106
+ Key principles:
107
+
108
+ 1. Keep the core (Node and GraphAI classes) small and simple.
109
+ 2. Enhance the platform by adding 'agents' (plug ins).
110
+ 3. Simple but effective test scripts make it easy to maintain.
111
+ 4. Run "npm run format" before submitting pull requests.
112
+
55
113
  ## Data Flow Graph
56
114
 
57
115
  A Data Flow Graph (DFG) is a JavaScript object, which defines the flow of data. It is typically described in YAML file and loaded at runtime.
58
116
 
59
- A DFG consists of a collection of 'nodes', which contains a series of nested keys representing individual nodes in the data flow. Each node is identified by a unique key (e.g., node1, node2) and can contain several predefined keys (params, inputs, outputs, retry, timeout, source, agentId, result, fork) that dictate the node's behavior and its relationship with other nodes.
117
+ A DFG consists of a collection of 'nodes', which contains a series of nested keys representing individual nodes in the data flow. Each node is identified by a unique key (e.g., node1, node2) and can contain several predefined keys (params, inputs, outputs, retry, timeout, source, agentId, fork, value) that dictate the node's behavior and its relationship with other nodes.
60
118
 
61
119
  ### DFG Structure
62
120
 
63
121
  - 'nodes': A list of node. Required.
64
122
  - 'concurrency': An optional property, which specifies the maximum number of concurrent operations (agent functions to be executed at the same time). The default is 8.
123
+ - 'agentId': An optional property, which specifies the default agent for all the nodes.
124
+ - 'loop': An optional property, which specifies if the graph needs to be executed multiple times. The loop is an JavaScript object, which has two optinoal properties. The *count* property specifies the number of times the graph needs to be executed and the *while* property specifies the condition required to contineu the loop in the form of node name (nodeId) or its property (nodeId.propId). Unlike JavaScript, an empty array will be treated as false.
125
+
126
+ ```
127
+ loop:
128
+ while: people
129
+ nodes:
130
+ people:
131
+ value:
132
+ - Steve Jobs
133
+ - Elon Musk
134
+ - Nikola Tesla
135
+ next: retriever.array
136
+ result:
137
+ value: []
138
+ next: reducer
139
+ retriever:
140
+ agentId: shift
141
+ inputs: [people]
142
+ query:
143
+ agentId: slashgpt
144
+ params:
145
+ manifest:
146
+ prompt: 指定した人について日本語で400字以内で答えて
147
+ inputs: [retriever.item]
148
+ reducer:
149
+ agentId: push
150
+ inputs: [result, query.content]
151
+ ```
65
152
 
66
153
  ## Agent
67
154
 
@@ -75,19 +162,26 @@ An agent function receives two set of parameters via AgentFunctionContext, agent
75
162
 
76
163
  ## Node Structure
77
164
 
78
- - 'inputs': An optional list of node identifiers that the current node depends on. This establishes a flow where the current node can only be executed after the completion of the nodes listed under 'inputs'. If this list is empty and the 'source' property is not set, the associated Agent Function will be immediatley executed.
79
- - 'source': An optional flag, which specifies if the node is a 'source node' or not. A souce node is a special node, which receives data from either an external code (via GraphAI's injectResult method) or from a 'dispatcher node'.
80
- - 'result': An optional object, which injects the result into the source node (equivalent to calling the injectResult method).
165
+ There are two types of Node, *computed nodes* and *static nodes*. A *computed node* is associated with an *agent function*, which receives some inputs, performs some computations asynchronously then returns the result (output). A *static node* is a placeholder of a value (just like a variable in programming language), which is injected by an external program, or is retrived from a *data source* (in case of interations).
166
+
167
+ A *computed node* have following properties.
168
+
169
+ - 'agentId': An **required** property, which specifies the id of the *agent function*.
170
+ - 'inputs': An optional list of *data sources* that the current node depends on. This establishes a flow where the current node can only be executed after the completion of the nodes listed under 'inputs'. If this list is empty, the associated *agent function* will be immediatley executed.
81
171
  - 'retry': An optional number, which specifies the maximum number of retries to be made. If the last attempt fails, that return value will be recorded.
82
172
  - 'timeout': An optional number, which specifies the maximum waittime in msec. If the associated agent function does not return the value in time, the "Timeout" error will be recorded and the returned value will be discarded.
83
- - 'params': An optional parameters to the associated agent function, which are agent specific.
84
- - 'agentId': An optional parameter, which specifies the id of the agent, when the graph is associated with multiple agents.
173
+ - 'params': An optional property to the associated agent function, which are agent specific.
85
174
  - 'fork': An optional paramter, which specifies the number of concurrent transactions to be created for the current node.
86
- - 'outputs': An optinal property, which specifies the mapping from outputId to nodeId. If this property is set, the node become a special node called "dispatcher". A dispatcher node injects result(s) into specified nodes, enabling the dynamic flow of data.
175
+ - 'outputs' (MAY BECOME OBSOLETE): An optinal property, which specifies the mapping from outputId to nodeId. If this property is set, the node become a special node called *dispatcher*. A *dispatcher* node injects result(s) into specified static nodes, enabling the dynamic flow of data.
176
+
177
+ A *static* node have following properties.
178
+
179
+ - 'value': An optional property, which specifies the value of this static node (equivalent to calling the injectValue method from outside).
180
+ - 'next': An optional property, which specifies the *data source* after each iteration.
87
181
 
88
182
  ## GraphAI class
89
183
 
90
- ### ```constructor(data: GraphData, callbackDictonary: AgentFunctionDictonary | AgentFunction<any, any, any>)```
184
+ ### ```constructor(data: GraphData, callbackDictonary: AgentFunctionDictonary)```
91
185
  Initializes a new instance of the GraphAI class with the specified graph data and a dictionary of callback functions.
92
186
 
93
187
  - ```data: GraphData```: The graph data including nodes and optional concurrency limit.
@@ -114,7 +208,7 @@ Retrieves all transaction logs recorded during the execution of the graph.
114
208
  Returns: An array of transaction logs detailing the execution states and outcomes of the nodes within the graph.
115
209
 
116
210
  ### ```injectResult(nodeId: string, result: ResultData): void```
117
- Injects a result into a specified node. This is used to manually set the result of a source node, allowing dependent nodes to proceed with execution.
211
+ Injects a result into a specified node. This is used to manually set the result of a static node, allowing dependent nodes to proceed with execution.
118
212
 
119
- - ```nodeId: string```: The ID of the source node into which the result is to be injected.
213
+ - ```nodeId: string```: The ID of the static node into which the result is to be injected.
120
214
  - ```result: ResultData```: The result to be injected into the specified node.
@@ -0,0 +1,4 @@
1
+ import { AgentFunction } from "../graphai";
2
+ export declare const pushAgent: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
3
+ export declare const popAgent: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
4
+ export declare const shiftAgent: AgentFunction<Record<string, any>, Record<string, any>, Record<string, any>>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.shiftAgent = exports.popAgent = exports.pushAgent = void 0;
7
+ const deepmerge_1 = __importDefault(require("deepmerge"));
8
+ const pushAgent = async ({ inputs }) => {
9
+ const [array, item] = (0, deepmerge_1.default)({ inputs }, {}).inputs;
10
+ // TODO: Validation
11
+ array.push(item);
12
+ return array;
13
+ };
14
+ exports.pushAgent = pushAgent;
15
+ const popAgent = async (context) => {
16
+ const { inputs } = context;
17
+ const [array] = (0, deepmerge_1.default)({ inputs }, {}).inputs;
18
+ // TODO: Varidation
19
+ const item = array.pop();
20
+ return { array, item };
21
+ };
22
+ exports.popAgent = popAgent;
23
+ const shiftAgent = async (context) => {
24
+ const { inputs } = context;
25
+ const [array] = (0, deepmerge_1.default)({ inputs }, {}).inputs;
26
+ // TODO: Varidation
27
+ const item = array.shift();
28
+ return { array, item };
29
+ };
30
+ exports.shiftAgent = shiftAgent;
@@ -0,0 +1,3 @@
1
+ import { AgentFunction } from "../graphai";
2
+ export declare const dataObjectMergeTemplateAgent: AgentFunction;
3
+ export declare const dataSumTemplateAgent: AgentFunction<Record<string, any>, number, number>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.dataSumTemplateAgent = exports.dataObjectMergeTemplateAgent = void 0;
7
+ const deepmerge_1 = __importDefault(require("deepmerge"));
8
+ const dataObjectMergeTemplateAgent = async ({ nodeId, params, inputs, verbose }) => {
9
+ if (verbose) {
10
+ console.log("executing", nodeId, params);
11
+ }
12
+ return inputs.reduce((tmp, input) => {
13
+ return (0, deepmerge_1.default)(tmp, input);
14
+ }, {});
15
+ };
16
+ exports.dataObjectMergeTemplateAgent = dataObjectMergeTemplateAgent;
17
+ const dataSumTemplateAgent = async ({ nodeId, params, inputs, verbose }) => {
18
+ if (verbose) {
19
+ console.log("executing", nodeId, params);
20
+ }
21
+ return inputs.reduce((tmp, input) => {
22
+ return tmp + input;
23
+ }, 0);
24
+ };
25
+ exports.dataSumTemplateAgent = dataSumTemplateAgent;
@@ -1,2 +1,6 @@
1
1
  export * from "./string_agent";
2
2
  export * from "./slashgpt_agent";
3
+ export * from "./sleeper_agent";
4
+ export * from "./data_agent";
5
+ export * from "./nested_agent";
6
+ export * from "./array_agents";
@@ -16,3 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./string_agent"), exports);
18
18
  __exportStar(require("./slashgpt_agent"), exports);
19
+ __exportStar(require("./sleeper_agent"), exports);
20
+ __exportStar(require("./data_agent"), exports);
21
+ __exportStar(require("./nested_agent"), exports);
22
+ __exportStar(require("./array_agents"), exports);
@@ -0,0 +1,6 @@
1
+ import { GraphData, AgentFunction } from "../graphai";
2
+ export declare const nestedAgent: AgentFunction<{
3
+ graph: GraphData;
4
+ nodeId: string;
5
+ inputNodes?: Array<string>;
6
+ }>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nestedAgent = void 0;
4
+ const graphai_1 = require("../graphai");
5
+ const nestedAgent = async ({ params, inputs, agents, log }) => {
6
+ const graph = new graphai_1.GraphAI(params.graph, agents);
7
+ try {
8
+ // Inject inputs to specified source nodes
9
+ (params.inputNodes ?? []).forEach((nodeId, index) => {
10
+ graph.injectValue(nodeId, inputs[index]);
11
+ });
12
+ const results = await graph.run();
13
+ log.push(...graph.transactionLogs());
14
+ return results[params.nodeId];
15
+ }
16
+ catch (error) {
17
+ log.push(...graph.transactionLogs());
18
+ if (error instanceof Error) {
19
+ console.log("Error:", error.message);
20
+ }
21
+ throw error;
22
+ }
23
+ };
24
+ exports.nestedAgent = nestedAgent;
@@ -7,17 +7,22 @@ exports.slashGPTAgent = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const slashgpt_1 = require("slashgpt");
9
9
  const config = new slashgpt_1.ChatConfig(path_1.default.resolve(__dirname));
10
- const slashGPTAgent = async (context) => {
11
- console.log("executing", context.nodeId, context.params);
12
- const session = new slashgpt_1.ChatSession(config, context.params.manifest ?? {});
13
- const query = context.params?.query ? [context.params.query] : [];
14
- const contents = query.concat(context.inputs.map((input) => {
10
+ const slashGPTAgent = async ({ nodeId, params, inputs, verbose }) => {
11
+ if (verbose) {
12
+ console.log("executing", nodeId, params);
13
+ }
14
+ const session = new slashgpt_1.ChatSession(config, params.manifest ?? {});
15
+ const query = params?.query ? [params.query] : [];
16
+ const contents = query.concat(inputs.map((input) => {
17
+ if (typeof input === "string") {
18
+ return input;
19
+ }
15
20
  return input.content;
16
21
  }));
17
22
  session.append_user_question(contents.join("\n"));
18
23
  await session.call_loop(() => { });
19
24
  const message = (() => {
20
- if (context.params?.function_result) {
25
+ if (params?.function_result) {
21
26
  return session.history.messages().find((m) => m.role === "function_result");
22
27
  }
23
28
  return session.history.last_message();
@@ -0,0 +1,10 @@
1
+ import { AgentFunction } from "../graphai";
2
+ export declare const sleeperAgent: AgentFunction<{
3
+ duration: number;
4
+ value?: Record<string, any>;
5
+ }>;
6
+ export declare const sleeperAgentDebug: AgentFunction<{
7
+ duration: number;
8
+ value?: Record<string, any>;
9
+ fail?: boolean;
10
+ }>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sleeperAgentDebug = exports.sleeperAgent = void 0;
7
+ const utils_1 = require("../utils/utils");
8
+ const deepmerge_1 = __importDefault(require("deepmerge"));
9
+ const sleeperAgent = async (context) => {
10
+ const { params, inputs } = context;
11
+ await (0, utils_1.sleep)(params.duration);
12
+ return inputs.reduce((result, input) => {
13
+ return (0, deepmerge_1.default)(result, input);
14
+ }, params.value ?? {});
15
+ };
16
+ exports.sleeperAgent = sleeperAgent;
17
+ const sleeperAgentDebug = async (context) => {
18
+ const { nodeId, params, inputs, retry } = context;
19
+ await (0, utils_1.sleep)(params.duration / (retry + 1));
20
+ if (params.fail && retry < 2) {
21
+ console.log("failed (intentional)", nodeId, retry);
22
+ throw new Error("Intentional Failure");
23
+ }
24
+ return inputs.reduce((result, input) => {
25
+ return (0, deepmerge_1.default)(result, input);
26
+ }, params.value ?? {});
27
+ };
28
+ exports.sleeperAgentDebug = sleeperAgentDebug;
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stringTemplateAgent = void 0;
4
- const stringTemplateAgent = async (context) => {
5
- console.log("executing", context.nodeId, context.params);
6
- const content = context.inputs.reduce((template, input, index) => {
7
- return template.replace("${" + index + "}", input[context.params.inputKey ?? "content"]);
8
- }, context.params.template);
4
+ // see example
5
+ // tests/agents/test_string_agent.ts
6
+ const stringTemplateAgent = async ({ nodeId, params, inputs, verbose }) => {
7
+ if (verbose) {
8
+ console.log("executing", nodeId, params);
9
+ }
10
+ const content = inputs.reduce((template, input, index) => {
11
+ return template.replace("${" + index + "}", input[params.inputKey ?? "content"]);
12
+ }, params.template);
9
13
  return { content };
10
14
  };
11
15
  exports.stringTemplateAgent = stringTemplateAgent;
package/lib/graphai.d.ts CHANGED
@@ -18,38 +18,51 @@ type NodeData = {
18
18
  agentId?: string;
19
19
  fork?: number;
20
20
  source?: boolean;
21
- result?: ResultData;
21
+ value?: ResultData;
22
+ next?: string;
22
23
  outputs?: Record<string, string>;
23
24
  };
25
+ type LoopData = {
26
+ count?: number;
27
+ while?: string;
28
+ };
24
29
  export type GraphData = {
30
+ agentId?: string;
25
31
  nodes: Record<string, NodeData>;
26
32
  concurrency?: number;
33
+ loop?: LoopData;
34
+ verbose?: boolean;
27
35
  };
28
36
  export type TransactionLog = {
29
37
  nodeId: string;
30
38
  state: NodeState;
31
39
  startTime: number;
32
40
  endTime?: number;
33
- retryCount: number;
41
+ retryCount?: number;
34
42
  agentId?: string;
35
43
  params?: NodeDataParams;
36
44
  inputs?: Array<ResultData>;
37
45
  errorMessage?: string;
38
46
  result?: ResultData;
47
+ log?: TransactionLog[];
39
48
  };
40
- export type AgentFunctionContext<ParamsType, ResultType, PreviousResultType> = {
49
+ export type AgentFunctionContext<ParamsType, PreviousResultType> = {
41
50
  nodeId: string;
42
51
  forkIndex?: number;
43
52
  retry: number;
44
53
  params: NodeDataParams<ParamsType>;
45
54
  inputs: Array<PreviousResultType>;
55
+ verbose: boolean;
56
+ agents: CallbackDictonaryArgs;
57
+ log: TransactionLog[];
46
58
  };
47
- export type AgentFunction<ParamsType = Record<string, any>, ResultType = Record<string, any>, PreviousResultType = Record<string, any>> = (context: AgentFunctionContext<ParamsType, ResultType, PreviousResultType>) => Promise<ResultData<ResultType>>;
59
+ export type AgentFunction<ParamsType = Record<string, any>, ResultType = Record<string, any>, PreviousResultType = Record<string, any>> = (context: AgentFunctionContext<ParamsType, PreviousResultType>) => Promise<ResultData<ResultType>>;
48
60
  export type AgentFunctionDictonary = Record<string, AgentFunction<any, any, any>>;
49
61
  declare class Node {
50
62
  nodeId: string;
51
63
  params: NodeDataParams;
52
64
  inputs: Array<string>;
65
+ inputProps: Record<string, string>;
53
66
  pendings: Set<string>;
54
67
  waitlist: Set<string>;
55
68
  state: NodeState;
@@ -70,32 +83,42 @@ declare class Node {
70
83
  private retry;
71
84
  removePending(nodeId: string): void;
72
85
  pushQueueIfReady(): void;
73
- injectResult(result: ResultData): void;
86
+ injectValue(value: ResultData): void;
74
87
  private setResult;
75
88
  execute(): Promise<void>;
76
89
  }
77
90
  type GraphNodes = Record<string, Node>;
91
+ export type CallbackDictonaryArgs = AgentFunctionDictonary;
78
92
  export declare class GraphAI {
93
+ private data;
79
94
  nodes: GraphNodes;
95
+ agentId?: string;
80
96
  callbackDictonary: AgentFunctionDictonary;
81
97
  isRunning: boolean;
82
98
  private runningNodes;
83
99
  private nodeQueue;
84
100
  private onComplete;
85
101
  private concurrency;
102
+ private loop?;
103
+ private repeatCount;
104
+ verbose: boolean;
86
105
  private logs;
87
- constructor(data: GraphData, callbackDictonary: AgentFunctionDictonary | AgentFunction<any, any, any>);
88
- getCallback(_agentId?: string): AgentFunction<any, any, any>;
106
+ private createNodes;
107
+ private getValueFromResults;
108
+ private initializeNodes;
109
+ constructor(data: GraphData, callbackDictonary: CallbackDictonaryArgs);
110
+ getCallback(agentId?: string): AgentFunction<any, any, any>;
89
111
  asString(): string;
90
112
  results(): ResultDataDictonary<Record<string, any>>;
91
113
  errors(): Record<string, Error>;
114
+ private pushReadyNodesIntoQueue;
92
115
  run(): Promise<ResultDataDictonary>;
93
116
  private runNode;
94
117
  pushQueue(node: Node): void;
95
118
  removeRunning(node: Node): void;
96
119
  appendLog(log: TransactionLog): void;
97
120
  transactionLogs(): TransactionLog[];
98
- injectResult(nodeId: string, result: ResultData): void;
121
+ injectValue(nodeId: string, value: ResultData): void;
99
122
  resultsOf(nodeIds: Array<string>): ResultData<Record<string, any>>[];
100
123
  }
101
124
  export {};