realtimex-agent-flows 0.3.2__tar.gz
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.
- realtimex_agent_flows-0.3.2/.gitignore +284 -0
- realtimex_agent_flows-0.3.2/PKG-INFO +368 -0
- realtimex_agent_flows-0.3.2/README.md +342 -0
- realtimex_agent_flows-0.3.2/docs/executors/web_scraping/README.md +201 -0
- realtimex_agent_flows-0.3.2/pyproject.toml +211 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/__init__.py +63 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/api/__init__.py +5 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/api/error_mapping.py +85 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/api/http_client.py +236 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/__init__.py +38 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/execution/__init__.py +50 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/execution/executor.py +511 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/execution/registry.py +138 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/execution/runner.py +200 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/execution/state.py +224 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/execution/step_executor.py +301 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/flows/__init__.py +30 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/flows/cache.py +124 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/flows/loader.py +114 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/flows/registry.py +196 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/resources/__init__.py +35 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/resources/credentials.py +289 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/resources/interpolation.py +292 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/resources/mcp_sessions.py +88 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/core/resources/variables.py +274 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/exceptions.py +249 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/__init__.py +67 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/api_call.py +742 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/base.py +58 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/code_interpreter.py +268 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/conditional.py +296 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/finish.py +156 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/flow_variables.py +139 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/llm_instruction.py +365 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/loop.py +573 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/mcp_server_action.py +350 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/stream_ui.py +222 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/switch.py +343 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/web_scraping.py +435 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/executors/web_search.py +413 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/integrations/__init__.py +33 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/integrations/llm_providers.py +320 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/integrations/mcp_client.py +295 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/__init__.py +18 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/config.py +289 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/credentials.py +36 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/execution.py +203 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/__init__.py +45 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/api_call.py +44 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/code_interpreter.py +114 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/conditional.py +20 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/finish.py +56 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/flow_variables.py +30 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/llm_instruction.py +141 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/loop.py +79 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/mcp_server_action.py +33 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/stream_ui.py +133 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/switch.py +40 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/web_scraping.py +428 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/web_scraping.py.backup +279 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/executors/web_search.py +117 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/flow.py +98 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/shared/__init__.py +91 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/shared/enums.py +148 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/shared/mixins.py +88 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/shared/types.py +370 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/shared/validators.py +226 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/models/test.py +148 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/services/__init__.py +5 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/services/ui_component_processor.py +248 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/streaming/__init__.py +19 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/streaming/handler.py +183 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/streaming/models.py +138 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/utils/__init__.py +7 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/utils/condition_evaluator.py +351 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/utils/config.py +22 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/utils/dict_utils.py +62 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/utils/logging.py +432 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/utils/mcp_helpers.py +173 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/utils/path_utils.py +78 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/utils/test_utils.py +46 -0
- realtimex_agent_flows-0.3.2/src/agent_flows/utils/validation.py +72 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
### macOS ###
|
|
2
|
+
# General
|
|
3
|
+
.DS_Store
|
|
4
|
+
.AppleDouble
|
|
5
|
+
.LSOverride
|
|
6
|
+
|
|
7
|
+
# Icon must end with two \r
|
|
8
|
+
Icon
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Thumbnails
|
|
12
|
+
._*
|
|
13
|
+
|
|
14
|
+
# Files that might appear in the root of a volume
|
|
15
|
+
.DocumentRevisions-V100
|
|
16
|
+
.fseventsd
|
|
17
|
+
.Spotlight-V100
|
|
18
|
+
.TemporaryItems
|
|
19
|
+
.Trashes
|
|
20
|
+
.VolumeIcon.icns
|
|
21
|
+
.com.apple.timemachine.donotpresent
|
|
22
|
+
|
|
23
|
+
# Directories potentially created on remote AFP share
|
|
24
|
+
.AppleDB
|
|
25
|
+
.AppleDesktop
|
|
26
|
+
Network Trash Folder
|
|
27
|
+
Temporary Items
|
|
28
|
+
.apdisk
|
|
29
|
+
|
|
30
|
+
### macOS Patch ###
|
|
31
|
+
# iCloud generated files
|
|
32
|
+
*.icloud
|
|
33
|
+
|
|
34
|
+
### Python ###
|
|
35
|
+
# Byte-compiled / optimized / DLL files
|
|
36
|
+
__pycache__/
|
|
37
|
+
*.py[cod]
|
|
38
|
+
*$py.class
|
|
39
|
+
|
|
40
|
+
# C extensions
|
|
41
|
+
*.so
|
|
42
|
+
|
|
43
|
+
# Distribution / packaging
|
|
44
|
+
.Python
|
|
45
|
+
build/
|
|
46
|
+
develop-eggs/
|
|
47
|
+
dist/
|
|
48
|
+
downloads/
|
|
49
|
+
eggs/
|
|
50
|
+
.eggs/
|
|
51
|
+
lib/
|
|
52
|
+
lib64/
|
|
53
|
+
parts/
|
|
54
|
+
sdist/
|
|
55
|
+
var/
|
|
56
|
+
wheels/
|
|
57
|
+
share/python-wheels/
|
|
58
|
+
*.egg-info/
|
|
59
|
+
.installed.cfg
|
|
60
|
+
*.egg
|
|
61
|
+
MANIFEST
|
|
62
|
+
|
|
63
|
+
# PyInstaller
|
|
64
|
+
# Usually these files are written by a python script from a template
|
|
65
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
66
|
+
*.manifest
|
|
67
|
+
*.spec
|
|
68
|
+
|
|
69
|
+
# Installer logs
|
|
70
|
+
pip-log.txt
|
|
71
|
+
pip-delete-this-directory.txt
|
|
72
|
+
|
|
73
|
+
# Unit test / coverage reports
|
|
74
|
+
htmlcov/
|
|
75
|
+
.tox/
|
|
76
|
+
.nox/
|
|
77
|
+
.coverage
|
|
78
|
+
.coverage.*
|
|
79
|
+
.cache
|
|
80
|
+
nosetests.xml
|
|
81
|
+
coverage.xml
|
|
82
|
+
*.cover
|
|
83
|
+
*.py,cover
|
|
84
|
+
.hypothesis/
|
|
85
|
+
.pytest_cache/
|
|
86
|
+
cover/
|
|
87
|
+
|
|
88
|
+
# Translations
|
|
89
|
+
*.mo
|
|
90
|
+
*.pot
|
|
91
|
+
|
|
92
|
+
# Django stuff:
|
|
93
|
+
*.log
|
|
94
|
+
local_settings.py
|
|
95
|
+
db.sqlite3
|
|
96
|
+
db.sqlite3-journal
|
|
97
|
+
|
|
98
|
+
# Flask stuff:
|
|
99
|
+
instance/
|
|
100
|
+
.webassets-cache
|
|
101
|
+
|
|
102
|
+
# Scrapy stuff:
|
|
103
|
+
.scrapy
|
|
104
|
+
|
|
105
|
+
# Sphinx documentation
|
|
106
|
+
docs/_build/
|
|
107
|
+
|
|
108
|
+
# PyBuilder
|
|
109
|
+
.pybuilder/
|
|
110
|
+
target/
|
|
111
|
+
|
|
112
|
+
# Jupyter Notebook
|
|
113
|
+
.ipynb_checkpoints
|
|
114
|
+
|
|
115
|
+
# IPython
|
|
116
|
+
profile_default/
|
|
117
|
+
ipython_config.py
|
|
118
|
+
|
|
119
|
+
# pyenv
|
|
120
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
121
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
122
|
+
# .python-version
|
|
123
|
+
|
|
124
|
+
# pipenv
|
|
125
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
126
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
127
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
128
|
+
# install all needed dependencies.
|
|
129
|
+
#Pipfile.lock
|
|
130
|
+
|
|
131
|
+
# poetry
|
|
132
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
133
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
134
|
+
# commonly ignored for libraries.
|
|
135
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
136
|
+
#poetry.lock
|
|
137
|
+
|
|
138
|
+
# pdm
|
|
139
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
140
|
+
#pdm.lock
|
|
141
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
142
|
+
# in version control.
|
|
143
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
144
|
+
.pdm.toml
|
|
145
|
+
|
|
146
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
147
|
+
__pypackages__/
|
|
148
|
+
|
|
149
|
+
# Celery stuff
|
|
150
|
+
celerybeat-schedule
|
|
151
|
+
celerybeat.pid
|
|
152
|
+
|
|
153
|
+
# SageMath parsed files
|
|
154
|
+
*.sage.py
|
|
155
|
+
|
|
156
|
+
# Environments
|
|
157
|
+
.env
|
|
158
|
+
.venv
|
|
159
|
+
env/
|
|
160
|
+
venv/
|
|
161
|
+
ENV/
|
|
162
|
+
env.bak/
|
|
163
|
+
venv.bak/
|
|
164
|
+
|
|
165
|
+
# Spyder project settings
|
|
166
|
+
.spyderproject
|
|
167
|
+
.spyproject
|
|
168
|
+
|
|
169
|
+
# Rope project settings
|
|
170
|
+
.ropeproject
|
|
171
|
+
|
|
172
|
+
# mkdocs documentation
|
|
173
|
+
/site
|
|
174
|
+
|
|
175
|
+
# mypy
|
|
176
|
+
.mypy_cache/
|
|
177
|
+
.dmypy.json
|
|
178
|
+
dmypy.json
|
|
179
|
+
|
|
180
|
+
# Pyre type checker
|
|
181
|
+
.pyre/
|
|
182
|
+
|
|
183
|
+
# pytype static type analyzer
|
|
184
|
+
.pytype/
|
|
185
|
+
|
|
186
|
+
# Cython debug symbols
|
|
187
|
+
cython_debug/
|
|
188
|
+
|
|
189
|
+
# PyCharm
|
|
190
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
191
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
192
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
193
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
194
|
+
#.idea/
|
|
195
|
+
|
|
196
|
+
### Python Patch ###
|
|
197
|
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
|
198
|
+
poetry.toml
|
|
199
|
+
|
|
200
|
+
# ruff
|
|
201
|
+
.ruff_cache/
|
|
202
|
+
|
|
203
|
+
# LSP config files
|
|
204
|
+
pyrightconfig.json
|
|
205
|
+
|
|
206
|
+
### venv ###
|
|
207
|
+
# Virtualenv
|
|
208
|
+
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
|
|
209
|
+
[Bb]in
|
|
210
|
+
[Ii]nclude
|
|
211
|
+
[Ll]ib
|
|
212
|
+
[Ll]ib64
|
|
213
|
+
[Ll]ocal
|
|
214
|
+
[Ss]cripts
|
|
215
|
+
pyvenv.cfg
|
|
216
|
+
pip-selfcheck.json
|
|
217
|
+
|
|
218
|
+
### VisualStudioCode ###
|
|
219
|
+
.vscode/*
|
|
220
|
+
!.vscode/settings.json
|
|
221
|
+
!.vscode/tasks.json
|
|
222
|
+
!.vscode/launch.json
|
|
223
|
+
!.vscode/extensions.json
|
|
224
|
+
!.vscode/*.code-snippets
|
|
225
|
+
|
|
226
|
+
# Local History for Visual Studio Code
|
|
227
|
+
.history/
|
|
228
|
+
|
|
229
|
+
# Built Visual Studio Code Extensions
|
|
230
|
+
*.vsix
|
|
231
|
+
|
|
232
|
+
### VisualStudioCode Patch ###
|
|
233
|
+
# Ignore all local history of files
|
|
234
|
+
.history
|
|
235
|
+
.ionide
|
|
236
|
+
|
|
237
|
+
### Windows ###
|
|
238
|
+
# Windows thumbnail cache files
|
|
239
|
+
Thumbs.db
|
|
240
|
+
Thumbs.db:encryptable
|
|
241
|
+
ehthumbs.db
|
|
242
|
+
ehthumbs_vista.db
|
|
243
|
+
|
|
244
|
+
# Dump file
|
|
245
|
+
*.stackdump
|
|
246
|
+
|
|
247
|
+
# Folder config file
|
|
248
|
+
[Dd]esktop.ini
|
|
249
|
+
|
|
250
|
+
# Recycle Bin used on file shares
|
|
251
|
+
$RECYCLE.BIN/
|
|
252
|
+
|
|
253
|
+
# Windows Installer files
|
|
254
|
+
*.cab
|
|
255
|
+
*.msi
|
|
256
|
+
*.msix
|
|
257
|
+
*.msm
|
|
258
|
+
*.msp
|
|
259
|
+
|
|
260
|
+
# Windows shortcuts
|
|
261
|
+
*.lnk
|
|
262
|
+
|
|
263
|
+
# App-specific
|
|
264
|
+
!scripts/
|
|
265
|
+
.tasks/
|
|
266
|
+
debug_logs/
|
|
267
|
+
debug/
|
|
268
|
+
perf/
|
|
269
|
+
# docs/
|
|
270
|
+
reports/
|
|
271
|
+
TODO
|
|
272
|
+
README.md
|
|
273
|
+
note.md
|
|
274
|
+
prompt.md
|
|
275
|
+
demo.py
|
|
276
|
+
dev/
|
|
277
|
+
!docs/executors/web_scraping/README.md
|
|
278
|
+
web_scraping_mcp
|
|
279
|
+
!realtimex/*
|
|
280
|
+
agent-flows/*
|
|
281
|
+
docs/executors/stream_ui/
|
|
282
|
+
debug_configs/
|
|
283
|
+
fusesell-check/
|
|
284
|
+
!agent_flows/core/execution/stages/README.md
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: realtimex-agent-flows
|
|
3
|
+
Version: 0.3.2
|
|
4
|
+
Summary: Python library for executing Agent Flows - visual, no-code workflows for AI agents
|
|
5
|
+
Author-email: RealTimeX Team <info@realtimex.ai>
|
|
6
|
+
Keywords: agents,ai,automation,llm,workflows
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: aiofiles>=23.2.0
|
|
9
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
10
|
+
Requires-Dist: cryptography==44.0.3
|
|
11
|
+
Requires-Dist: jmespath>=1.0.1
|
|
12
|
+
Requires-Dist: jsonpath-ng>=1.6.0
|
|
13
|
+
Requires-Dist: litellm>=1.76.3
|
|
14
|
+
Requires-Dist: mcp>=1.0.0
|
|
15
|
+
Requires-Dist: pydantic>=2.5.0
|
|
16
|
+
Requires-Dist: python-dotenv>=1.1.1
|
|
17
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
18
|
+
Requires-Dist: realtimex-web-scraping-mcp-server
|
|
19
|
+
Requires-Dist: realtimex-web-search-mcp-server
|
|
20
|
+
Requires-Dist: redis>=6.4.0
|
|
21
|
+
Requires-Dist: simpleeval>=1.0.3
|
|
22
|
+
Requires-Dist: structlog>=23.2.0
|
|
23
|
+
Requires-Dist: tenacity>=8.2.0
|
|
24
|
+
Requires-Dist: typing-extensions>=4.8.0
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# Agent Flows Python Package
|
|
28
|
+
|
|
29
|
+
A powerful Python library for executing Agent Flows - visual, no-code workflows that integrate seamlessly into Python applications.
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **Multiple Executors**: Built-in support for 8 different executor types (API calls, LLM instructions, MCP servers, etc.)
|
|
34
|
+
- **Flow Initialization**: Use the `flow_variables` step type (`start` remains as a deprecated alias) to seed runtime data consistently across flows.
|
|
35
|
+
- **MCP Integration**: Native support for Model Context Protocol (MCP) servers and tools
|
|
36
|
+
- **Flexible Usage**: Run flows from RealTimeX instances or local JSON files
|
|
37
|
+
- **Simple API**: Easy-to-use methods with explicit parameters
|
|
38
|
+
- **CLI Interface**: Command-line tools with `uvx` support (no installation required)
|
|
39
|
+
- **Async & Sync**: Both async/await and synchronous execution options
|
|
40
|
+
- **Type Safety**: Full type hints and Pydantic validation
|
|
41
|
+
- **JSON Configuration**: Simple, consistent configuration format
|
|
42
|
+
- **Testing Framework**: Deep pinning support for testing flows without API costs, including composite nodes (loops, conditionals)
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
### Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Install via pip
|
|
50
|
+
pip install agent-flows
|
|
51
|
+
|
|
52
|
+
# Or use with uvx for one-time execution (no installation required)
|
|
53
|
+
uvx agent-flows execute --flow-id <uuid> --api-key <key> --base-url <url>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Configuration
|
|
57
|
+
|
|
58
|
+
Configure using environment variables:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
export AGENT_FLOWS_API_KEY="your-realtimex-api-key"
|
|
62
|
+
export AGENT_FLOWS_BASE_URL="https://your-realtimex-instance.com"
|
|
63
|
+
export LITELLM_API_KEY="your-llm-api-key"
|
|
64
|
+
|
|
65
|
+
# For MCP server integration
|
|
66
|
+
export MCP_ACI_API_KEY="your-aci-api-key"
|
|
67
|
+
export MCP_ACI_LINKED_ACCOUNT_OWNER_ID="your-linked-account-owner-id"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
### 1. Execute Flows from RealTimeX
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
import asyncio
|
|
76
|
+
from agent_flows import FlowExecutor, AgentFlowsConfig, LiteLLMConfig
|
|
77
|
+
|
|
78
|
+
# Option 1: Use environment variables (recommended)
|
|
79
|
+
executor = FlowExecutor()
|
|
80
|
+
|
|
81
|
+
# Option 2: Create explicit configuration
|
|
82
|
+
system_config = AgentFlowsConfig(
|
|
83
|
+
api_key="your-realtimex-api-key",
|
|
84
|
+
base_url="https://your-realtimex-instance.com",
|
|
85
|
+
litellm=LiteLLMConfig(
|
|
86
|
+
api_key="your-llm-api-key",
|
|
87
|
+
api_base="https://api.openai.com/v1"
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
executor = FlowExecutor(config=system_config)
|
|
91
|
+
|
|
92
|
+
# Execute flow with explicit parameters
|
|
93
|
+
result = await executor.execute_flow(
|
|
94
|
+
flow_id="550e8400-e29b-41d4-a716-446655440000",
|
|
95
|
+
variables={"input_param": "value", "max_results": 10}
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
print(f"Success: {result.success}")
|
|
99
|
+
print(f"Steps executed: {result.steps_executed}")
|
|
100
|
+
print(f"Execution time: {result.execution_time:.2f}s")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 2. Execute Local Flow Files
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from agent_flows import FlowExecutor
|
|
107
|
+
|
|
108
|
+
# Create executor from local flow file (uses environment variables for LLM/API config)
|
|
109
|
+
executor = FlowExecutor.from_file(
|
|
110
|
+
flow_file="examples/1_basic_executors/start.json"
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# Execute with explicit parameters
|
|
114
|
+
result = await executor.execute_flow(
|
|
115
|
+
variables={"name": "World", "greeting": "Hello"}
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
print(f"Local flow result: {result.success}")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 3. Synchronous Execution (No async/await)
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from agent_flows import FlowExecutor
|
|
125
|
+
|
|
126
|
+
# Create executor (uses environment variables)
|
|
127
|
+
executor = FlowExecutor.from_file(flow_file="examples/simple_flow.json")
|
|
128
|
+
|
|
129
|
+
# Run synchronously with explicit parameters
|
|
130
|
+
result = executor.run(
|
|
131
|
+
variables={"name": "World"}
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
print(f"Success: {result.success}")
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 4. Configuration Options
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from agent_flows import FlowExecutor, AgentFlowsConfig
|
|
141
|
+
|
|
142
|
+
# Option 1: From environment variables (recommended)
|
|
143
|
+
executor = FlowExecutor() # Uses AGENT_FLOWS_* env vars
|
|
144
|
+
|
|
145
|
+
# Option 2: Explicit configuration
|
|
146
|
+
system_config = AgentFlowsConfig(
|
|
147
|
+
api_key="your-key",
|
|
148
|
+
base_url="https://your-instance.com"
|
|
149
|
+
)
|
|
150
|
+
executor = FlowExecutor(config=system_config)
|
|
151
|
+
|
|
152
|
+
# Option 3: From flow dictionary
|
|
153
|
+
flow_dict = {"uuid": "123", "name": "Test", "steps": [...]}
|
|
154
|
+
executor = FlowExecutor.from_dict(flow_dict=flow_dict)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### CLI Usage
|
|
158
|
+
|
|
159
|
+
#### Execute flows from RealTimeX
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Execute with environment variables (recommended)
|
|
163
|
+
agent-flows execute \
|
|
164
|
+
--flow-id "550e8400-e29b-41d4-a716-446655440000"
|
|
165
|
+
|
|
166
|
+
# Execute with inline config
|
|
167
|
+
agent-flows execute \
|
|
168
|
+
--flow-id "550e8400-e29b-41d4-a716-446655440000" \
|
|
169
|
+
--config '{"api_key":"key","base_url":"url","litellm":{"api_key":"llm-key"}}'
|
|
170
|
+
|
|
171
|
+
# Execute with variables
|
|
172
|
+
agent-flows execute \
|
|
173
|
+
--flow-id "550e8400-e29b-41d4-a716-446655440000" \
|
|
174
|
+
--variables '{"input_text":"Hello World","max_results":10}'
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Execute local flow files
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Run a local flow file
|
|
181
|
+
agent-flows run examples/1_basic_executors/start.json
|
|
182
|
+
|
|
183
|
+
# Run with variables (JSON string)
|
|
184
|
+
agent-flows run examples/3_workflows/2_breaking_news_to_linkedin/flow.json \
|
|
185
|
+
--variables '{"name":"John","age":30}'
|
|
186
|
+
|
|
187
|
+
# Run with variables from file
|
|
188
|
+
agent-flows run examples/3_workflows/2_breaking_news_to_linkedin/flow.json \
|
|
189
|
+
--variables-file examples/3_workflows/2_breaking_news_to_linkedin/variables.json
|
|
190
|
+
|
|
191
|
+
# Run with explicit config for LLM settings
|
|
192
|
+
agent-flows run examples/3_workflows/2_breaking_news_to_linkedin/flow.json \
|
|
193
|
+
--config '{"litellm":{"api_key":"your-llm-key"}}'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### Using uvx (no installation required)
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Execute a flow with uvx
|
|
200
|
+
uvx agent-flows execute \
|
|
201
|
+
--flow-id "550e8400-e29b-41d4-a716-446655440000" \
|
|
202
|
+
--config '{"api_key":"key","base_url":"url","litellm":{"api_key":"llm-key"}}'
|
|
203
|
+
|
|
204
|
+
# Run a local flow with uvx
|
|
205
|
+
uvx agent-flows run examples/1_basic_executors/start.json \
|
|
206
|
+
--variables '{"greeting":"Hello from uvx!"}'
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Supported Flow Types
|
|
210
|
+
|
|
211
|
+
The package includes **8 built-in executors**:
|
|
212
|
+
|
|
213
|
+
- **Flow Variables**: Variable initialization and flow setup
|
|
214
|
+
- **API Call**: HTTP requests with full REST API support and retry logic
|
|
215
|
+
- **LLM Instruction**: Multi-provider LLM integration (OpenAI, Anthropic, etc.)
|
|
216
|
+
- **Web Scraping**: Content extraction with CSS selectors and auto-summarization
|
|
217
|
+
- **Conditional**: Branching logic with multiple comparison operators
|
|
218
|
+
- **Switch**: Multi-case routing based on variable values
|
|
219
|
+
- **Loop**: Iterative execution with for/while/forEach support and clean output format
|
|
220
|
+
- **MCP Server Action**: Execute actions on Model Context Protocol (MCP) servers
|
|
221
|
+
|
|
222
|
+
For detailed documentation on each executor, see [docs/executors/](docs/executors/).
|
|
223
|
+
|
|
224
|
+
## MCP Integration
|
|
225
|
+
|
|
226
|
+
Agent Flows provides native support for Model Context Protocol (MCP) servers, enabling seamless integration with external tools and services.
|
|
227
|
+
|
|
228
|
+
### MCP Server Examples
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
# Send email via Gmail MCP server
|
|
232
|
+
{
|
|
233
|
+
"type": "mcpServerAction",
|
|
234
|
+
"config": {
|
|
235
|
+
"provider": "remote",
|
|
236
|
+
"serverId": "GMAIL",
|
|
237
|
+
"action": "GMAIL__SEND_EMAIL",
|
|
238
|
+
"params": {
|
|
239
|
+
"to": "recipient@example.com",
|
|
240
|
+
"subject": "Hello from Agent Flows",
|
|
241
|
+
"body": "This email was sent via MCP integration!"
|
|
242
|
+
},
|
|
243
|
+
"resultVariable": "email_result"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
# Upload file to Google Drive
|
|
248
|
+
{
|
|
249
|
+
"type": "mcpServerAction",
|
|
250
|
+
"config": {
|
|
251
|
+
"provider": "remote",
|
|
252
|
+
"serverId": "GOOGLE_DRIVE",
|
|
253
|
+
"action": "DRIVE__UPLOAD_FILE",
|
|
254
|
+
"params": {
|
|
255
|
+
"fileName": "report.pdf",
|
|
256
|
+
"fileContent": "${file_data}",
|
|
257
|
+
"folderId": "${target_folder}"
|
|
258
|
+
},
|
|
259
|
+
"resultVariable": "upload_result"
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Available MCP Servers
|
|
265
|
+
|
|
266
|
+
- **Gmail**: Email operations (send, read, manage)
|
|
267
|
+
- **Google Drive**: File operations (upload, download, organize)
|
|
268
|
+
- **Google Calendar**: Calendar management (create events, schedule meetings)
|
|
269
|
+
- **Slack**: Messaging and channel operations
|
|
270
|
+
- **Database**: Query execution and data management
|
|
271
|
+
- **File Manager**: Local file system operations
|
|
272
|
+
|
|
273
|
+
### MCP Configuration
|
|
274
|
+
|
|
275
|
+
Set up MCP integration using environment variables or configuration files:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Environment variables
|
|
279
|
+
export MCP_ACI_API_KEY="your-aci-api-key"
|
|
280
|
+
export MCP_ACI_LINKED_ACCOUNT_OWNER_ID="your-linked-account-owner-id"
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Or in your configuration:
|
|
284
|
+
|
|
285
|
+
```python
|
|
286
|
+
from agent_flows import AgentFlowsConfig
|
|
287
|
+
from agent_flows.models.config import MCPConfig
|
|
288
|
+
|
|
289
|
+
config = AgentFlowsConfig(
|
|
290
|
+
mcp=MCPConfig(
|
|
291
|
+
aci_api_key="your-aci-api-key",
|
|
292
|
+
aci_linked_account_owner_id="your-linked-account-owner-id"
|
|
293
|
+
)
|
|
294
|
+
)
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Architecture
|
|
298
|
+
|
|
299
|
+
The package follows a modular, extensible architecture:
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
agent_flows/
|
|
303
|
+
├── core/ # Core execution engine
|
|
304
|
+
├── executors/ # Block-specific executors
|
|
305
|
+
├── models/ # Pydantic data models
|
|
306
|
+
├── api/ # API client for flow fetching
|
|
307
|
+
├── cli/ # Command-line interface
|
|
308
|
+
└── utils/ # Utility functions
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## API Reference
|
|
312
|
+
|
|
313
|
+
### FlowExecutor Methods
|
|
314
|
+
|
|
315
|
+
```python
|
|
316
|
+
# Constructor
|
|
317
|
+
FlowExecutor(
|
|
318
|
+
config=None, # AgentFlowsConfig: System configuration (uses env vars if None)
|
|
319
|
+
flow_config=None, # FlowConfig: Local flow configuration
|
|
320
|
+
log_level="INFO", # str: Logging level (e.g., "DEBUG", "INFO", "WARNING")
|
|
321
|
+
log_json_format=False # bool: Format logs as JSON
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
# Class methods
|
|
325
|
+
FlowExecutor.from_file(
|
|
326
|
+
flow_file, # str: Path to flow JSON file
|
|
327
|
+
config=None, # AgentFlowsConfig: System configuration (uses env vars if None)
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
FlowExecutor.from_dict(
|
|
331
|
+
flow_dict, # dict: Flow configuration dictionary
|
|
332
|
+
config=None, # AgentFlowsConfig: System configuration (uses env vars if None)
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
# Execution methods
|
|
336
|
+
await executor.execute_flow(
|
|
337
|
+
flow_id=None, # str: Flow UUID (optional if flow_config provided)
|
|
338
|
+
variables=None, # dict: Flow variables
|
|
339
|
+
context=None # dict: Additional execution context
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
executor.run(
|
|
343
|
+
flow_id=None, # str: Flow UUID (optional if flow_config provided)
|
|
344
|
+
variables=None # dict: Flow variables
|
|
345
|
+
)
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Configuration Types
|
|
349
|
+
|
|
350
|
+
**System Configuration** (`AgentFlowsConfig`): API credentials and LLM settings
|
|
351
|
+
**Flow Configuration** (`FlowConfig`): The actual flow definition with steps
|
|
352
|
+
|
|
353
|
+
## Demo
|
|
354
|
+
|
|
355
|
+
Try the comprehensive demo:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
python demo_packaging.py
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## Requirements
|
|
362
|
+
|
|
363
|
+
- Python 3.8+
|
|
364
|
+
- Dependencies: aiohttp, pydantic, click, litellm
|
|
365
|
+
|
|
366
|
+
## License
|
|
367
|
+
|
|
368
|
+
MIT License
|