afmx 1.0.1__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.
Files changed (81) hide show
  1. afmx-1.0.1/LICENSE +177 -0
  2. afmx-1.0.1/PKG-INFO +361 -0
  3. afmx-1.0.1/README.md +290 -0
  4. afmx-1.0.1/afmx/__init__.py +82 -0
  5. afmx-1.0.1/afmx/__main__.py +29 -0
  6. afmx-1.0.1/afmx/_ui_block.py +40 -0
  7. afmx-1.0.1/afmx/_ui_spa_block.py +41 -0
  8. afmx-1.0.1/afmx/adapters/__init__.py +57 -0
  9. afmx-1.0.1/afmx/adapters/base.py +179 -0
  10. afmx-1.0.1/afmx/adapters/crewai.py +308 -0
  11. afmx-1.0.1/afmx/adapters/langchain.py +193 -0
  12. afmx-1.0.1/afmx/adapters/langgraph.py +336 -0
  13. afmx-1.0.1/afmx/adapters/openai.py +548 -0
  14. afmx-1.0.1/afmx/adapters/registry.py +149 -0
  15. afmx-1.0.1/afmx/api/__init__.py +20 -0
  16. afmx-1.0.1/afmx/api/adapter_routes.py +40 -0
  17. afmx-1.0.1/afmx/api/adapters_routes.py +3 -0
  18. afmx-1.0.1/afmx/api/admin_routes.py +199 -0
  19. afmx-1.0.1/afmx/api/audit_routes.py +140 -0
  20. afmx-1.0.1/afmx/api/matrix_routes.py +242 -0
  21. afmx-1.0.1/afmx/api/routes.py +583 -0
  22. afmx-1.0.1/afmx/api/schemas.py +131 -0
  23. afmx-1.0.1/afmx/api/websocket.py +149 -0
  24. afmx-1.0.1/afmx/audit/__init__.py +4 -0
  25. afmx-1.0.1/afmx/audit/model.py +118 -0
  26. afmx-1.0.1/afmx/audit/store.py +308 -0
  27. afmx-1.0.1/afmx/auth/__init__.py +11 -0
  28. afmx-1.0.1/afmx/auth/rbac.py +283 -0
  29. afmx-1.0.1/afmx/auth/store.py +267 -0
  30. afmx-1.0.1/afmx/cli.py +373 -0
  31. afmx-1.0.1/afmx/config.py +303 -0
  32. afmx-1.0.1/afmx/core/__init__.py +22 -0
  33. afmx-1.0.1/afmx/core/_engine_patch.py +1 -0
  34. afmx-1.0.1/afmx/core/concurrency.py +144 -0
  35. afmx-1.0.1/afmx/core/dispatcher.py +216 -0
  36. afmx-1.0.1/afmx/core/engine.py +521 -0
  37. afmx-1.0.1/afmx/core/executor.py +263 -0
  38. afmx-1.0.1/afmx/core/hooks.py +202 -0
  39. afmx-1.0.1/afmx/core/retry.py +245 -0
  40. afmx-1.0.1/afmx/core/router.py +173 -0
  41. afmx-1.0.1/afmx/core/variable_resolver.py +151 -0
  42. afmx-1.0.1/afmx/dashboard/node_modules/flatted/python/flatted.py +144 -0
  43. afmx-1.0.1/afmx/integrations/__init__.py +4 -0
  44. afmx-1.0.1/afmx/integrations/agentability_hook.py +454 -0
  45. afmx-1.0.1/afmx/main.py +348 -0
  46. afmx-1.0.1/afmx/middleware/__init__.py +8 -0
  47. afmx-1.0.1/afmx/middleware/auth.py +33 -0
  48. afmx-1.0.1/afmx/middleware/logging.py +33 -0
  49. afmx-1.0.1/afmx/middleware/rate_limit.py +122 -0
  50. afmx-1.0.1/afmx/middleware/rbac.py +227 -0
  51. afmx-1.0.1/afmx/models/__init__.py +15 -0
  52. afmx-1.0.1/afmx/models/edge.py +127 -0
  53. afmx-1.0.1/afmx/models/execution.py +139 -0
  54. afmx-1.0.1/afmx/models/matrix.py +151 -0
  55. afmx-1.0.1/afmx/models/node.py +104 -0
  56. afmx-1.0.1/afmx/observability/__init__.py +7 -0
  57. afmx-1.0.1/afmx/observability/events.py +123 -0
  58. afmx-1.0.1/afmx/observability/metrics.py +171 -0
  59. afmx-1.0.1/afmx/observability/webhook.py +163 -0
  60. afmx-1.0.1/afmx/plugins/__init__.py +6 -0
  61. afmx-1.0.1/afmx/plugins/registry.py +164 -0
  62. afmx-1.0.1/afmx/runtime/__init__.py +7 -0
  63. afmx-1.0.1/afmx/runtime/agent_runner.py +68 -0
  64. afmx-1.0.1/afmx/runtime/tool_runner.py +66 -0
  65. afmx-1.0.1/afmx/startup_handlers.py +260 -0
  66. afmx-1.0.1/afmx/store/__init__.py +14 -0
  67. afmx-1.0.1/afmx/store/checkpoint.py +211 -0
  68. afmx-1.0.1/afmx/store/matrix_store.py +203 -0
  69. afmx-1.0.1/afmx/store/state_store.py +201 -0
  70. afmx-1.0.1/afmx/utils/__init__.py +42 -0
  71. afmx-1.0.1/afmx/utils/exceptions.py +109 -0
  72. afmx-1.0.1/afmx/utils/helpers.py +135 -0
  73. afmx-1.0.1/afmx.egg-info/PKG-INFO +361 -0
  74. afmx-1.0.1/afmx.egg-info/SOURCES.txt +79 -0
  75. afmx-1.0.1/afmx.egg-info/dependency_links.txt +1 -0
  76. afmx-1.0.1/afmx.egg-info/entry_points.txt +2 -0
  77. afmx-1.0.1/afmx.egg-info/requires.txt +52 -0
  78. afmx-1.0.1/afmx.egg-info/top_level.txt +1 -0
  79. afmx-1.0.1/pyproject.toml +176 -0
  80. afmx-1.0.1/setup.cfg +4 -0
  81. afmx-1.0.1/setup.py +5 -0
afmx-1.0.1/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or contributory
82
+ patent infringement, then any patent licenses granted to You under
83
+ this License for that Work shall terminate as of the date such
84
+ litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative Works
92
+ a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the attribution
105
+ notices contained within such NOTICE file, in at least one of
106
+ the following places: within a NOTICE text provided with the
107
+ distribution; within the Source form or documentation, if provided
108
+ along with the Derivative Works; or, within a display generated
109
+ by the Derivative Works, if and wherever such third-party notices
110
+ normally appear. The contents of the NOTICE file are for
111
+ informational purposes only and do not modify the License.
112
+ You may add Your own attribution notices within Derivative Works
113
+ that You distribute, alongside or as an additional addendum to
114
+ the NOTICE text from the Work, provided that such additional
115
+ attribution notices cannot be construed as modifying the License.
116
+
117
+ You may add Your own license statement for Your modifications and
118
+ may provide additional grant of rights to use, copy, modify, merge,
119
+ publish, distribute, sublicense, and/or sell copies of the
120
+ Contribution, and to sublicense the foregoing rights to third parties
121
+ subject to Your own license statement.
122
+
123
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
124
+ any Contribution intentionally submitted for inclusion in the Work
125
+ by You to the Licensor shall be under the terms and conditions of
126
+ this License, without any additional terms or conditions.
127
+ Notwithstanding the above, nothing herein shall supersede or modify
128
+ the terms of any separate license agreement you may have executed
129
+ with Licensor regarding such Contributions.
130
+
131
+ 6. Trademarks. This License does not grant permission to use the trade
132
+ names, trademarks, service marks, or product names of the Licensor,
133
+ except as required for reasonable and customary use in describing the
134
+ origin of the Work and reproducing the content of the NOTICE file.
135
+
136
+ 7. Disclaimer of Warranty. Unless required by applicable law or
137
+ agreed to in writing, Licensor provides the Work (and each
138
+ Contributor provides its Contributions) on an "AS IS" BASIS,
139
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
140
+ implied, including, without limitation, any warranties or conditions
141
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
142
+ PARTICULAR PURPOSE. You are solely responsible for determining the
143
+ appropriateness of using or reproducing the Work and assume any
144
+ risks associated with Your exercise of permissions under this License.
145
+
146
+ 8. Limitation of Liability. In no event and under no legal theory,
147
+ whether in tort (including negligence), contract, or otherwise,
148
+ unless required by applicable law (such as deliberate and grossly
149
+ negligent acts) or agreed to in writing, shall any Contributor be
150
+ liable to You for damages, including any direct, indirect, special,
151
+ incidental, or exemplary damages of any character arising as a
152
+ result of this License or out of the use or inability to use the
153
+ Work (even if such Contributor has been advised of the possibility
154
+ of such damages).
155
+
156
+ 9. Accepting Warranty or Additional Liability. While redistributing
157
+ the Work or Derivative Works thereof, You may choose to offer,
158
+ and charge a fee for, acceptance of support, warranty, indemnity,
159
+ or other liability obligations and/or rights consistent with this
160
+ License. However, in accepting such obligations, You may offer only
161
+ conditions that are fully consistent with this License.
162
+
163
+ END OF TERMS AND CONDITIONS
164
+
165
+ Copyright 2026 Agentdyne9
166
+
167
+ Licensed under the Apache License, Version 2.0 (the "License");
168
+ you may not use this file except in compliance with the License.
169
+ You may obtain a copy of the License at
170
+
171
+ http://www.apache.org/licenses/LICENSE-2.0
172
+
173
+ Unless required by applicable law or agreed to in writing, software
174
+ distributed under the License is distributed on an "AS IS" BASIS,
175
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
176
+ See the License for the specific language governing permissions and
177
+ limitations under the License.
afmx-1.0.1/PKG-INFO ADDED
@@ -0,0 +1,361 @@
1
+ Metadata-Version: 2.4
2
+ Name: afmx
3
+ Version: 1.0.1
4
+ Summary: Agent Flow Matrix Execution Engine — production-grade execution fabric for autonomous agents
5
+ Author-email: Agentdyne9 <hello@agentdyne9.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/inteleion-ai/AFMX
8
+ Project-URL: Repository, https://github.com/inteleion-ai/AFMX
9
+ Project-URL: Documentation, https://github.com/inteleion-ai/AFMX/tree/main/docs
10
+ Project-URL: Bug Tracker, https://github.com/inteleion-ai/AFMX/issues
11
+ Project-URL: Changelog, https://github.com/inteleion-ai/AFMX/blob/main/CHANGELOG.md
12
+ Keywords: agents,ai,orchestration,execution,dag,multi-agent,langchain,langgraph,crewai,openai,fastapi,async,workflow
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Framework :: FastAPI
22
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: fastapi<1.0,>=0.111.0
29
+ Requires-Dist: uvicorn[standard]<1.0,>=0.29.0
30
+ Requires-Dist: pydantic<3.0,>=2.7.0
31
+ Requires-Dist: pydantic-settings<3.0,>=2.2.0
32
+ Requires-Dist: python-multipart>=0.0.9
33
+ Requires-Dist: python-dotenv>=1.0.0
34
+ Provides-Extra: redis
35
+ Requires-Dist: redis[asyncio]>=5.0.0; extra == "redis"
36
+ Requires-Dist: hiredis>=2.3.0; extra == "redis"
37
+ Provides-Extra: metrics
38
+ Requires-Dist: prometheus-client>=0.20.0; extra == "metrics"
39
+ Provides-Extra: http
40
+ Requires-Dist: httpx>=0.27.0; extra == "http"
41
+ Requires-Dist: aiohttp>=3.9.0; extra == "http"
42
+ Provides-Extra: langchain
43
+ Requires-Dist: langchain>=0.1.0; extra == "langchain"
44
+ Provides-Extra: langgraph
45
+ Requires-Dist: langgraph>=0.0.40; extra == "langgraph"
46
+ Provides-Extra: crewai
47
+ Requires-Dist: crewai>=0.1.0; extra == "crewai"
48
+ Provides-Extra: openai
49
+ Requires-Dist: openai>=1.0.0; extra == "openai"
50
+ Provides-Extra: adapters
51
+ Requires-Dist: langchain>=0.1.0; extra == "adapters"
52
+ Requires-Dist: langgraph>=0.0.40; extra == "adapters"
53
+ Requires-Dist: crewai>=0.1.0; extra == "adapters"
54
+ Requires-Dist: openai>=1.0.0; extra == "adapters"
55
+ Provides-Extra: full
56
+ Requires-Dist: afmx[http,metrics,redis]; extra == "full"
57
+ Requires-Dist: orjson>=3.10.0; extra == "full"
58
+ Provides-Extra: dev
59
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
60
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
61
+ Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
62
+ Requires-Dist: httpx>=0.27.0; extra == "dev"
63
+ Requires-Dist: black>=24.0.0; extra == "dev"
64
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
65
+ Requires-Dist: mypy>=1.10.0; extra == "dev"
66
+ Requires-Dist: orjson>=3.10.0; extra == "dev"
67
+ Requires-Dist: redis[asyncio]>=5.0.0; extra == "dev"
68
+ Requires-Dist: prometheus-client>=0.20.0; extra == "dev"
69
+ Requires-Dist: websockets>=12.0; extra == "dev"
70
+ Dynamic: license-file
71
+
72
+ # AFMX — Agent Flow Matrix Execution Engine
73
+
74
+ > **"LangGraph helps you build demos. AFMX helps you run production AI systems."**
75
+
76
+ AFMX is the **execution fabric for autonomous agents** — deterministic, fault-tolerant, and built like infrastructure.
77
+
78
+ [![CI](https://github.com/inteleion-ai/AFMX/actions/workflows/ci.yml/badge.svg)](https://github.com/inteleion-ai/AFMX/actions/workflows/ci.yml)
79
+ [![PyPI version](https://img.shields.io/pypi/v/afmx.svg)](https://pypi.org/project/afmx/)
80
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org)
81
+ [![License](https://img.shields.io/badge/license-Apache%202.0-green)](LICENSE)
82
+ [![Status](https://img.shields.io/badge/status-production--stable-brightgreen)]()
83
+
84
+ ---
85
+
86
+ ## What is AFMX?
87
+
88
+ AFMX is a **production-grade, deterministic execution fabric for autonomous agents**.
89
+ It is not an agent reasoning framework — it is the layer that controls *how* agents act reliably in production.
90
+
91
+ ```
92
+ Your Agent Logic (LangChain / LangGraph / CrewAI / OpenAI / custom Python)
93
+
94
+ ExecutionMatrix (DAG: nodes + edges + mode + abort policy)
95
+
96
+ AFMXEngine
97
+
98
+ Deterministic execution:
99
+ retry · fallback · circuit breaker · hooks · events · audit · RBAC
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Install
105
+
106
+ ```bash
107
+ pip install afmx
108
+ ```
109
+
110
+ Or install with extras:
111
+
112
+ ```bash
113
+ pip install "afmx[redis,metrics]" # Redis store + Prometheus
114
+ pip install "afmx[full]" # everything except adapter frameworks
115
+ pip install "afmx[dev]" # development + testing toolchain
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Quick Start
121
+
122
+ ```bash
123
+ python3.10 -m afmx serve --reload
124
+ # API: http://localhost:8100
125
+ # Docs: http://localhost:8100/docs
126
+ # Dashboard: http://localhost:8100/afmx/ui
127
+ ```
128
+
129
+ ```bash
130
+ curl -s -X POST http://localhost:8100/afmx/execute \
131
+ -H "Content-Type: application/json" \
132
+ -d '{
133
+ "matrix": {
134
+ "name": "research-pipeline",
135
+ "mode": "SEQUENTIAL",
136
+ "nodes": [
137
+ {"id":"analyst", "name":"analyst", "type":"AGENT","handler":"analyst_agent"},
138
+ {"id":"writer", "name":"writer", "type":"AGENT","handler":"writer_agent"},
139
+ {"id":"reviewer", "name":"reviewer", "type":"AGENT","handler":"reviewer_agent"}
140
+ ],
141
+ "edges": [
142
+ {"from":"analyst","to":"writer"},
143
+ {"from":"writer","to":"reviewer"}
144
+ ]
145
+ },
146
+ "input": {"topic": "Production multi-agent systems in 2026"}
147
+ }' | python3 -m json.tool
148
+ ```
149
+
150
+ ### Run the live demo (7 multi-agent scenarios)
151
+
152
+ ```bash
153
+ pip install httpx
154
+ python demo_multiagent.py --scenario all
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Core Features
160
+
161
+ | Layer | Responsibility |
162
+ |---|---|
163
+ | `ExecutionMatrix` | DAG of nodes and edges — the execution topology |
164
+ | `AFMXEngine` | SEQUENTIAL, PARALLEL, HYBRID orchestration |
165
+ | `NodeExecutor` | Per-node execution with retry, timeout, circuit breaker |
166
+ | `RetryManager` | Exponential backoff + jitter + per-node circuit breaker |
167
+ | `ToolRouter` | Deterministic rule-based tool selection |
168
+ | `AgentDispatcher` | Routes agents by complexity, capability, or policy |
169
+ | `HookRegistry` | PRE/POST node and matrix hooks |
170
+ | `EventBus` | Every state transition emits an observable event |
171
+ | `ConcurrencyManager` | Global semaphore with queue timeout |
172
+ | `StateStore` | In-memory or Redis-backed execution persistence |
173
+ | `MatrixStore` | Named, versioned matrix definitions |
174
+ | `CheckpointStore` | Per-node incremental checkpoints for resumability |
175
+ | `AuditStore` | Append-only audit trail (JSON/CSV/NDJSON export) |
176
+ | `RBACMiddleware` | 5 roles × 16 permissions API key authentication |
177
+ | `PluginRegistry` | Decorator-first handler registration |
178
+
179
+ ---
180
+
181
+ ## Execution Modes
182
+
183
+ | Mode | Behaviour |
184
+ |---|---|
185
+ | `SEQUENTIAL` | Topological order, one node at a time, conditional edge evaluation |
186
+ | `PARALLEL` | All nodes fire concurrently under semaphore cap |
187
+ | `HYBRID` | DAG level-sets — same-level nodes run in parallel, levels are sequential |
188
+
189
+ ---
190
+
191
+ ## Fault Tolerance
192
+
193
+ ```python
194
+ from afmx import Node, RetryPolicy, CircuitBreakerPolicy, TimeoutPolicy
195
+
196
+ Node(
197
+ name="external_api",
198
+ handler="api_call",
199
+ retry_policy=RetryPolicy(
200
+ retries=5,
201
+ backoff_seconds=1.0,
202
+ backoff_multiplier=2.0, # 1s → 2s → 4s → 8s → 16s
203
+ jitter=True,
204
+ ),
205
+ circuit_breaker=CircuitBreakerPolicy(
206
+ enabled=True,
207
+ failure_threshold=5,
208
+ recovery_timeout_seconds=60.0,
209
+ ),
210
+ fallback_node_id="api_fallback",
211
+ )
212
+ ```
213
+
214
+ ---
215
+
216
+ ## Framework Adapters
217
+
218
+ Built-in adapters for LangChain, LangGraph, CrewAI, and OpenAI — all lazy-loaded.
219
+
220
+ ```python
221
+ from afmx.adapters.langchain import LangChainAdapter
222
+ from langchain.tools import DuckDuckGoSearchRun
223
+
224
+ adapter = LangChainAdapter()
225
+ node = adapter.to_afmx_node(DuckDuckGoSearchRun(), node_id="search")
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Registering Handlers
231
+
232
+ ```python
233
+ from afmx.plugins import default_registry
234
+
235
+ @default_registry.agent("my_analyst")
236
+ async def analyst(node_input: dict, context, node) -> dict:
237
+ topic = node_input["input"].get("topic", "")
238
+ return {"analysis": f"Analysis of: {topic}", "confidence": 0.87}
239
+
240
+ @default_registry.tool("web_search")
241
+ async def search(node_input: dict, context, node) -> dict:
242
+ query = node_input["params"].get("query") or node_input["input"]
243
+ return {"results": await run_search(query)}
244
+ ```
245
+
246
+ ---
247
+
248
+ ## REST API
249
+
250
+ | Method | Endpoint | Description |
251
+ |---|---|---|
252
+ | `POST` | `/afmx/execute` | Execute matrix synchronously |
253
+ | `POST` | `/afmx/execute/async` | Execute and return immediately |
254
+ | `GET` | `/afmx/result/{id}` | Full result with node outputs |
255
+ | `POST` | `/afmx/validate` | Validate matrix without executing |
256
+ | `POST` | `/afmx/retry/{id}` | Retry failed execution |
257
+ | `POST` | `/afmx/matrices` | Save named matrix |
258
+ | `GET` | `/afmx/executions` | List recent executions |
259
+ | `GET` | `/afmx/audit` | Query audit log |
260
+ | `WS` | `/afmx/ws/stream/{id}` | Real-time event streaming |
261
+ | `GET` | `/health` | Health check |
262
+ | `GET` | `/metrics` | Prometheus metrics |
263
+
264
+ ---
265
+
266
+ ## Dashboard
267
+
268
+ React 18 SPA included:
269
+
270
+ ```bash
271
+ cd afmx/dashboard
272
+ npm install && npm run build # served at /afmx/ui
273
+ npm run dev # hot-reload at localhost:5173
274
+ ```
275
+
276
+ Pages: Overview · Executions (trace/waterfall/output) · Live Stream · Run Matrix · Saved Matrices · Plugins · Audit Log · API Keys
277
+
278
+ ---
279
+
280
+ ## Observability
281
+
282
+ ```python
283
+ # Subscribe to any execution event
284
+ @bus.subscribe(EventType.NODE_FAILED)
285
+ async def on_fail(event):
286
+ await alert_team(event.execution_id, event.data["error"])
287
+ ```
288
+
289
+ Prometheus metrics scraped at `GET /metrics`. WebSocket streaming at `WS /afmx/ws/stream/{id}`.
290
+
291
+ ---
292
+
293
+ ## Docker
294
+
295
+ ```bash
296
+ docker build -t afmx:latest .
297
+ docker run -p 8100:8100 --env-file .env afmx:latest
298
+
299
+ # Full stack: AFMX + Redis + Prometheus
300
+ docker-compose up -d
301
+ ```
302
+
303
+ ---
304
+
305
+ ## Documentation
306
+
307
+ Full documentation in [`docs/`](docs/):
308
+
309
+ | Doc | Description |
310
+ |---|---|
311
+ | [Architecture](docs/architecture.md) | System layers, data flow, AFMX vs Airflow / Temporal / LangGraph |
312
+ | [Core Concepts](docs/concepts.md) | Node, Edge, Matrix, Context, Record |
313
+ | [Quick Start](docs/quickstart.md) | 5-minute setup guide |
314
+ | [Handlers](docs/handlers.md) | Writing and registering handlers |
315
+ | [Matrix Design](docs/matrix_design.md) | Modes, conditions, variable resolver |
316
+ | [API Reference](docs/api_reference.md) | All REST endpoints |
317
+ | [Adapters](docs/adapters.md) | LangChain, LangGraph, CrewAI, OpenAI |
318
+ | [Hooks](docs/hooks.md) | PRE/POST hooks |
319
+ | [Observability](docs/observability.md) | EventBus, Prometheus, WebSocket, Agentability |
320
+ | [Configuration](docs/configuration.md) | All `AFMX_` environment variables |
321
+ | [Testing](docs/testing.md) | Running the test suite |
322
+ | [Deployment](docs/deployment.md) | Docker, production hardening |
323
+
324
+ ---
325
+
326
+ ## Testing
327
+
328
+ ```bash
329
+ pytest # 290+ tests
330
+ pytest tests/unit/ -v # unit tests only
331
+ pytest tests/integration/ -v # integration tests only
332
+ pytest --cov=afmx --cov-report=html # HTML coverage report
333
+ ```
334
+
335
+ ---
336
+
337
+ ## AFMX vs LangGraph
338
+
339
+ | | AFMX | LangGraph |
340
+ |---|---|---|
341
+ | Determinism | ✅ Same input = same path | ❌ LLM-dependent |
342
+ | Fault tolerance | ✅ Retry + fallback + circuit breaker | ❌ Manual |
343
+ | Parallel execution | ✅ Native PARALLEL + HYBRID | ⚠️ Limited |
344
+ | Production grade | ✅ RBAC, audit, checkpoints, Redis | ⚠️ App-layer |
345
+
346
+ **Mental model:** AFMX = how agents **act**. LangGraph = how agents **think**. They are complementary — AFMX can execute LangGraph graphs as nodes.
347
+
348
+ ---
349
+
350
+ ## Contributing
351
+
352
+ See [CONTRIBUTING.md](CONTRIBUTING.md). All contributions welcome.
353
+
354
+ ---
355
+
356
+ ## License
357
+
358
+ Apache 2.0 — see [LICENSE](LICENSE).
359
+
360
+ Enterprise features (multi-tenancy, SSO/OIDC, cryptographic execution integrity, distributed workers, cost governance, AFMX Cloud) are available under a separate commercial license.
361
+ See [ENTERPRISE.md](ENTERPRISE.md) or contact **enterprise@agentdyne9.com**.