faden-agent 0.2.7__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 (119) hide show
  1. faden_agent-0.2.7/.gitignore +11 -0
  2. faden_agent-0.2.7/LICENSE +187 -0
  3. faden_agent-0.2.7/NOTICE +15 -0
  4. faden_agent-0.2.7/OFFICIAL.md +9 -0
  5. faden_agent-0.2.7/PKG-INFO +130 -0
  6. faden_agent-0.2.7/README.md +100 -0
  7. faden_agent-0.2.7/build-binary.sh +187 -0
  8. faden_agent-0.2.7/deploy/systemd/faden-agent.service +32 -0
  9. faden_agent-0.2.7/deploy/windows/install-windows-service.ps1 +79 -0
  10. faden_agent-0.2.7/faden_agent/__init__.py +5 -0
  11. faden_agent-0.2.7/faden_agent/__main__.py +1876 -0
  12. faden_agent-0.2.7/faden_agent/backend_client.py +146 -0
  13. faden_agent-0.2.7/faden_agent/collectors.py +86 -0
  14. faden_agent-0.2.7/faden_agent/command_order.py +155 -0
  15. faden_agent-0.2.7/faden_agent/command_verifier.py +59 -0
  16. faden_agent-0.2.7/faden_agent/config.py +194 -0
  17. faden_agent-0.2.7/faden_agent/container_log_forwarder.py +138 -0
  18. faden_agent-0.2.7/faden_agent/dispatcher.py +387 -0
  19. faden_agent-0.2.7/faden_agent/event_buffer.py +41 -0
  20. faden_agent-0.2.7/faden_agent/gpu/__init__.py +166 -0
  21. faden_agent-0.2.7/faden_agent/gpu/amd.py +85 -0
  22. faden_agent-0.2.7/faden_agent/gpu/apple.py +114 -0
  23. faden_agent-0.2.7/faden_agent/gpu/nvidia.py +129 -0
  24. faden_agent-0.2.7/faden_agent/health_supervisor.py +179 -0
  25. faden_agent-0.2.7/faden_agent/hf_download.py +259 -0
  26. faden_agent-0.2.7/faden_agent/image_loader.py +438 -0
  27. faden_agent-0.2.7/faden_agent/image_seed.py +247 -0
  28. faden_agent-0.2.7/faden_agent/log_collector.py +265 -0
  29. faden_agent-0.2.7/faden_agent/log_cursors.py +79 -0
  30. faden_agent-0.2.7/faden_agent/loki_client.py +167 -0
  31. faden_agent-0.2.7/faden_agent/model_puller.py +449 -0
  32. faden_agent-0.2.7/faden_agent/model_tls.py +544 -0
  33. faden_agent-0.2.7/faden_agent/models.py +72 -0
  34. faden_agent-0.2.7/faden_agent/network.py +623 -0
  35. faden_agent-0.2.7/faden_agent/policy_guard.py +51 -0
  36. faden_agent-0.2.7/faden_agent/preflight.py +47 -0
  37. faden_agent-0.2.7/faden_agent/ray/__init__.py +38 -0
  38. faden_agent-0.2.7/faden_agent/ray/container.py +1290 -0
  39. faden_agent-0.2.7/faden_agent/ray/core.py +376 -0
  40. faden_agent-0.2.7/faden_agent/ray/drain.py +320 -0
  41. faden_agent-0.2.7/faden_agent/ray/errors.py +106 -0
  42. faden_agent-0.2.7/faden_agent/ray/inspect.py +220 -0
  43. faden_agent-0.2.7/faden_agent/ray/manager.py +1010 -0
  44. faden_agent-0.2.7/faden_agent/ray/metrics.py +74 -0
  45. faden_agent-0.2.7/faden_agent/ray/models.py +164 -0
  46. faden_agent-0.2.7/faden_agent/ray/ray_tls.py +124 -0
  47. faden_agent-0.2.7/faden_agent/ray/runtime.py +339 -0
  48. faden_agent-0.2.7/faden_agent/ray/scale.py +180 -0
  49. faden_agent-0.2.7/faden_agent/ray/schemas.py +194 -0
  50. faden_agent-0.2.7/faden_agent/ray/serve.py +257 -0
  51. faden_agent-0.2.7/faden_agent/ray/serve_drain_patch.py +152 -0
  52. faden_agent-0.2.7/faden_agent/ray/serve_http.py +73 -0
  53. faden_agent-0.2.7/faden_agent/ray/state.py +115 -0
  54. faden_agent-0.2.7/faden_agent/ray_log_forwarder.py +492 -0
  55. faden_agent-0.2.7/faden_agent/runtime_manager.py +1054 -0
  56. faden_agent-0.2.7/faden_agent/runtimes/__init__.py +184 -0
  57. faden_agent-0.2.7/faden_agent/runtimes/accelerators.py +121 -0
  58. faden_agent-0.2.7/faden_agent/runtimes/docker.py +366 -0
  59. faden_agent-0.2.7/faden_agent/runtimes/podman.py +365 -0
  60. faden_agent-0.2.7/faden_agent/server_trust.py +229 -0
  61. faden_agent-0.2.7/faden_agent/service.py +541 -0
  62. faden_agent-0.2.7/faden_agent/single_instance.py +113 -0
  63. faden_agent-0.2.7/faden_agent/state_store.py +240 -0
  64. faden_agent-0.2.7/faden_agent/stream_client.py +477 -0
  65. faden_agent-0.2.7/faden_agent/system_updater.py +429 -0
  66. faden_agent-0.2.7/faden_agent/tls.py +69 -0
  67. faden_agent-0.2.7/faden_agent/vllm_discovery.py +307 -0
  68. faden_agent-0.2.7/node_agent.spec +157 -0
  69. faden_agent-0.2.7/pyproject.toml +72 -0
  70. faden_agent-0.2.7/tests/fixtures/dgx_spark_image_identity.json +124 -0
  71. faden_agent-0.2.7/tests/test_accelerators.py +137 -0
  72. faden_agent-0.2.7/tests/test_bundle_vendor.py +36 -0
  73. faden_agent-0.2.7/tests/test_collectors.py +144 -0
  74. faden_agent-0.2.7/tests/test_command_order.py +124 -0
  75. faden_agent-0.2.7/tests/test_command_signing.py +189 -0
  76. faden_agent-0.2.7/tests/test_command_verifier.py +89 -0
  77. faden_agent-0.2.7/tests/test_dispatcher.py +190 -0
  78. faden_agent-0.2.7/tests/test_event_buffer.py +31 -0
  79. faden_agent-0.2.7/tests/test_hf_download.py +255 -0
  80. faden_agent-0.2.7/tests/test_image_ref.py +160 -0
  81. faden_agent-0.2.7/tests/test_image_seed.py +168 -0
  82. faden_agent-0.2.7/tests/test_image_transfer.py +335 -0
  83. faden_agent-0.2.7/tests/test_join_flow.py +134 -0
  84. faden_agent-0.2.7/tests/test_join_idempotency.py +172 -0
  85. faden_agent-0.2.7/tests/test_join_resume.py +160 -0
  86. faden_agent-0.2.7/tests/test_log_delivery.py +140 -0
  87. faden_agent-0.2.7/tests/test_log_sink_discovery.py +180 -0
  88. faden_agent-0.2.7/tests/test_model_puller.py +183 -0
  89. faden_agent-0.2.7/tests/test_model_store_escape.py +64 -0
  90. faden_agent-0.2.7/tests/test_model_tls.py +338 -0
  91. faden_agent-0.2.7/tests/test_network.py +571 -0
  92. faden_agent-0.2.7/tests/test_no_host_ray.py +145 -0
  93. faden_agent-0.2.7/tests/test_policy_guard.py +18 -0
  94. faden_agent-0.2.7/tests/test_ray.py +533 -0
  95. faden_agent-0.2.7/tests/test_ray_container.py +428 -0
  96. faden_agent-0.2.7/tests/test_ray_container_hardware.py +130 -0
  97. faden_agent-0.2.7/tests/test_ray_container_helper.py +436 -0
  98. faden_agent-0.2.7/tests/test_ray_drain.py +407 -0
  99. faden_agent-0.2.7/tests/test_ray_log_forwarder.py +589 -0
  100. faden_agent-0.2.7/tests/test_ray_metrics_discovery.py +239 -0
  101. faden_agent-0.2.7/tests/test_ray_scale.py +229 -0
  102. faden_agent-0.2.7/tests/test_ray_status.py +751 -0
  103. faden_agent-0.2.7/tests/test_ray_takeover_inspect.py +278 -0
  104. faden_agent-0.2.7/tests/test_ray_tls.py +225 -0
  105. faden_agent-0.2.7/tests/test_rejoin_is_an_upgrade.py +95 -0
  106. faden_agent-0.2.7/tests/test_running_commands.py +230 -0
  107. faden_agent-0.2.7/tests/test_runtime_manager.py +522 -0
  108. faden_agent-0.2.7/tests/test_serve_replica_logs.py +259 -0
  109. faden_agent-0.2.7/tests/test_server_trust.py +220 -0
  110. faden_agent-0.2.7/tests/test_service_unit.py +102 -0
  111. faden_agent-0.2.7/tests/test_single_instance.py +119 -0
  112. faden_agent-0.2.7/tests/test_state_store.py +49 -0
  113. faden_agent-0.2.7/tests/test_stop_stray_agents.py +236 -0
  114. faden_agent-0.2.7/tests/test_sync_model.py +241 -0
  115. faden_agent-0.2.7/tests/test_token_dir.py +58 -0
  116. faden_agent-0.2.7/tests/test_user_service.py +126 -0
  117. faden_agent-0.2.7/tests/test_version_agrees.py +26 -0
  118. faden_agent-0.2.7/tests/test_vllm_discovery.py +208 -0
  119. faden_agent-0.2.7/uv.lock +7050 -0
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ __pycache__/
3
+ .pytest_cache/
4
+ *.pyc
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+ state/
9
+ logs/
10
+ .env
11
+ .agent-state/
@@ -0,0 +1,187 @@
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, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
@@ -0,0 +1,15 @@
1
+ Fadenstack Agent
2
+
3
+ Copyright 2026 Emagin8 UG (haftungsbeschränkt) and contributors.
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
@@ -0,0 +1,9 @@
1
+ # Brand and Official Releases
2
+
3
+ This repository is the upstream project for “Fadenstack” node agent.
4
+
5
+ - You may fork and modify the code under the Apache License 2.0.
6
+ - Please do not present modified forks as the official “Fadenstack” project.
7
+ - Please do not use the Fadenstack name or logo in a way that implies endorsement or an official relationship.
8
+
9
+ Official releases are published only from this GitHub organization/repository.
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.5
2
+ Name: faden-agent
3
+ Version: 0.2.7
4
+ Summary: Node execution agent for Fadenstack cluster-managed runtimes.
5
+ Author: Emagin8 UG (haftungsbeschränkt)
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ License-File: NOTICE
9
+ Requires-Python: >=3.11
10
+ Requires-Dist: cryptography>=42
11
+ Requires-Dist: httpx<1.0,>=0.27
12
+ Requires-Dist: huggingface-hub<2,>=0.32
13
+ Requires-Dist: psutil<8.0,>=5.9
14
+ Requires-Dist: pydantic<3.0,>=2.0
15
+ Requires-Dist: websockets<16,>=12
16
+ Provides-Extra: build
17
+ Requires-Dist: pyinstaller<7.0,>=6.0; extra == 'build'
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
20
+ Requires-Dist: pytest>=8.3; extra == 'dev'
21
+ Provides-Extra: hf
22
+ Requires-Dist: huggingface-hub<2,>=0.32; extra == 'hf'
23
+ Provides-Extra: llm
24
+ Requires-Dist: jinja2<4,>=3.1; extra == 'llm'
25
+ Requires-Dist: ray[llm,serve]==2.58.0; extra == 'llm'
26
+ Provides-Extra: ray-host
27
+ Requires-Dist: jinja2<4,>=3.1; extra == 'ray-host'
28
+ Requires-Dist: ray[serve]==2.58.0; extra == 'ray-host'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # faden_agent
32
+
33
+ `faden_agent` is the host-side execution bridge for Fadenstack node clusters.
34
+
35
+ It does not perform cluster scheduling. The backend remains authoritative for:
36
+
37
+ - desired state
38
+ - placement and routing policy
39
+ - GPU-aware filtering and load-balancing
40
+
41
+ The agent responsibilities are:
42
+
43
+ - enroll with one-time token
44
+ - maintain authenticated outbound stream
45
+ - execute node commands (Docker runtime lifecycle)
46
+ - report heartbeat, inventory, command timeline, and events
47
+
48
+ ## Quick Start
49
+
50
+ 1. Create token in backend admin:
51
+ - `POST /api/admin/system/nodes/enrollment-tokens`
52
+ 2. Set environment variables on node host:
53
+ - `FADEN_NODE_AGENT_BACKEND_URL`
54
+ - `FADEN_NODE_AGENT_ENROLLMENT_TOKEN`
55
+ - `FADEN_NODE_AGENT_AGENT_ID`
56
+ - `FADEN_NODE_AGENT_HOST`
57
+ 3. Start service:
58
+ - `faden-agent run` (foreground, for testing)
59
+ - `faden-agent start` (install as systemd service)
60
+
61
+ ## Commands
62
+
63
+ | Command | Description |
64
+ | ---------------------- | ---------------------------------------------------------------------------------- |
65
+ | `faden-agent` | Show the configuration and a menu of what to do |
66
+ | `faden-agent run` | Run in foreground (test connectivity, Ctrl+C to stop) |
67
+ | `faden-agent start` | Install and start as a systemd service (picks up `FADEN_NODE_AGENT_*` env vars) |
68
+ | `faden-agent stop` | Stop and disable the systemd service |
69
+ | `faden-agent status` | Show systemd service status |
70
+
71
+ ## Environment Variables
72
+
73
+ - `FADEN_NODE_AGENT_BACKEND_URL` default `http://127.0.0.1:8000`
74
+ - `FADEN_NODE_AGENT_AGENT_ID` default `hostname`
75
+ - `FADEN_NODE_AGENT_HOST` default: this machine's address on the route to the backend, else `hostname`
76
+ - `FADEN_NODE_AGENT_ADVERTISE_HOST` default: this machine's address on the route to the backend, else `FADEN_NODE_AGENT_HOST`
77
+ - `FADEN_NODE_AGENT_ADVERTISE_SCHEME` default `http` (allowed: `http`, `https`)
78
+ - `FADEN_NODE_AGENT_ENROLLMENT_TOKEN` one-time token for initial enrollment
79
+ - `FADEN_NODE_AGENT_STATE_PATH` default `/var/lib/faden-agent/state.json` as root, `~/.local/share/faden-agent/state.json` otherwise
80
+ - `FADEN_NODE_AGENT_HEARTBEAT_INTERVAL_SEC` default `15`
81
+ - `FADEN_NODE_AGENT_INVENTORY_INTERVAL_SEC` default `60`
82
+ - `FADEN_NODE_AGENT_RECONNECT_MIN_SEC` default `2`
83
+ - `FADEN_NODE_AGENT_RECONNECT_MAX_SEC` default `30`
84
+ - `FADEN_NODE_AGENT_REQUEST_TIMEOUT_SEC` default `20`
85
+ - `FADEN_NODE_AGENT_VERIFY_TLS` default `true`
86
+ - `FADEN_NODE_AGENT_LOKI_URL` Loki push endpoint (e.g. `http://10.0.0.1:3100`). When unset, the agent asks the backend where to send logs and pushes them through the backend. Either way it collects system logs (journald on Linux, Event Log on Windows), its containers' logs and Ray Serve's logs, and pushes system logs with labels `{job="node-agent", host="<advertise host>", agent_id="...", container="node-<agent id>", level="..."}`.
87
+ - `FADEN_NODE_AGENT_LOG_BATCH_SIZE` default `100` — max log lines per collection cycle
88
+ - `FADEN_NODE_AGENT_LOG_FLUSH_INTERVAL_SEC` default `5` — seconds between log collection cycles
89
+
90
+ ## Binary Installation (no Python required)
91
+
92
+ Pre-built standalone binaries are available on the
93
+ [GitHub Releases](https://github.com/fadenstack/fadenstack/releases) page
94
+ for Linux (x86_64 and aarch64).
95
+
96
+ ### Linux
97
+
98
+ ```bash
99
+ curl -fLO https://github.com/fadenstack/fadenstack/releases/download/node-agent-v0.2.1/faden-agent-linux-x86_64
100
+ sudo install -m 0755 faden-agent-linux-x86_64 /usr/local/bin/faden-agent
101
+ ```
102
+
103
+ Then install the systemd service (see below) or run directly:
104
+
105
+ ```bash
106
+ export FADEN_NODE_AGENT_BACKEND_URL=https://your-server
107
+ export FADEN_NODE_AGENT_ENROLLMENT_TOKEN=tok_xxx
108
+
109
+ # Test connectivity first (foreground, Ctrl+C to stop)
110
+ faden-agent run
111
+
112
+ # Once working, install as a service
113
+ faden-agent start
114
+ ```
115
+
116
+ ### Via CLI
117
+
118
+ ```bash
119
+ faden deploy --local-node # on the server's own host
120
+ faden deploy --local-node --local-node-host user@gpu1 # on another host, over SSH
121
+ ```
122
+
123
+ On the server's own host, the CLI auto-detects pre-built binaries in the workspace
124
+ `dist/` directories and uses them instead of cloning + setting up a Python venv.
125
+
126
+ ## Systemd
127
+
128
+ A unit file template is available at:
129
+
130
+ - `deploy/systemd/faden-agent.service`
@@ -0,0 +1,100 @@
1
+ # faden_agent
2
+
3
+ `faden_agent` is the host-side execution bridge for Fadenstack node clusters.
4
+
5
+ It does not perform cluster scheduling. The backend remains authoritative for:
6
+
7
+ - desired state
8
+ - placement and routing policy
9
+ - GPU-aware filtering and load-balancing
10
+
11
+ The agent responsibilities are:
12
+
13
+ - enroll with one-time token
14
+ - maintain authenticated outbound stream
15
+ - execute node commands (Docker runtime lifecycle)
16
+ - report heartbeat, inventory, command timeline, and events
17
+
18
+ ## Quick Start
19
+
20
+ 1. Create token in backend admin:
21
+ - `POST /api/admin/system/nodes/enrollment-tokens`
22
+ 2. Set environment variables on node host:
23
+ - `FADEN_NODE_AGENT_BACKEND_URL`
24
+ - `FADEN_NODE_AGENT_ENROLLMENT_TOKEN`
25
+ - `FADEN_NODE_AGENT_AGENT_ID`
26
+ - `FADEN_NODE_AGENT_HOST`
27
+ 3. Start service:
28
+ - `faden-agent run` (foreground, for testing)
29
+ - `faden-agent start` (install as systemd service)
30
+
31
+ ## Commands
32
+
33
+ | Command | Description |
34
+ | ---------------------- | ---------------------------------------------------------------------------------- |
35
+ | `faden-agent` | Show the configuration and a menu of what to do |
36
+ | `faden-agent run` | Run in foreground (test connectivity, Ctrl+C to stop) |
37
+ | `faden-agent start` | Install and start as a systemd service (picks up `FADEN_NODE_AGENT_*` env vars) |
38
+ | `faden-agent stop` | Stop and disable the systemd service |
39
+ | `faden-agent status` | Show systemd service status |
40
+
41
+ ## Environment Variables
42
+
43
+ - `FADEN_NODE_AGENT_BACKEND_URL` default `http://127.0.0.1:8000`
44
+ - `FADEN_NODE_AGENT_AGENT_ID` default `hostname`
45
+ - `FADEN_NODE_AGENT_HOST` default: this machine's address on the route to the backend, else `hostname`
46
+ - `FADEN_NODE_AGENT_ADVERTISE_HOST` default: this machine's address on the route to the backend, else `FADEN_NODE_AGENT_HOST`
47
+ - `FADEN_NODE_AGENT_ADVERTISE_SCHEME` default `http` (allowed: `http`, `https`)
48
+ - `FADEN_NODE_AGENT_ENROLLMENT_TOKEN` one-time token for initial enrollment
49
+ - `FADEN_NODE_AGENT_STATE_PATH` default `/var/lib/faden-agent/state.json` as root, `~/.local/share/faden-agent/state.json` otherwise
50
+ - `FADEN_NODE_AGENT_HEARTBEAT_INTERVAL_SEC` default `15`
51
+ - `FADEN_NODE_AGENT_INVENTORY_INTERVAL_SEC` default `60`
52
+ - `FADEN_NODE_AGENT_RECONNECT_MIN_SEC` default `2`
53
+ - `FADEN_NODE_AGENT_RECONNECT_MAX_SEC` default `30`
54
+ - `FADEN_NODE_AGENT_REQUEST_TIMEOUT_SEC` default `20`
55
+ - `FADEN_NODE_AGENT_VERIFY_TLS` default `true`
56
+ - `FADEN_NODE_AGENT_LOKI_URL` Loki push endpoint (e.g. `http://10.0.0.1:3100`). When unset, the agent asks the backend where to send logs and pushes them through the backend. Either way it collects system logs (journald on Linux, Event Log on Windows), its containers' logs and Ray Serve's logs, and pushes system logs with labels `{job="node-agent", host="<advertise host>", agent_id="...", container="node-<agent id>", level="..."}`.
57
+ - `FADEN_NODE_AGENT_LOG_BATCH_SIZE` default `100` — max log lines per collection cycle
58
+ - `FADEN_NODE_AGENT_LOG_FLUSH_INTERVAL_SEC` default `5` — seconds between log collection cycles
59
+
60
+ ## Binary Installation (no Python required)
61
+
62
+ Pre-built standalone binaries are available on the
63
+ [GitHub Releases](https://github.com/fadenstack/fadenstack/releases) page
64
+ for Linux (x86_64 and aarch64).
65
+
66
+ ### Linux
67
+
68
+ ```bash
69
+ curl -fLO https://github.com/fadenstack/fadenstack/releases/download/node-agent-v0.2.1/faden-agent-linux-x86_64
70
+ sudo install -m 0755 faden-agent-linux-x86_64 /usr/local/bin/faden-agent
71
+ ```
72
+
73
+ Then install the systemd service (see below) or run directly:
74
+
75
+ ```bash
76
+ export FADEN_NODE_AGENT_BACKEND_URL=https://your-server
77
+ export FADEN_NODE_AGENT_ENROLLMENT_TOKEN=tok_xxx
78
+
79
+ # Test connectivity first (foreground, Ctrl+C to stop)
80
+ faden-agent run
81
+
82
+ # Once working, install as a service
83
+ faden-agent start
84
+ ```
85
+
86
+ ### Via CLI
87
+
88
+ ```bash
89
+ faden deploy --local-node # on the server's own host
90
+ faden deploy --local-node --local-node-host user@gpu1 # on another host, over SSH
91
+ ```
92
+
93
+ On the server's own host, the CLI auto-detects pre-built binaries in the workspace
94
+ `dist/` directories and uses them instead of cloning + setting up a Python venv.
95
+
96
+ ## Systemd
97
+
98
+ A unit file template is available at:
99
+
100
+ - `deploy/systemd/faden-agent.service`
@@ -0,0 +1,187 @@
1
+ #!/bin/sh
2
+ # Build the single-file agent for one Linux platform.
3
+ #
4
+ # PyInstaller does not cross-compile: a linux-aarch64 build has to happen on
5
+ # linux-aarch64. A container gives that when the host can emulate the target,
6
+ # and it also pins the glibc the binary links against -- built on a newer
7
+ # distro than the node runs, the agent fails there with a GLIBC version error
8
+ # and nothing about that says "rebuild me somewhere older".
9
+ #
10
+ # When the host cannot produce the target at all -- an x86_64 workstation with
11
+ # no arm64 emulation, which is the usual case -- build it on a machine that
12
+ # is the target. --remote copies the source there, builds, and brings the
13
+ # binary back, leaving nothing behind.
14
+ #
15
+ # sh build-binary.sh # this machine's arch
16
+ # sh build-binary.sh linux-aarch64 # explicit, needs emulation
17
+ # sh build-binary.sh linux-aarch64 --remote sachi@10.250.10.49
18
+ # sh build-binary.sh linux-aarch64 --remote sachi@10.250.10.49 \
19
+ # --ssh-key ~/.ssh/id_dgx_spark
20
+ #
21
+ # The result lands in dist/, named the way /api/install/plan expects:
22
+ #
23
+ # dist/faden-agent-linux-aarch64
24
+ #
25
+ # That is the whole publish step. A backend running from this checkout reads
26
+ # dist/ directly, so every node install -- online or air-gapped -- verifies
27
+ # against the file you just built. There is no second copy to keep in step;
28
+ # there used to be, and the one being served fell a build behind in silence.
29
+ # A real deployment has no checkout, and points `agent_binary_dir` at
30
+ # wherever its binaries were placed.
31
+ set -eu
32
+
33
+ PLATFORM=""
34
+ REMOTE=""
35
+ SSH_KEY=""
36
+
37
+ while [ $# -gt 0 ]; do
38
+ case "$1" in
39
+ --remote) REMOTE="${2:-}"; shift ;;
40
+ --ssh-key) SSH_KEY="${2:-}"; shift ;;
41
+ -h|--help) sed -n '2,30p' "$0"; exit 0 ;;
42
+ -*) echo "Unknown option: $1" >&2; exit 2 ;;
43
+ *) PLATFORM="$1" ;;
44
+ esac
45
+ shift
46
+ done
47
+
48
+ if [ -z "$PLATFORM" ]; then
49
+ case "$(uname -m)" in
50
+ x86_64|amd64) PLATFORM="linux-x86_64" ;;
51
+ aarch64|arm64) PLATFORM="linux-aarch64" ;;
52
+ *) echo "Unsupported architecture: $(uname -m)" >&2; exit 2 ;;
53
+ esac
54
+ fi
55
+
56
+ case "$PLATFORM" in
57
+ linux-x86_64) DOCKER_PLATFORM="linux/amd64" ;;
58
+ linux-aarch64) DOCKER_PLATFORM="linux/arm64" ;;
59
+ *) echo "Unknown platform: $PLATFORM" >&2; exit 2 ;;
60
+ esac
61
+
62
+ SRC=$(cd "$(dirname "$0")" && pwd)
63
+ ARTIFACT="faden-agent-$PLATFORM"
64
+
65
+ # The build itself, as one string, so the local and remote paths run exactly
66
+ # the same thing. A difference between them would show up as a binary that
67
+ # works in one place and not the other, which is the hardest kind to chase.
68
+ build_script() {
69
+ cat <<BUILD
70
+ set -eu
71
+ # Git Bash rewrites anything that looks like a POSIX path in an argument, so
72
+ # "-w /src" reached the daemon as "C:/Program Files/Git/src" and every local
73
+ # build on Windows died before starting. MSYS_NO_PATHCONV stops that; it is
74
+ # an unset variable everywhere else, so the remote path is unchanged.
75
+ # The bind source has to go the other way -- the daemon wants C:/... , which
76
+ # is what "pwd -W" gives and which fails harmlessly into plain pwd on Linux.
77
+ SRCDIR=\$(pwd -W 2>/dev/null || pwd)
78
+ MSYS_NO_PATHCONV=1 docker run --rm --platform "$DOCKER_PLATFORM" -v "\$SRCDIR:/src" -w /src \\
79
+ python:3.12-slim-bookworm sh -c '
80
+ set -eu
81
+ # PyInstaller reads the ELF it is bundling: without objdump it stops with
82
+ # "On Linux, objdump is required", which is a build-host problem rather
83
+ # than anything to do with the agent.
84
+ apt-get update -qq && apt-get install -y -qq binutils >/dev/null
85
+ pip install --quiet --no-cache-dir pyinstaller .
86
+ pyinstaller --clean --noconfirm node_agent.spec
87
+ mv dist/faden-agent "dist/$ARTIFACT"
88
+ # Hand the output back to whoever owns the source.
89
+ #
90
+ # The container is root and the source is a bind mount, so everything it
91
+ # writes -- dist/, build/, the caches -- lands root-owned on the host.
92
+ # On a remote build that left a directory the invoking user could not
93
+ # delete, and the cleanup failed with nothing but "Permission denied".
94
+ chown -R "\$(stat -c "%u:%g" /src)" /src
95
+ '
96
+ BUILD
97
+ }
98
+
99
+ # ── local ──────────────────────────────────────────────────────────────────
100
+
101
+ if [ -z "$REMOTE" ]; then
102
+ cd "$SRC"
103
+ build_script | sh
104
+ echo
105
+ echo "Built: $SRC/dist/$ARTIFACT"
106
+ sha256sum "$SRC/dist/$ARTIFACT" 2>/dev/null || shasum -a 256 "$SRC/dist/$ARTIFACT"
107
+ exit 0
108
+ fi
109
+
110
+ # ── remote ─────────────────────────────────────────────────────────────────
111
+
112
+ SSH="ssh -o StrictHostKeyChecking=accept-new"
113
+ SCP="scp -o StrictHostKeyChecking=accept-new"
114
+ if [ -n "$SSH_KEY" ]; then
115
+ SSH="$SSH -i $SSH_KEY"
116
+ SCP="$SCP -i $SSH_KEY"
117
+ fi
118
+
119
+ echo "Building $PLATFORM on $REMOTE"
120
+
121
+ # Check before copying anything: a missing docker on the far end is a clearer
122
+ # failure here than half way through a build.
123
+ $SSH "$REMOTE" 'command -v docker >/dev/null' || {
124
+ echo "ERROR: no docker on $REMOTE -- the build needs it." >&2
125
+ exit 1
126
+ }
127
+
128
+ REMOTE_ARCH=$($SSH "$REMOTE" 'uname -m')
129
+ case "$PLATFORM:$REMOTE_ARCH" in
130
+ linux-aarch64:aarch64|linux-aarch64:arm64|linux-x86_64:x86_64|linux-x86_64:amd64) ;;
131
+ *)
132
+ # Not fatal: the far end may emulate. Say so rather than silently
133
+ # producing a binary for the wrong machine.
134
+ echo "NOTE: $REMOTE is $REMOTE_ARCH, building $PLATFORM -- relies on emulation there."
135
+ ;;
136
+ esac
137
+
138
+ REMOTE_DIR=$($SSH "$REMOTE" 'mktemp -d -t faden-build-XXXXXX')
139
+
140
+ # Clean up, and say so when it does not work.
141
+ #
142
+ # This was a trap ending in "|| true", which is how 36MB of source was left
143
+ # on a machine that had only lent us a CPU -- silently, because the one thing
144
+ # that would have reported it was the thing being suppressed.
145
+ cleanup_remote() {
146
+ $SSH "$REMOTE" "rm -rf '$REMOTE_DIR'" >/dev/null 2>&1
147
+ if $SSH "$REMOTE" "test -d '$REMOTE_DIR'" >/dev/null 2>&1; then
148
+ echo "WARNING: could not remove $REMOTE:$REMOTE_DIR -- remove it by hand." >&2
149
+ return 1
150
+ fi
151
+ return 0
152
+ }
153
+ # Only for the abnormal paths; the normal one calls it explicitly below, so a
154
+ # successful build reports a failed cleanup instead of exiting 0 regardless.
155
+ trap 'cleanup_remote >/dev/null 2>&1 || true' INT TERM
156
+
157
+ echo " syncing source → $REMOTE:$REMOTE_DIR"
158
+ # tar over ssh rather than rsync: rsync is not on a Git Bash install and not
159
+ # guaranteed on a minimal node, ssh and tar are on both by definition.
160
+ # The excludes matter -- .venv alone is hundreds of megabytes and useless on
161
+ # the far side, and dist/ would ship a binary for the wrong architecture.
162
+ tar -C "$SRC" \
163
+ --exclude=.venv --exclude=dist --exclude=build \
164
+ --exclude=__pycache__ --exclude='*.pyc' --exclude=.git \
165
+ -czf - . | $SSH "$REMOTE" "tar -C $REMOTE_DIR -xzf -"
166
+
167
+ echo " building…"
168
+ if ! build_script | $SSH "$REMOTE" "cd $REMOTE_DIR && sh"; then
169
+ echo "ERROR: the build failed on $REMOTE." >&2
170
+ cleanup_remote || true
171
+ exit 1
172
+ fi
173
+
174
+ echo " fetching artifact"
175
+ mkdir -p "$SRC/dist"
176
+ if ! $SCP "$REMOTE:$REMOTE_DIR/dist/$ARTIFACT" "$SRC/dist/$ARTIFACT"; then
177
+ echo "ERROR: built on $REMOTE but could not fetch $ARTIFACT." >&2
178
+ echo " Left $REMOTE:$REMOTE_DIR in place so it can be copied by hand." >&2
179
+ exit 1
180
+ fi
181
+
182
+ echo " cleaning up $REMOTE"
183
+ cleanup_remote || true
184
+
185
+ echo
186
+ echo "Built on $REMOTE, fetched to: $SRC/dist/$ARTIFACT"
187
+ sha256sum "$SRC/dist/$ARTIFACT" 2>/dev/null || shasum -a 256 "$SRC/dist/$ARTIFACT"
@@ -0,0 +1,32 @@
1
+ [Unit]
2
+ Description=fadenstack node agent
3
+ After=network-online.target docker.service
4
+ Wants=network-online.target
5
+ # A start that can never succeed must stop retrying and say so.
6
+ # The agent handles a backend outage itself (it reconnects with backoff
7
+ # and never exits for that), so a failed *start* means something
8
+ # structural -- most often a second agent already holding the state lock.
9
+ # Without a limit systemd retried every 5s forever while reporting
10
+ # "activating (auto-restart)", which reads like a slow boot rather than a
11
+ # wedged service: observed on the DGX head at restart counter 9259, about
12
+ # fifteen hours of looping that nothing surfaced.
13
+ StartLimitIntervalSec=300
14
+ StartLimitBurst=10
15
+
16
+ [Service]
17
+ Type=simple
18
+ User=@@USER@@
19
+ Group=@@GROUP@@
20
+ SupplementaryGroups=docker
21
+ EnvironmentFile=-/etc/faden-agent.env
22
+ EnvironmentFile=-@@USER_ENV_FILE@@
23
+ ExecStart=/usr/local/bin/faden-agent run
24
+ Restart=always
25
+ RestartSec=5
26
+ TimeoutStopSec=30
27
+
28
+ NoNewPrivileges=false
29
+ PrivateTmp=true
30
+
31
+ [Install]
32
+ WantedBy=multi-user.target