@graph-compose/client 1.0.0 → 1.0.3

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 (49) hide show
  1. package/README.md +949 -476
  2. package/dist/core/adk-helpers.d.ts +94 -0
  3. package/dist/core/adk-helpers.d.ts.map +1 -0
  4. package/dist/core/adk-helpers.js +134 -0
  5. package/dist/core/adk-helpers.js.map +1 -0
  6. package/dist/core/adk-node-builder.d.ts +128 -0
  7. package/dist/core/adk-node-builder.d.ts.map +1 -0
  8. package/dist/core/adk-node-builder.js +175 -0
  9. package/dist/core/adk-node-builder.js.map +1 -0
  10. package/dist/core/adk-workflow-builder.d.ts +74 -0
  11. package/dist/core/adk-workflow-builder.d.ts.map +1 -0
  12. package/dist/core/adk-workflow-builder.js +138 -0
  13. package/dist/core/adk-workflow-builder.js.map +1 -0
  14. package/dist/core/base-builder.d.ts +80 -0
  15. package/dist/core/base-builder.d.ts.map +1 -0
  16. package/dist/core/base-builder.js +63 -0
  17. package/dist/core/base-builder.js.map +1 -0
  18. package/dist/core/builder.d.ts +35 -67
  19. package/dist/core/builder.d.ts.map +1 -1
  20. package/dist/core/builder.js +45 -144
  21. package/dist/core/builder.js.map +1 -1
  22. package/dist/core/node-builder.d.ts +15 -59
  23. package/dist/core/node-builder.d.ts.map +1 -1
  24. package/dist/core/node-builder.js +36 -106
  25. package/dist/core/node-builder.js.map +1 -1
  26. package/dist/index.d.ts +5 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +7 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/types.d.ts +50 -4
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/types.js.map +1 -1
  33. package/dist/validation/adk-validation.d.ts +10 -0
  34. package/dist/validation/adk-validation.d.ts.map +1 -0
  35. package/dist/validation/adk-validation.js +362 -0
  36. package/dist/validation/adk-validation.js.map +1 -0
  37. package/dist/validation/index.d.ts +34 -9
  38. package/dist/validation/index.d.ts.map +1 -1
  39. package/dist/validation/index.js +40 -131
  40. package/dist/validation/index.js.map +1 -1
  41. package/package.json +4 -2
  42. package/dist/core/tool-builder.d.ts +0 -130
  43. package/dist/core/tool-builder.d.ts.map +0 -1
  44. package/dist/core/tool-builder.js +0 -343
  45. package/dist/core/tool-builder.js.map +0 -1
  46. package/dist/node-builder.d.ts +0 -64
  47. package/dist/node-builder.d.ts.map +0 -1
  48. package/dist/node-builder.js +0 -261
  49. package/dist/node-builder.js.map +0 -1
@@ -0,0 +1,94 @@
1
+ import type { ActivityConfig, AgentConfig, GlobalAgentToolDefinition, GlobalHttpToolDefinition, HTTPConfig, LlmAgentConfig, LoopAgentConfig, ParallelAgentConfig, SequentialAgentConfig, SubAgentReference } from "@graph-compose/core";
2
+ /**
3
+ * Helper function to create an LLM agent configuration.
4
+ *
5
+ * LLM agents are the basic building blocks that make HTTP calls to your LLM service.
6
+ * They can use tools, maintain conversation history, and contribute to session state.
7
+ */
8
+ export declare function createLlmAgent(config: {
9
+ id: string;
10
+ httpConfig: HTTPConfig;
11
+ instructions?: string;
12
+ tools?: string[];
13
+ outputKey?: string;
14
+ activityConfig?: ActivityConfig;
15
+ subAgents?: AgentConfig[];
16
+ }): LlmAgentConfig;
17
+ /**
18
+ * Helper function to create a Sequential agent configuration.
19
+ *
20
+ * Sequential agents execute their sub-agents one after another in order.
21
+ * Each sub-agent can access outputs from previous agents via session state.
22
+ * Note: SequentialAgent runs natively in the workflow (not as an HTTP activity).
23
+ */
24
+ export declare function createSequentialAgent(config: {
25
+ id: string;
26
+ subAgents: Array<{
27
+ agentId: string;
28
+ }>;
29
+ outputKey?: string;
30
+ instructions?: string;
31
+ }): SequentialAgentConfig;
32
+ /**
33
+ * Helper function to create a Parallel agent configuration.
34
+ *
35
+ * Parallel agents execute their sub-agents concurrently.
36
+ * Note: ParallelAgent does NOT support outputKey - sub-agents should have their own outputKeys.
37
+ * Note: ParallelAgent runs natively in the workflow (not as an HTTP activity).
38
+ */
39
+ export declare function createParallelAgent(config: {
40
+ id: string;
41
+ subAgents: Array<{
42
+ agentId: string;
43
+ }>;
44
+ instructions?: string;
45
+ }): ParallelAgentConfig;
46
+ /**
47
+ * Helper function to create a Loop agent configuration.
48
+ *
49
+ * Loop agents repeatedly execute their sub-agents until a condition is met
50
+ * or the maximum iterations is reached.
51
+ * Note: LoopAgent runs natively in the workflow (not as an HTTP activity).
52
+ */
53
+ export declare function createLoopAgent(config: {
54
+ id: string;
55
+ subAgents: Array<{
56
+ agentId: string;
57
+ }>;
58
+ maxAgentLoopIterations: number;
59
+ loopExitCondition?: string;
60
+ outputKey?: string;
61
+ instructions?: string;
62
+ }): LoopAgentConfig;
63
+ /**
64
+ * Helper function to create an HTTP tool definition.
65
+ *
66
+ * HTTP tools make external HTTP calls when invoked by agents.
67
+ * Results are returned to the agent and optionally saved to session state.
68
+ */
69
+ export declare function createHttpTool(config: {
70
+ id: string;
71
+ httpConfig: HTTPConfig;
72
+ outputKey?: string;
73
+ activityConfig?: ActivityConfig;
74
+ }): GlobalHttpToolDefinition;
75
+ /**
76
+ * Helper function to create an Agent tool definition.
77
+ *
78
+ * Agent tools allow one agent to delegate work to another agent.
79
+ * The target agent's response is returned to the calling agent.
80
+ */
81
+ export declare function createAgentTool(config: {
82
+ id: string;
83
+ targetAgentId: string;
84
+ outputKey?: string;
85
+ skipSummarization?: boolean;
86
+ }): GlobalAgentToolDefinition;
87
+ /**
88
+ * Helper function to create a sub-agent reference.
89
+ *
90
+ * Used by orchestrator agents (Sequential, Parallel, Loop) to reference
91
+ * other agents defined at the workflow level.
92
+ */
93
+ export declare function createSubAgentReference(agentId: string): SubAgentReference;
94
+ //# sourceMappingURL=adk-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adk-helpers.d.ts","sourceRoot":"","sources":["../../src/core/adk-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,yBAAyB,EACzB,wBAAwB,EACxB,UAAU,EAC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,eAAe,CAalB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,GAAG,wBAAwB,CAW3B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,GAAG,yBAAyB,CAW5B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAE1E"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLlmAgent = createLlmAgent;
4
+ exports.createSequentialAgent = createSequentialAgent;
5
+ exports.createParallelAgent = createParallelAgent;
6
+ exports.createLoopAgent = createLoopAgent;
7
+ exports.createHttpTool = createHttpTool;
8
+ exports.createAgentTool = createAgentTool;
9
+ exports.createSubAgentReference = createSubAgentReference;
10
+ /**
11
+ * Helper function to create an LLM agent configuration.
12
+ *
13
+ * LLM agents are the basic building blocks that make HTTP calls to your LLM service.
14
+ * They can use tools, maintain conversation history, and contribute to session state.
15
+ */
16
+ function createLlmAgent(config) {
17
+ const agent = {
18
+ type: "LlmAgent",
19
+ id: config.id,
20
+ httpConfig: config.httpConfig,
21
+ tools: config.tools || [],
22
+ subAgents: config.subAgents || [],
23
+ };
24
+ if (config.instructions)
25
+ agent.instructions = config.instructions;
26
+ if (config.outputKey)
27
+ agent.outputKey = config.outputKey;
28
+ if (config.activityConfig)
29
+ agent.activityConfig = config.activityConfig;
30
+ return agent;
31
+ }
32
+ /**
33
+ * Helper function to create a Sequential agent configuration.
34
+ *
35
+ * Sequential agents execute their sub-agents one after another in order.
36
+ * Each sub-agent can access outputs from previous agents via session state.
37
+ * Note: SequentialAgent runs natively in the workflow (not as an HTTP activity).
38
+ */
39
+ function createSequentialAgent(config) {
40
+ const agent = {
41
+ type: "SequentialAgent",
42
+ id: config.id,
43
+ subAgents: config.subAgents,
44
+ };
45
+ if (config.outputKey)
46
+ agent.outputKey = config.outputKey;
47
+ if (config.instructions)
48
+ agent.instructions = config.instructions;
49
+ return agent;
50
+ }
51
+ /**
52
+ * Helper function to create a Parallel agent configuration.
53
+ *
54
+ * Parallel agents execute their sub-agents concurrently.
55
+ * Note: ParallelAgent does NOT support outputKey - sub-agents should have their own outputKeys.
56
+ * Note: ParallelAgent runs natively in the workflow (not as an HTTP activity).
57
+ */
58
+ function createParallelAgent(config) {
59
+ const agent = {
60
+ type: "ParallelAgent",
61
+ id: config.id,
62
+ subAgents: config.subAgents,
63
+ };
64
+ if (config.instructions)
65
+ agent.instructions = config.instructions;
66
+ return agent;
67
+ }
68
+ /**
69
+ * Helper function to create a Loop agent configuration.
70
+ *
71
+ * Loop agents repeatedly execute their sub-agents until a condition is met
72
+ * or the maximum iterations is reached.
73
+ * Note: LoopAgent runs natively in the workflow (not as an HTTP activity).
74
+ */
75
+ function createLoopAgent(config) {
76
+ const agent = {
77
+ type: "LoopAgent",
78
+ id: config.id,
79
+ subAgents: config.subAgents,
80
+ maxAgentLoopIterations: config.maxAgentLoopIterations,
81
+ };
82
+ if (config.loopExitCondition)
83
+ agent.loopExitCondition = config.loopExitCondition;
84
+ if (config.outputKey)
85
+ agent.outputKey = config.outputKey;
86
+ if (config.instructions)
87
+ agent.instructions = config.instructions;
88
+ return agent;
89
+ }
90
+ /**
91
+ * Helper function to create an HTTP tool definition.
92
+ *
93
+ * HTTP tools make external HTTP calls when invoked by agents.
94
+ * Results are returned to the agent and optionally saved to session state.
95
+ */
96
+ function createHttpTool(config) {
97
+ const tool = {
98
+ type: "HttpTool",
99
+ id: config.id,
100
+ httpConfig: config.httpConfig,
101
+ };
102
+ if (config.outputKey)
103
+ tool.outputKey = config.outputKey;
104
+ if (config.activityConfig)
105
+ tool.activityConfig = config.activityConfig;
106
+ return tool;
107
+ }
108
+ /**
109
+ * Helper function to create an Agent tool definition.
110
+ *
111
+ * Agent tools allow one agent to delegate work to another agent.
112
+ * The target agent's response is returned to the calling agent.
113
+ */
114
+ function createAgentTool(config) {
115
+ const tool = {
116
+ type: "AgentTool",
117
+ id: config.id,
118
+ targetAgentId: config.targetAgentId,
119
+ skipSummarization: config.skipSummarization ?? false,
120
+ };
121
+ if (config.outputKey)
122
+ tool.outputKey = config.outputKey;
123
+ return tool;
124
+ }
125
+ /**
126
+ * Helper function to create a sub-agent reference.
127
+ *
128
+ * Used by orchestrator agents (Sequential, Parallel, Loop) to reference
129
+ * other agents defined at the workflow level.
130
+ */
131
+ function createSubAgentReference(agentId) {
132
+ return { agentId };
133
+ }
134
+ //# sourceMappingURL=adk-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adk-helpers.js","sourceRoot":"","sources":["../../src/core/adk-helpers.ts"],"names":[],"mappings":";;AAmBA,wCAsBC;AASD,sDAgBC;AASD,kDAcC;AASD,0CAoBC;AAQD,wCAgBC;AAQD,0CAgBC;AAQD,0DAEC;AAnKD;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,MAQ9B;IACC,MAAM,KAAK,GAAmB;QAC5B,IAAI,EAAE,UAAU;QAChB,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;QACzB,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE;KAClC,CAAC;IAEF,IAAI,MAAM,CAAC,YAAY;QAAE,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;IAClE,IAAI,MAAM,CAAC,SAAS;QAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAA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,MAAM,CAAC,YAAY;QAAE,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;IAElE,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,MAK9B;IACC,MAAM,IAAI,GAA6B;QACrC,IAAI,EAAE,UAAU;QAChB,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC;IAEF,IAAI,MAAM,CAAC,SAAS;QAAE,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IACxD,IAAI,MAAM,CAAC,cAAc;QAAE,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAEvE,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,MAK/B;IACC,MAAM,IAAI,GAA8B;QACtC,IAAI,EAAE,WAAW;QACjB,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,IAAI,KAAK;KACrD,CAAC;IAEF,IAAI,MAAM,CAAC,SAAS;QAAE,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IAExD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,OAAe;IACrD,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
@@ -0,0 +1,128 @@
1
+ import type { ActivityConfig, AdkNode, ADKWorkflowDefinition } from "@graph-compose/core";
2
+ import { AdkWorkflowBuilder } from "./adk-workflow-builder";
3
+ import { AbstractNodeBuilder } from "./base-builder";
4
+ /**
5
+ * Builder for ADK (Agent Development Kit) nodes in the workflow graph.
6
+ *
7
+ * ADK nodes enable agentic workflows with:
8
+ * - Multiple agents (LLM, Sequential, Parallel, Loop)
9
+ * - Global tools (HTTP, Agent delegation)
10
+ * - Human-in-the-Loop (HITL) interactions
11
+ * - Multi-agent orchestration patterns
12
+ *
13
+ * Usage:
14
+ * ```typescript
15
+ * graph.adk("customer_support")
16
+ * .withWorkflow(builder =>
17
+ * builder
18
+ * .rootAgent("support_agent")
19
+ * .agent(createLlmAgent({ ... }))
20
+ * .httpTool(createHttpTool({ ... }))
21
+ * .build()
22
+ * )
23
+ * .withDependencies("fetch_user_data")
24
+ * .withActivityConfig({ ... })
25
+ * .end();
26
+ * ```
27
+ */
28
+ export declare class AdkNodeBuilder extends AbstractNodeBuilder<AdkNode> {
29
+ private config?;
30
+ private dependencies;
31
+ private activityConfig?;
32
+ /**
33
+ * Define the ADK workflow using a fluent builder.
34
+ *
35
+ * The builder function receives an AdkWorkflowBuilder instance that provides
36
+ * methods for composing agents, tools, and workflow settings.
37
+ *
38
+ * @param builderFn - Function that builds the ADK workflow configuration
39
+ * @example
40
+ * ```typescript
41
+ * .withWorkflow(builder =>
42
+ * builder
43
+ * .rootAgent("main_agent")
44
+ * .agent(createLlmAgent({ id: "main_agent", ... }))
45
+ * .build()
46
+ * )
47
+ * ```
48
+ */
49
+ withWorkflow(builderFn: (builder: AdkWorkflowBuilder) => ADKWorkflowDefinition): this;
50
+ /**
51
+ * Set the dependencies for this ADK node.
52
+ *
53
+ * Dependencies are other node IDs that must complete before this ADK node executes.
54
+ *
55
+ * @param deps - Node IDs that this node depends on
56
+ * @example
57
+ * ```typescript
58
+ * .withDependencies("fetch_user_data", "validate_input")
59
+ * ```
60
+ */
61
+ withDependencies(...deps: string[]): this;
62
+ /**
63
+ * Set the Temporal activity configuration for this ADK node.
64
+ *
65
+ * Controls retry policies, timeouts, and other Temporal activity settings.
66
+ *
67
+ * @param config - Activity configuration
68
+ * @example
69
+ * ```typescript
70
+ * .withActivityConfig({
71
+ * startToCloseTimeout: "5m",
72
+ * retryPolicy: { maximumAttempts: 3 }
73
+ * })
74
+ * ```
75
+ */
76
+ withActivityConfig(config: ActivityConfig): this;
77
+ /**
78
+ * Set the maximum orchestration cycles for the ADK workflow.
79
+ *
80
+ * This is a shorthand for setting maxOrchestrationCycles in the workflow config.
81
+ * Provides a safety limit for autonomous workflows.
82
+ *
83
+ * @param cycles - Maximum number of workflow iterations
84
+ * @example
85
+ * ```typescript
86
+ * .withMaxCycles(10)
87
+ * ```
88
+ */
89
+ withMaxCycles(cycles: number): this;
90
+ /**
91
+ * Set the initial user input/prompt for the ADK workflow.
92
+ *
93
+ * This is the user's initial message that starts the agentic workflow.
94
+ *
95
+ * @param prompt - Initial user message/prompt
96
+ * @example
97
+ * ```typescript
98
+ * .withInitialPrompt("Help me process this insurance claim")
99
+ * ```
100
+ */
101
+ withInitialPrompt(prompt: string): this;
102
+ /**
103
+ * Seed the ADK workflow with initial state.
104
+ *
105
+ * This allows passing state from external workflows or systems into the ADK workflow.
106
+ * The state is available to all agents via the session state.
107
+ *
108
+ * @param state - Initial state object
109
+ * @example
110
+ * ```typescript
111
+ * .withState({
112
+ * user_profile: { name: "John", id: "123" },
113
+ * context: { source: "typescript_workflow" }
114
+ * })
115
+ * ```
116
+ */
117
+ withState(state: Record<string, any>): this;
118
+ /**
119
+ * Build the ADK node.
120
+ *
121
+ * Validates that the workflow configuration is set and returns the complete ADK node.
122
+ *
123
+ * @returns Complete ADK node definition
124
+ * @throws Error if workflow configuration is missing
125
+ */
126
+ build(): AdkNode;
127
+ }
128
+ //# sourceMappingURL=adk-node-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adk-node-builder.d.ts","sourceRoot":"","sources":["../../src/core/adk-node-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,cAAe,SAAQ,mBAAmB,CAAC,OAAO,CAAC;IAC9D,OAAO,CAAC,MAAM,CAAC,CAAwB;IACvC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,cAAc,CAAC,CAAiB;IAExC;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,qBAAqB,GAAG,IAAI;IAMrF;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAKzC;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAKhD;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAWnC;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAQvC;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAQ3C;;;;;;;OAOG;IACH,KAAK,IAAI,OAAO;CAejB"}
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdkNodeBuilder = void 0;
4
+ const adk_workflow_builder_1 = require("./adk-workflow-builder");
5
+ const base_builder_1 = require("./base-builder");
6
+ /**
7
+ * Builder for ADK (Agent Development Kit) nodes in the workflow graph.
8
+ *
9
+ * ADK nodes enable agentic workflows with:
10
+ * - Multiple agents (LLM, Sequential, Parallel, Loop)
11
+ * - Global tools (HTTP, Agent delegation)
12
+ * - Human-in-the-Loop (HITL) interactions
13
+ * - Multi-agent orchestration patterns
14
+ *
15
+ * Usage:
16
+ * ```typescript
17
+ * graph.adk("customer_support")
18
+ * .withWorkflow(builder =>
19
+ * builder
20
+ * .rootAgent("support_agent")
21
+ * .agent(createLlmAgent({ ... }))
22
+ * .httpTool(createHttpTool({ ... }))
23
+ * .build()
24
+ * )
25
+ * .withDependencies("fetch_user_data")
26
+ * .withActivityConfig({ ... })
27
+ * .end();
28
+ * ```
29
+ */
30
+ class AdkNodeBuilder extends base_builder_1.AbstractNodeBuilder {
31
+ constructor() {
32
+ super(...arguments);
33
+ this.dependencies = [];
34
+ }
35
+ /**
36
+ * Define the ADK workflow using a fluent builder.
37
+ *
38
+ * The builder function receives an AdkWorkflowBuilder instance that provides
39
+ * methods for composing agents, tools, and workflow settings.
40
+ *
41
+ * @param builderFn - Function that builds the ADK workflow configuration
42
+ * @example
43
+ * ```typescript
44
+ * .withWorkflow(builder =>
45
+ * builder
46
+ * .rootAgent("main_agent")
47
+ * .agent(createLlmAgent({ id: "main_agent", ... }))
48
+ * .build()
49
+ * )
50
+ * ```
51
+ */
52
+ withWorkflow(builderFn) {
53
+ const builder = new adk_workflow_builder_1.AdkWorkflowBuilder();
54
+ this.config = builderFn(builder);
55
+ return this;
56
+ }
57
+ /**
58
+ * Set the dependencies for this ADK node.
59
+ *
60
+ * Dependencies are other node IDs that must complete before this ADK node executes.
61
+ *
62
+ * @param deps - Node IDs that this node depends on
63
+ * @example
64
+ * ```typescript
65
+ * .withDependencies("fetch_user_data", "validate_input")
66
+ * ```
67
+ */
68
+ withDependencies(...deps) {
69
+ this.dependencies = deps;
70
+ return this;
71
+ }
72
+ /**
73
+ * Set the Temporal activity configuration for this ADK node.
74
+ *
75
+ * Controls retry policies, timeouts, and other Temporal activity settings.
76
+ *
77
+ * @param config - Activity configuration
78
+ * @example
79
+ * ```typescript
80
+ * .withActivityConfig({
81
+ * startToCloseTimeout: "5m",
82
+ * retryPolicy: { maximumAttempts: 3 }
83
+ * })
84
+ * ```
85
+ */
86
+ withActivityConfig(config) {
87
+ this.activityConfig = config;
88
+ return this;
89
+ }
90
+ /**
91
+ * Set the maximum orchestration cycles for the ADK workflow.
92
+ *
93
+ * This is a shorthand for setting maxOrchestrationCycles in the workflow config.
94
+ * Provides a safety limit for autonomous workflows.
95
+ *
96
+ * @param cycles - Maximum number of workflow iterations
97
+ * @example
98
+ * ```typescript
99
+ * .withMaxCycles(10)
100
+ * ```
101
+ */
102
+ withMaxCycles(cycles) {
103
+ if (!this.config) {
104
+ throw new Error("Must call withWorkflow() before withMaxCycles()");
105
+ }
106
+ if (cycles <= 0 || !Number.isInteger(cycles)) {
107
+ throw new Error("maxOrchestrationCycles must be a positive integer");
108
+ }
109
+ this.config.maxOrchestrationCycles = cycles;
110
+ return this;
111
+ }
112
+ /**
113
+ * Set the initial user input/prompt for the ADK workflow.
114
+ *
115
+ * This is the user's initial message that starts the agentic workflow.
116
+ *
117
+ * @param prompt - Initial user message/prompt
118
+ * @example
119
+ * ```typescript
120
+ * .withInitialPrompt("Help me process this insurance claim")
121
+ * ```
122
+ */
123
+ withInitialPrompt(prompt) {
124
+ if (!this.config) {
125
+ throw new Error("Must call withWorkflow() before withInitialPrompt()");
126
+ }
127
+ this.config.initialUserInput = prompt;
128
+ return this;
129
+ }
130
+ /**
131
+ * Seed the ADK workflow with initial state.
132
+ *
133
+ * This allows passing state from external workflows or systems into the ADK workflow.
134
+ * The state is available to all agents via the session state.
135
+ *
136
+ * @param state - Initial state object
137
+ * @example
138
+ * ```typescript
139
+ * .withState({
140
+ * user_profile: { name: "John", id: "123" },
141
+ * context: { source: "typescript_workflow" }
142
+ * })
143
+ * ```
144
+ */
145
+ withState(state) {
146
+ if (!this.config) {
147
+ throw new Error("Must call withWorkflow() before withState()");
148
+ }
149
+ this.config.state = state;
150
+ return this;
151
+ }
152
+ /**
153
+ * Build the ADK node.
154
+ *
155
+ * Validates that the workflow configuration is set and returns the complete ADK node.
156
+ *
157
+ * @returns Complete ADK node definition
158
+ * @throws Error if workflow configuration is missing
159
+ */
160
+ build() {
161
+ if (!this.config) {
162
+ throw new Error("ADK workflow configuration is required. Call withWorkflow() before end().");
163
+ }
164
+ const node = {
165
+ id: this.id,
166
+ type: "adk",
167
+ config: this.config,
168
+ dependencies: this.dependencies.length > 0 ? this.dependencies : undefined,
169
+ activityConfig: this.activityConfig,
170
+ };
171
+ return node;
172
+ }
173
+ }
174
+ exports.AdkNodeBuilder = AdkNodeBuilder;
175
+ //# sourceMappingURL=adk-node-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adk-node-builder.js","sourceRoot":"","sources":["../../src/core/adk-node-builder.ts"],"names":[],"mappings":";;;AACA,iEAA4D;AAC5D,iDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,cAAe,SAAQ,kCAA4B;IAAhE;;QAEU,iBAAY,GAAa,EAAE,CAAC;IAqJtC,CAAC;IAlJC;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,CAAC,SAAiE;QAC5E,MAAM,OAAO,GAAG,IAAI,yCAAkB,EAAE,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,GAAG,IAAc;QAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,MAAsB;QACvC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,MAAc;QAC1B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,sBAAsB,GAAG,MAAM,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,MAAc;QAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,KAA0B;QAClC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;QAED,MAAM,IAAI,GAAY;YACpB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;YAC1E,cAAc,EAAE,IAAI,CAAC,cAAc;SACpC,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAvJD,wCAuJC"}
@@ -0,0 +1,74 @@
1
+ import type { ADKWorkflowDefinition, AgentConfig, GlobalToolDefinition } from "@graph-compose/core";
2
+ /**
3
+ * Fluent builder for composing ADK workflow configurations.
4
+ *
5
+ * This builder provides a clean API for defining:
6
+ * - Agents (LLM, Sequential, Parallel, Loop)
7
+ * - Tools (HTTP, Agent)
8
+ * - Root agent and workflow settings
9
+ *
10
+ * Usage:
11
+ * ```typescript
12
+ * const workflow = builder
13
+ * .rootAgent("main_agent")
14
+ * .agent(createLlmAgent({ ... }))
15
+ * .httpTool(createHttpTool({ ... }))
16
+ * .build();
17
+ * ```
18
+ */
19
+ export declare class AdkWorkflowBuilder {
20
+ private agents;
21
+ private globalTools;
22
+ private rootAgentId?;
23
+ private maxOrchestrationCycles?;
24
+ /**
25
+ * Set the root agent ID (entry point for the workflow).
26
+ *
27
+ * @param agentId - ID of the agent that will be the workflow entry point
28
+ */
29
+ rootAgent(agentId: string): this;
30
+ /**
31
+ * Add an agent to the workflow.
32
+ *
33
+ * Use helper functions like createLlmAgent(), createSequentialAgent(), etc.
34
+ * to create agent configurations.
35
+ *
36
+ * @param agentConfig - Agent configuration to add
37
+ */
38
+ agent(agentConfig: AgentConfig): this;
39
+ /**
40
+ * Add an HTTP tool to the workflow.
41
+ *
42
+ * Use createHttpTool() helper to create the tool configuration.
43
+ *
44
+ * @param toolConfig - HTTP tool configuration to add
45
+ */
46
+ httpTool(toolConfig: GlobalToolDefinition): this;
47
+ /**
48
+ * Add an Agent tool to the workflow.
49
+ *
50
+ * Use createAgentTool() helper to create the tool configuration.
51
+ *
52
+ * @param toolConfig - Agent tool configuration to add
53
+ */
54
+ agentTool(toolConfig: GlobalToolDefinition): this;
55
+ /**
56
+ * Set the maximum orchestration cycles (workflow iterations).
57
+ *
58
+ * This provides a safety limit for autonomous workflows to prevent runaway execution.
59
+ *
60
+ * @param cycles - Maximum number of workflow iterations allowed
61
+ */
62
+ withMaxCycles(cycles: number): this;
63
+ /**
64
+ * Build the ADK workflow definition.
65
+ *
66
+ * Validates that all required fields are set and returns the complete
67
+ * workflow configuration.
68
+ *
69
+ * @returns Complete ADK workflow definition
70
+ * @throws Error if required fields are missing or validation fails
71
+ */
72
+ build(): ADKWorkflowDefinition;
73
+ }
74
+ //# sourceMappingURL=adk-workflow-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adk-workflow-builder.d.ts","sourceRoot":"","sources":["../../src/core/adk-workflow-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,sBAAsB,CAAC,CAAS;IAExC;;;;OAIG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKhC;;;;;;;OAOG;IACH,KAAK,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAKrC;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;IAUhD;;;;;;OAMG;IACH,SAAS,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;IAUjD;;;;;;OAMG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAQnC;;;;;;;;OAQG;IACH,KAAK,IAAI,qBAAqB;CAoD/B"}