@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,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdkWorkflowBuilder = void 0;
4
+ /**
5
+ * Fluent builder for composing ADK workflow configurations.
6
+ *
7
+ * This builder provides a clean API for defining:
8
+ * - Agents (LLM, Sequential, Parallel, Loop)
9
+ * - Tools (HTTP, Agent)
10
+ * - Root agent and workflow settings
11
+ *
12
+ * Usage:
13
+ * ```typescript
14
+ * const workflow = builder
15
+ * .rootAgent("main_agent")
16
+ * .agent(createLlmAgent({ ... }))
17
+ * .httpTool(createHttpTool({ ... }))
18
+ * .build();
19
+ * ```
20
+ */
21
+ class AdkWorkflowBuilder {
22
+ constructor() {
23
+ this.agents = [];
24
+ this.globalTools = [];
25
+ }
26
+ /**
27
+ * Set the root agent ID (entry point for the workflow).
28
+ *
29
+ * @param agentId - ID of the agent that will be the workflow entry point
30
+ */
31
+ rootAgent(agentId) {
32
+ this.rootAgentId = agentId;
33
+ return this;
34
+ }
35
+ /**
36
+ * Add an agent to the workflow.
37
+ *
38
+ * Use helper functions like createLlmAgent(), createSequentialAgent(), etc.
39
+ * to create agent configurations.
40
+ *
41
+ * @param agentConfig - Agent configuration to add
42
+ */
43
+ agent(agentConfig) {
44
+ this.agents.push(agentConfig);
45
+ return this;
46
+ }
47
+ /**
48
+ * Add an HTTP tool to the workflow.
49
+ *
50
+ * Use createHttpTool() helper to create the tool configuration.
51
+ *
52
+ * @param toolConfig - HTTP tool configuration to add
53
+ */
54
+ httpTool(toolConfig) {
55
+ if (toolConfig.type !== "HttpTool") {
56
+ throw new Error(`httpTool() expects a HttpTool configuration, got ${toolConfig.type}`);
57
+ }
58
+ this.globalTools.push(toolConfig);
59
+ return this;
60
+ }
61
+ /**
62
+ * Add an Agent tool to the workflow.
63
+ *
64
+ * Use createAgentTool() helper to create the tool configuration.
65
+ *
66
+ * @param toolConfig - Agent tool configuration to add
67
+ */
68
+ agentTool(toolConfig) {
69
+ if (toolConfig.type !== "AgentTool") {
70
+ throw new Error(`agentTool() expects an AgentTool configuration, got ${toolConfig.type}`);
71
+ }
72
+ this.globalTools.push(toolConfig);
73
+ return this;
74
+ }
75
+ /**
76
+ * Set the maximum orchestration cycles (workflow iterations).
77
+ *
78
+ * This provides a safety limit for autonomous workflows to prevent runaway execution.
79
+ *
80
+ * @param cycles - Maximum number of workflow iterations allowed
81
+ */
82
+ withMaxCycles(cycles) {
83
+ if (cycles <= 0 || !Number.isInteger(cycles)) {
84
+ throw new Error("maxOrchestrationCycles must be a positive integer");
85
+ }
86
+ this.maxOrchestrationCycles = cycles;
87
+ return this;
88
+ }
89
+ /**
90
+ * Build the ADK workflow definition.
91
+ *
92
+ * Validates that all required fields are set and returns the complete
93
+ * workflow configuration.
94
+ *
95
+ * @returns Complete ADK workflow definition
96
+ * @throws Error if required fields are missing or validation fails
97
+ */
98
+ build() {
99
+ // Validation
100
+ if (!this.rootAgentId) {
101
+ throw new Error("Root agent ID is required. Call rootAgent() before build().");
102
+ }
103
+ if (this.agents.length === 0) {
104
+ throw new Error("At least one agent is required. Call agent() before build().");
105
+ }
106
+ // Validate that root agent exists in agents list
107
+ const rootAgentExists = this.agents.some((agent) => agent.id === this.rootAgentId);
108
+ if (!rootAgentExists) {
109
+ throw new Error(`Root agent "${this.rootAgentId}" not found in agents list. Make sure to add it with agent() before build().`);
110
+ }
111
+ // Validate agent IDs are unique
112
+ const agentIds = new Set();
113
+ for (const agent of this.agents) {
114
+ if (agentIds.has(agent.id)) {
115
+ throw new Error(`Duplicate agent ID: "${agent.id}"`);
116
+ }
117
+ agentIds.add(agent.id);
118
+ }
119
+ // Validate tool IDs are unique
120
+ const toolIds = new Set();
121
+ for (const tool of this.globalTools) {
122
+ if (toolIds.has(tool.id)) {
123
+ throw new Error(`Duplicate tool ID: "${tool.id}"`);
124
+ }
125
+ toolIds.add(tool.id);
126
+ }
127
+ // Build the workflow definition
128
+ const workflow = {
129
+ agents: this.agents,
130
+ rootAgentId: this.rootAgentId,
131
+ globalTools: this.globalTools,
132
+ maxOrchestrationCycles: this.maxOrchestrationCycles,
133
+ };
134
+ return workflow;
135
+ }
136
+ }
137
+ exports.AdkWorkflowBuilder = AdkWorkflowBuilder;
138
+ //# sourceMappingURL=adk-workflow-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adk-workflow-builder.js","sourceRoot":"","sources":["../../src/core/adk-workflow-builder.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,kBAAkB;IAA/B;QACU,WAAM,GAAkB,EAAE,CAAC;QAC3B,gBAAW,GAA2B,EAAE,CAAC;IAyInD,CAAC;IArIC;;;;OAIG;IACH,SAAS,CAAC,OAAe;QACvB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,WAAwB;QAC5B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,UAAgC;QACvC,IAAI,UAAU,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CACb,oDAAoD,UAAU,CAAC,IAAI,EAAE,CACtE,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CA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YAChC,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;YACvD,CAAC;YACD,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC;QAED,+BAA+B;QAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QAClC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACpC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;YACrD,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvB,CAAC;QAED,gCAAgC;QAChC,MAAM,QAAQ,GAA0B;YACtC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;SACpD,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA3ID,gDA2IC"}
@@ -0,0 +1,80 @@
1
+ import type { Node } from "@graph-compose/core";
2
+ import type { GraphCompose } from "./builder";
3
+ /**
4
+ * Base interface for all node builders.
5
+ * Defines the contract that all node builders must implement.
6
+ */
7
+ export interface BaseNodeBuilder<T extends Node> {
8
+ /**
9
+ * Get the node ID (used for error messages and tracking)
10
+ */
11
+ getId(): string;
12
+ /**
13
+ * Build the final node configuration.
14
+ * This is where the builder validates and constructs the node object.
15
+ */
16
+ build(): T;
17
+ /**
18
+ * Finalize the node definition and add it to the parent graph.
19
+ * This method should be called last in the builder chain.
20
+ * @returns The parent GraphCompose instance for further chaining
21
+ */
22
+ end(): GraphCompose;
23
+ }
24
+ /**
25
+ * Abstract base class for node builders with shared functionality.
26
+ *
27
+ * This class provides common implementation for:
28
+ * - ID management
29
+ * - Lifecycle management (end() method)
30
+ * - Integration with parent graph
31
+ *
32
+ * Subclasses must implement:
33
+ * - build(): Construct the specific node type
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * class MyNodeBuilder extends AbstractNodeBuilder<MyNode> {
38
+ * build(): MyNode {
39
+ * return {
40
+ * id: this.id,
41
+ * type: "my_type",
42
+ * // ... other config
43
+ * };
44
+ * }
45
+ * }
46
+ * ```
47
+ */
48
+ export declare abstract class AbstractNodeBuilder<T extends Node> implements BaseNodeBuilder<T> {
49
+ protected readonly graph: GraphCompose;
50
+ protected readonly id: string;
51
+ /**
52
+ * Creates a new node builder instance.
53
+ *
54
+ * @param graph The parent GraphCompose instance
55
+ * @param id The unique identifier for the node being built
56
+ */
57
+ constructor(graph: GraphCompose, id: string);
58
+ /**
59
+ * Get the node ID.
60
+ * Used for error messages and builder state tracking.
61
+ */
62
+ getId(): string;
63
+ /**
64
+ * Build the final node configuration.
65
+ * Must be implemented by subclasses to construct their specific node type.
66
+ */
67
+ abstract build(): T;
68
+ /**
69
+ * Finalize the node definition and add it to the parent graph.
70
+ *
71
+ * This method:
72
+ * 1. Calls build() to construct the node
73
+ * 2. Adds the node to the parent graph
74
+ * 3. Returns the graph for further chaining
75
+ *
76
+ * @returns The parent GraphCompose instance
77
+ */
78
+ end(): GraphCompose;
79
+ }
80
+ //# sourceMappingURL=base-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-builder.d.ts","sourceRoot":"","sources":["../../src/core/base-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,IAAI;IAC7C;;OAEG;IACH,KAAK,IAAI,MAAM,CAAC;IAEhB;;;OAGG;IACH,KAAK,IAAI,CAAC,CAAC;IAEX;;;;OAIG;IACH,GAAG,IAAI,YAAY,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,8BAAsB,mBAAmB,CAAC,CAAC,SAAS,IAAI,CACtD,YAAW,eAAe,CAAC,CAAC,CAAC;IAS3B,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,YAAY;IACtC,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM;IAR/B;;;;;OAKG;gBAEkB,KAAK,EAAE,YAAY,EACnB,EAAE,EAAE,MAAM;IAG/B;;;OAGG;IACH,KAAK,IAAI,MAAM;IAIf;;;OAGG;IACH,QAAQ,CAAC,KAAK,IAAI,CAAC;IAEnB;;;;;;;;;OASG;IACH,GAAG,IAAI,YAAY;CAKpB"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractNodeBuilder = void 0;
4
+ /**
5
+ * Abstract base class for node builders with shared functionality.
6
+ *
7
+ * This class provides common implementation for:
8
+ * - ID management
9
+ * - Lifecycle management (end() method)
10
+ * - Integration with parent graph
11
+ *
12
+ * Subclasses must implement:
13
+ * - build(): Construct the specific node type
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * class MyNodeBuilder extends AbstractNodeBuilder<MyNode> {
18
+ * build(): MyNode {
19
+ * return {
20
+ * id: this.id,
21
+ * type: "my_type",
22
+ * // ... other config
23
+ * };
24
+ * }
25
+ * }
26
+ * ```
27
+ */
28
+ class AbstractNodeBuilder {
29
+ /**
30
+ * Creates a new node builder instance.
31
+ *
32
+ * @param graph The parent GraphCompose instance
33
+ * @param id The unique identifier for the node being built
34
+ */
35
+ constructor(graph, id) {
36
+ this.graph = graph;
37
+ this.id = id;
38
+ }
39
+ /**
40
+ * Get the node ID.
41
+ * Used for error messages and builder state tracking.
42
+ */
43
+ getId() {
44
+ return this.id;
45
+ }
46
+ /**
47
+ * Finalize the node definition and add it to the parent graph.
48
+ *
49
+ * This method:
50
+ * 1. Calls build() to construct the node
51
+ * 2. Adds the node to the parent graph
52
+ * 3. Returns the graph for further chaining
53
+ *
54
+ * @returns The parent GraphCompose instance
55
+ */
56
+ end() {
57
+ const node = this.build();
58
+ this.graph._addNodeDefinition(node);
59
+ return this.graph;
60
+ }
61
+ }
62
+ exports.AbstractNodeBuilder = AbstractNodeBuilder;
63
+ //# sourceMappingURL=base-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-builder.js","sourceRoot":"","sources":["../../src/core/base-builder.ts"],"names":[],"mappings":";;;AA2BA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAsB,mBAAmB;IAGvC;;;;;OAKG;IACH,YACqB,KAAmB,EACnB,EAAU;QADV,UAAK,GAAL,KAAK,CAAc;QACnB,OAAE,GAAF,EAAE,CAAQ;IAC5B,CAAC;IAEJ;;;OAGG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAQD;;;;;;;;;OASG;IACH,GAAG;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AA3CD,kDA2CC"}
@@ -1,7 +1,7 @@
1
- import { Node, ToolNode, WorkflowConfig, WorkflowGraph } from "@graph-compose/core";
2
- import { ApiResponse, ValidationResult as ClientValidationResult, ExecuteOptions, GetWorkflowResponse, TerminateWorkflowResponse, WorkflowResponse } from "../types";
1
+ import { Node, WorkflowConfig, WorkflowGraph } from "@graph-compose/core";
2
+ import { ApiResponse, ClientValidationResult, ExecuteOptions, GetWorkflowResponse, TerminateWorkflowResponse, WorkflowResponse } from "../types";
3
3
  import { NodeBuilder } from "./node-builder";
4
- import { ToolBuilder } from "./tool-builder";
4
+ import { AdkNodeBuilder } from "./adk-node-builder";
5
5
  interface ApiValidationError {
6
6
  name: string;
7
7
  message: string;
@@ -17,7 +17,7 @@ export interface GraphComposeOptions {
17
17
  /**
18
18
  * GraphCompose is the main builder class for creating workflow graphs.
19
19
  * It provides a fluent API for building and executing workflows composed of HTTP nodes, agents, and error boundaries.
20
- * You configure each node or tool using chained methods and **must** call `.end()` to finalize its definition.
20
+ * You configure each node using chained methods and **must** call `.end()` to finalize its definition.
21
21
  *
22
22
  * @example
23
23
  * ```typescript
@@ -29,30 +29,26 @@ export interface GraphComposeOptions {
29
29
  * .withHeaders({ "Authorization": "Bearer token" })
30
30
  * .end(); // Required!
31
31
  *
32
- * // Define and end a tool (example)
33
- * graph.tool("analyze")
34
- * .post("https://api.example.com/analyze")
35
- * .end();
36
- *
37
- * // Create and finalize an agent node that uses the tool
38
- * graph.agent("process_data")
39
- * .withMaxIterations(5)
40
- * .withTools(["analyze"])
41
- * .post("https://api.example.com/agent")
32
+ * // Create and finalize another node with dependencies
33
+ * graph.node("process_data")
34
+ * .post("https://api.example.com/process")
42
35
  * .withDependencies(["fetch_data"])
36
+ * .withBody(({ results }) => ({
37
+ * data: results.fetch_data
38
+ * }))
43
39
  * .end(); // Required!
44
40
  *
45
- * // Validate the complete workflow (requires all nodes/tools ended)
41
+ * // Validate the complete workflow (requires all nodes ended)
46
42
  * const validationResult = graph.validate();
47
43
  * if (!validationResult.isValid) { console.error("Validation failed:", validationResult.errors); }
48
44
  *
49
- * // Execute the workflow (requires all nodes/tools ended)
45
+ * // Execute the workflow (requires all nodes ended)
50
46
  * try {
51
47
  * const result = await graph.execute({});
52
48
  * console.log("Execution started:", result);
53
49
  * } catch (error) { console.error("Execution failed:", error); }
54
50
  *
55
- * // Get the raw workflow definition (requires all nodes/tools ended)
51
+ * // Get the raw workflow definition (requires all nodes ended)
56
52
  * const definition = graph.toJSON();
57
53
  * console.log("Workflow JSON:", JSON.stringify(definition, null, 2));
58
54
  *
@@ -63,9 +59,7 @@ export interface GraphComposeOptions {
63
59
  */
64
60
  export declare class GraphCompose {
65
61
  private nodes;
66
- private _tools;
67
62
  private currentNodeBuilder?;
68
- private currentToolBuilder?;
69
63
  private webhookUrl?;
70
64
  private context?;
71
65
  private workflowConfig?;
@@ -78,8 +72,6 @@ export declare class GraphCompose {
78
72
  * @throws {Error} If no API token is provided via options or environment variable
79
73
  */
80
74
  constructor(options?: GraphComposeOptions);
81
- /** Internal method for ToolBuilder to add its definition */
82
- _addToolDefinition(tool: ToolNode): void;
83
75
  /** Internal method for NodeBuilder to add its definition */
84
76
  _addNodeDefinition(node: Node): void;
85
77
  /**
@@ -126,40 +118,35 @@ export declare class GraphCompose {
126
118
  */
127
119
  errorBoundary(id: string, protectedNodes: string[]): NodeBuilder;
128
120
  /**
129
- * Start building a new agent node.
130
- * Agent nodes are special nodes that can execute multiple iterations and use tools.
131
- * **Note:** You must call `.end()` on the returned `NodeBuilder` before starting another node or finishing the graph.
121
+ * Start building a new ADK (Agent Development Kit) node.
122
+ * ADK nodes enable agentic workflows with multi-agent orchestration.
123
+ * **Note:** You must call `.end()` on the returned `AdkNodeBuilder` before starting another node or finishing the graph.
132
124
  *
133
125
  * @param id Unique identifier for the node (must be alphanumeric with underscores)
134
- * @returns NodeBuilder instance for method chaining
135
- * @throws {Error} If another node or tool is currently being built.
136
- * @example
137
- * ```typescript
138
- * graph.agent("research_agent")
139
- * .withMaxIterations(10)
140
- * .withTools(["search", "analyze"])
141
- * .post("https://api.example.com/agent")
142
- * .end(); // Required!
143
- * ```
144
- */
145
- agent(id: string): NodeBuilder;
146
- /**
147
- * Start building a new tool definition.
148
- * Tools are reusable components (HTTP calls or sub-graphs) usable by agent nodes.
149
- * **Note:** You must call `.end()` on the returned `ToolBuilder` before starting another tool/node or finishing the graph.
150
- *
151
- * @param id Unique identifier for the tool (must be alphanumeric with underscores)
152
- * @returns ToolBuilder instance for method chaining
126
+ * @returns AdkNodeBuilder instance for method chaining
153
127
  * @throws {Error} If another node or tool is currently being built.
154
128
  * @example
155
129
  * ```typescript
156
- * graph.tool("search")
157
- * .get("https://api.search.com")
158
- * .withHeaders({ "Authorization": "Bearer token" })
130
+ * graph.adk("customer_support")
131
+ * .withWorkflow(builder =>
132
+ * builder
133
+ * .rootAgent("support_agent")
134
+ * .agent(createLlmAgent({
135
+ * id: "support_agent",
136
+ * httpConfig: { url: "https://llm.example.com", method: "POST" },
137
+ * tools: ["search_kb"],
138
+ * outputKey: "support_response"
139
+ * }))
140
+ * .httpTool(createHttpTool({
141
+ * id: "search_kb",
142
+ * httpConfig: { url: "https://kb.example.com/search", method: "POST" }
143
+ * }))
144
+ * .build()
145
+ * )
159
146
  * .end(); // Required!
160
147
  * ```
161
148
  */
162
- tool(id: string): ToolBuilder;
149
+ adk(id: string): AdkNodeBuilder;
163
150
  /**
164
151
  * Add a pre-configured node to the workflow.
165
152
  * Ensures no other builder is active before adding.
@@ -169,15 +156,6 @@ export declare class GraphCompose {
169
156
  * @throws {Error} If another node or tool is currently being built.
170
157
  */
171
158
  addNode(node: Node): GraphCompose;
172
- /**
173
- * Add a pre-configured tool definition to the workflow.
174
- * Ensures no other builder is active before adding.
175
- *
176
- * @param tool The tool configuration to add
177
- * @returns this GraphCompose instance for method chaining
178
- * @throws {Error} If another node or tool is currently being built.
179
- */
180
- addTool(tool: ToolNode): GraphCompose;
181
159
  /**
182
160
  * Get the complete workflow definition object.
183
161
  * This includes all nodes, tools, webhook URL, context, and workflow configuration.
@@ -203,9 +181,8 @@ export declare class GraphCompose {
203
181
  * - Valid node IDs
204
182
  * - Valid URLs
205
183
  * - Valid dependencies
206
- * - Valid tool configurations
207
184
  * - No circular dependencies
208
- * - Agent-specific requirements (e.g., `max_iterations` presence and value)
185
+ * - Valid error boundary configurations
209
186
  *
210
187
  * Note: This performs client-side validation only. Use `validateApi()` for server-side checks including tier limits.
211
188
  *
@@ -277,15 +254,6 @@ export declare class GraphCompose {
277
254
  * ```
278
255
  */
279
256
  execute(options?: Omit<ExecuteOptions, "token" | "baseUrl">): Promise<ApiResponse<WorkflowResponse | null>>;
280
- /**
281
- * Execute the workflow synchronously and wait for completion.
282
- * **Note:** Requires all active builders to be finalized using `.end()`.
283
- *
284
- * @param options Execution options including webhook URL and context
285
- * @returns Promise resolving to the full API response containing the final workflow details (status, results, error) upon completion or failure.
286
- * @throws {Error} If a node or tool is currently being built (missing `.end()`).
287
- */
288
- executeSync(options?: Omit<ExecuteOptions, "token" | "baseUrl">): Promise<ApiResponse<WorkflowResponse | null>>;
289
257
  /**
290
258
  * Set the webhook URL for workflow notifications.
291
259
  * **Note:** Requires all active builders to be finalized using `.end()`.
@@ -1 +1 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/core/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpF,OAAO,EACL,WAAW,EACX,gBAAgB,IAAI,sBAAsB,EAC1C,cAAc,EACd,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,UAAU,mBAAmB;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,iGAAiG;IACjG,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAA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