-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Expand file tree
/
Copy pathbuiltin_nodes.py
More file actions
executable file
·123 lines (111 loc) · 4.21 KB
/
builtin_nodes.py
File metadata and controls
executable file
·123 lines (111 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
"""Register built-in workflow node types."""
from entity.configs.node.agent import AgentConfig
from entity.configs.node.human import HumanConfig
from entity.configs.node.subgraph import (
SubgraphConfig,
SubgraphFileConfig,
SubgraphInlineConfig,
register_subgraph_source,
)
from entity.configs.node.passthrough import PassthroughConfig
from entity.configs.node.literal import LiteralNodeConfig
from entity.configs.node.python_runner import PythonRunnerConfig
from entity.configs.node.loop_counter import LoopCounterConfig
from entity.configs.node.loop_timer import LoopTimerConfig
from entity.configs.node.template import TemplateNodeConfig
from runtime.node.executor.agent_executor import AgentNodeExecutor
from runtime.node.executor.human_executor import HumanNodeExecutor
from runtime.node.executor.passthrough_executor import PassthroughNodeExecutor
from runtime.node.executor.literal_executor import LiteralNodeExecutor
from runtime.node.executor.python_executor import PythonNodeExecutor
from runtime.node.executor.subgraph_executor import SubgraphNodeExecutor
from runtime.node.executor.loop_counter_executor import LoopCounterNodeExecutor
from runtime.node.executor.loop_timer_executor import LoopTimerNodeExecutor
from runtime.node.executor.template_executor import TemplateNodeExecutor
from runtime.node.registry import NodeCapabilities, register_node_type
register_node_type(
"agent",
config_cls=AgentConfig,
executor_cls=AgentNodeExecutor,
capabilities=NodeCapabilities(
default_role_field="role",
exposes_tools=True,
),
summary="Agent execution node backed by configured LLM/tool providers with support for tooling, memory, and thinking extensions.",
)
register_node_type(
"human",
config_cls=HumanConfig,
executor_cls=HumanNodeExecutor,
capabilities=NodeCapabilities(
resource_key="node_type:human",
resource_limit=1,
),
summary="Pauses graph and waits for human operator response",
)
register_node_type(
"subgraph",
config_cls=SubgraphConfig,
executor_cls=SubgraphNodeExecutor,
capabilities=NodeCapabilities(),
executor_factory=lambda context, subgraphs=None: SubgraphNodeExecutor(
context, subgraphs or {}
),
summary="Embeds (through file path or inline config) and runs another named subgraph within the current workflow",
)
register_node_type(
"python",
config_cls=PythonRunnerConfig,
executor_cls=PythonNodeExecutor,
capabilities=NodeCapabilities(
resource_key="node_type:python",
resource_limit=1,
),
summary="Executes repository Python snippets",
)
register_node_type(
"passthrough",
config_cls=PassthroughConfig,
executor_cls=PassthroughNodeExecutor,
capabilities=NodeCapabilities(),
summary="Forwards prior node output downstream without modification",
)
register_node_type(
"literal",
config_cls=LiteralNodeConfig,
executor_cls=LiteralNodeExecutor,
capabilities=NodeCapabilities(),
summary="Emits the configured text message every time it is triggered",
)
register_node_type(
"loop_counter",
config_cls=LoopCounterConfig,
executor_cls=LoopCounterNodeExecutor,
capabilities=NodeCapabilities(),
summary="Blocks downstream edges until the configured iteration limit is reached, then emits a message to release the loop.",
)
register_node_type(
"loop_timer",
config_cls=LoopTimerConfig,
executor_cls=LoopTimerNodeExecutor,
capabilities=NodeCapabilities(),
summary="Blocks downstream edges until the configured time limit is reached, then emits a message to release the loop.",
)
register_node_type(
"template",
config_cls=TemplateNodeConfig,
executor_cls=TemplateNodeExecutor,
capabilities=NodeCapabilities(),
summary="Blocks downstream edges until the configured time limit is reached, then emits a message to release the loop.",
)
# Register subgraph source types (file-based and inline config)
register_subgraph_source(
"config",
config_cls=SubgraphInlineConfig,
description="Inline subgraph definition embedded directly in the YAML graph",
)
register_subgraph_source(
"file",
config_cls=SubgraphFileConfig,
description="Reference an external YAML file containing the subgraph",
)