inferential 0.1.0__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 (58) hide show
  1. inferential-0.1.0/.gitignore +17 -0
  2. inferential-0.1.0/LICENSE +201 -0
  3. inferential-0.1.0/Makefile +14 -0
  4. inferential-0.1.0/PKG-INFO +281 -0
  5. inferential-0.1.0/README.md +258 -0
  6. inferential-0.1.0/arch/inferential_architecture.pdf +0 -0
  7. inferential-0.1.0/arch/inferential_flow_diagram.svg +282 -0
  8. inferential-0.1.0/arch/inferential_spec.pdf +0 -0
  9. inferential-0.1.0/examples/client_demo.py +85 -0
  10. inferential-0.1.0/examples/server_demo.py +49 -0
  11. inferential-0.1.0/hatch_build.py +32 -0
  12. inferential-0.1.0/inferential/__init__.py +14 -0
  13. inferential-0.1.0/inferential/_version.py +1 -0
  14. inferential-0.1.0/inferential/client.py +156 -0
  15. inferential-0.1.0/inferential/config/__init__.py +31 -0
  16. inferential-0.1.0/inferential/config/schema.py +96 -0
  17. inferential-0.1.0/inferential/config/watcher.py +84 -0
  18. inferential-0.1.0/inferential/dispatch/__init__.py +8 -0
  19. inferential-0.1.0/inferential/dispatch/dispatcher.py +166 -0
  20. inferential-0.1.0/inferential/dispatch/health.py +23 -0
  21. inferential-0.1.0/inferential/metrics/__init__.py +13 -0
  22. inferential-0.1.0/inferential/metrics/callbacks.py +20 -0
  23. inferential-0.1.0/inferential/metrics/collector.py +71 -0
  24. inferential-0.1.0/inferential/metrics/store.py +75 -0
  25. inferential-0.1.0/inferential/observation/__init__.py +10 -0
  26. inferential-0.1.0/inferential/observation/assembler.py +100 -0
  27. inferential-0.1.0/inferential/observation/slots.py +30 -0
  28. inferential-0.1.0/inferential/proto/__init__.py +124 -0
  29. inferential-0.1.0/inferential/proto/inferential.proto +57 -0
  30. inferential-0.1.0/inferential/proto/inferential_pb2.py +54 -0
  31. inferential-0.1.0/inferential/proto/inferential_pb2.pyi +116 -0
  32. inferential-0.1.0/inferential/scheduler/__init__.py +25 -0
  33. inferential-0.1.0/inferential/scheduler/base.py +90 -0
  34. inferential-0.1.0/inferential/scheduler/batch_optimized.py +126 -0
  35. inferential-0.1.0/inferential/scheduler/deadline_aware.py +107 -0
  36. inferential-0.1.0/inferential/scheduler/priority_tiered.py +93 -0
  37. inferential-0.1.0/inferential/scheduler/request.py +28 -0
  38. inferential-0.1.0/inferential/scheduler/round_robin.py +106 -0
  39. inferential-0.1.0/inferential/server.py +242 -0
  40. inferential-0.1.0/inferential/tracking/__init__.py +12 -0
  41. inferential-0.1.0/inferential/tracking/cadence.py +50 -0
  42. inferential-0.1.0/inferential/tracking/response.py +62 -0
  43. inferential-0.1.0/inferential/tracking/robots.py +41 -0
  44. inferential-0.1.0/inferential/transport/__init__.py +8 -0
  45. inferential-0.1.0/inferential/transport/messages.py +18 -0
  46. inferential-0.1.0/inferential/transport/zmq_transport.py +50 -0
  47. inferential-0.1.0/pyproject.toml +53 -0
  48. inferential-0.1.0/scripts/gen_proto.sh +12 -0
  49. inferential-0.1.0/tests/conftest.py +15 -0
  50. inferential-0.1.0/tests/test_cadence.py +113 -0
  51. inferential-0.1.0/tests/test_client.py +112 -0
  52. inferential-0.1.0/tests/test_dispatcher.py +38 -0
  53. inferential-0.1.0/tests/test_metrics.py +137 -0
  54. inferential-0.1.0/tests/test_observation.py +124 -0
  55. inferential-0.1.0/tests/test_proto.py +201 -0
  56. inferential-0.1.0/tests/test_scheduler.py +381 -0
  57. inferential-0.1.0/tests/test_transport.py +94 -0
  58. inferential-0.1.0/uv.lock +2410 -0
@@ -0,0 +1,17 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .venv/
10
+ .env
11
+ .ruff_cache/
12
+ .pytest_cache/
13
+ .mypy_cache/
14
+
15
+ # Generated protobuf
16
+ inferential/proto/inferential_pb2.py
17
+ inferential/proto/inferential_pb2.pyi
@@ -0,0 +1,201 @@
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.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,14 @@
1
+ .PHONY: proto test lint clean
2
+
3
+ proto:
4
+ @bash scripts/gen_proto.sh
5
+
6
+ test: proto
7
+ uv run pytest tests/ -v
8
+
9
+ lint:
10
+ uv run ruff check inferential/ tests/
11
+
12
+ clean:
13
+ find . -type d -name __pycache__ -exec rm -rf {} +
14
+ rm -f inferential/proto/inferential_pb2.py inferential/proto/inferential_pb2.pyi
@@ -0,0 +1,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: inferential
3
+ Version: 0.1.0
4
+ Summary: Robotics-aware inference orchestration on top of Ray Serve
5
+ Author: inferential.sh
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: numpy>=1.24
10
+ Requires-Dist: protobuf>=5.0
11
+ Requires-Dist: pyzmq>=26.0
12
+ Provides-Extra: dev
13
+ Requires-Dist: grpcio-tools>=1.60; extra == 'dev'
14
+ Requires-Dist: pydantic>=2.0; extra == 'dev'
15
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
16
+ Requires-Dist: pytest>=8.0; extra == 'dev'
17
+ Requires-Dist: ray[serve]>=2.9; extra == 'dev'
18
+ Requires-Dist: ruff>=0.4; extra == 'dev'
19
+ Provides-Extra: server
20
+ Requires-Dist: pydantic>=2.0; extra == 'server'
21
+ Requires-Dist: ray[serve]>=2.9; extra == 'server'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # Inferential
25
+
26
+ Multi-client inference orchestration on top of Ray Serve.
27
+
28
+ Inferential sits between your clients and your ML models. It receives observations over ZMQ, schedules inference requests using cadence-aware priority scoring, dispatches to Ray Serve, and streams results back — all with sub-millisecond transport overhead. Built for any scenario where multiple clients need concurrent access to shared models: robotics fleets, game agents, IoT devices, real-time ML pipelines.
29
+
30
+ ## Features
31
+
32
+ - **ZMQ transport** — ROUTER/DEALER sockets with automatic reconnection and zero-copy tensor payloads
33
+ - **Pluggable schedulers** — Deadline-aware (default), batch-optimized, priority-tiered, round-robin
34
+ - **Cadence learning** — EMA-based tracking of each client's request pattern to predict urgency
35
+ - **Protobuf wire protocol** — Typed tensor metadata (dtype, shape, encoding) with binary payload
36
+ - **In-memory metrics** — Ring-buffer storage with label filtering and percentile stats (p50/p95/p99)
37
+ - **Flexible client IDs** — String or integer, your choice
38
+ - **Lightweight client SDK** — No Ray dependency; just `pyzmq`, `protobuf`, and `numpy`
39
+
40
+ ## Install
41
+
42
+ ```bash
43
+ # Client SDK only (robot side)
44
+ pip install inferential
45
+
46
+ # Server with Ray Serve
47
+ pip install inferential[server]
48
+
49
+ # Development
50
+ pip install inferential[dev]
51
+ ```
52
+
53
+ ## Quick Start
54
+
55
+ ### Server
56
+
57
+ ```python
58
+ import asyncio
59
+ from inferential import Server
60
+
61
+ server = Server(bind="tcp://*:5555", models=["policy-v2"])
62
+ server.use_scheduler("deadline_aware")
63
+
64
+ @server.on_metric
65
+ def log_latency(name, value, labels):
66
+ if name == "inference_latency_ms":
67
+ print(f"Client {labels.get('client')}: {value:.1f}ms")
68
+
69
+ asyncio.run(server.run())
70
+ ```
71
+
72
+ ### Client
73
+
74
+ ```python
75
+ import numpy as np
76
+ from inferential import Connection
77
+
78
+ conn = Connection(server="tcp://localhost:5555", client_id="agent-01", client_type="sensor")
79
+ model = conn.model("policy-v2", latency_budget_ms=30.0)
80
+
81
+ # Send observation
82
+ readings = np.array([0.0, -0.78, 0.0, -2.35, 0.0, 1.57, 0.78], dtype=np.float32)
83
+ model.observe(
84
+ urgency=0.8,
85
+ sensor_readings=readings,
86
+ prompt="classify anomaly", # strings go to metadata
87
+ )
88
+
89
+ # Get action
90
+ result = model.get_result(timeout_ms=50)
91
+ if result is not None:
92
+ output = result["actions"] # np.ndarray
93
+ ```
94
+
95
+ ## Observation API
96
+
97
+ `model.observe()` accepts any combination of keyword arguments:
98
+
99
+ - **`np.ndarray`** values are serialized as tensors with full dtype/shape metadata
100
+ - **`str`** values are passed as metadata key-value pairs
101
+ - **`urgency`** (float, 0.0–1.0) — hints how time-critical this request is
102
+ - **`steps_remaining`** (int, optional) — remaining steps in the current trajectory
103
+
104
+ ```python
105
+ # Multi-modal observation
106
+ model.observe(
107
+ urgency=0.5,
108
+ steps_remaining=120,
109
+ state_vector=np.zeros(7, dtype=np.float32),
110
+ image=np.zeros((3, 224, 224), dtype=np.uint8),
111
+ prompt="describe the scene",
112
+ )
113
+ ```
114
+
115
+ ## Schedulers
116
+
117
+ Four built-in strategies, selectable via config or at runtime:
118
+
119
+ | Strategy | Description |
120
+ |----------|-------------|
121
+ | `deadline_aware` | Weighted scoring: cadence, urgency, priority, age (default) |
122
+ | `batch_optimized` | Groups requests per model, flushes on size or time |
123
+ | `priority_tiered` | Strict priority tiers, FIFO within each tier |
124
+ | `round_robin` | Fair rotation across clients |
125
+
126
+ ```python
127
+ from inferential.scheduler.base import create_scheduler
128
+ from inferential.config.schema import SchedulingConfig
129
+
130
+ # Standalone usage — no server needed
131
+ scheduler = create_scheduler(SchedulingConfig(strategy="batch_optimized"))
132
+ scheduler.submit(request)
133
+ batch = scheduler.next_batch()
134
+ ```
135
+
136
+ The server wraps this and lets you swap strategies at runtime:
137
+
138
+ ```python
139
+ server.use_scheduler("deadline_aware", cadence_weight=50.0, urgency_weight=30.0)
140
+ ```
141
+
142
+ ### Custom Scoring Policy
143
+
144
+ Override how the deadline-aware scheduler scores requests:
145
+
146
+ ```python
147
+ from inferential import register_policy, InferenceRequest
148
+
149
+ @register_policy("safety_first")
150
+ def score(req: InferenceRequest) -> float:
151
+ if req.urgency > 0.9:
152
+ return 1000.0
153
+ return req.priority * 10.0
154
+
155
+ server.use_scheduler("deadline_aware", policy="safety_first")
156
+ ```
157
+
158
+ ### Custom Scheduler
159
+
160
+ Implement the `Scheduler` interface and register it:
161
+
162
+ ```python
163
+ from inferential.scheduler.base import Scheduler, register_scheduler
164
+
165
+ @register_scheduler("my_scheduler")
166
+ class MyScheduler(Scheduler):
167
+ def __init__(self, config):
168
+ self._queue = []
169
+
170
+ def submit(self, request):
171
+ self._queue.append(request)
172
+
173
+ def next_batch(self):
174
+ batch, self._queue = self._queue[:8], self._queue[8:]
175
+ return batch
176
+
177
+ def tick(self):
178
+ pass
179
+
180
+ def status(self):
181
+ return {"queue_len": len(self._queue)}
182
+
183
+ def queue_len(self):
184
+ return len(self._queue)
185
+
186
+ server.use_scheduler("my_scheduler")
187
+ ```
188
+
189
+ ## Metrics
190
+
191
+ ```python
192
+ # Query stats over a time window
193
+ stats = server.metrics.get_stats("inference_latency_ms", window_seconds=60)
194
+ print(f"p95 latency: {stats.p95:.1f}ms")
195
+
196
+ # Latest value
197
+ depth = server.metrics.get_latest("queue_depth")
198
+
199
+ # Full snapshot of all metrics
200
+ snapshot = server.metrics.snapshot()
201
+ ```
202
+
203
+ Tracked metrics: `inference_latency_ms`, `observation_staleness_ms`, `payload_size_bytes`, `queue_depth`, `queue_full_drops`, `dispatch_errors`, `dispatch_retries`, `requests_expired`, `active_clients`, `observation_errors`.
204
+
205
+ ## Queue Management
206
+
207
+ The scheduler queue supports TTL, overflow policies, and dispatch retry:
208
+
209
+ | Parameter | Default | Description |
210
+ |-----------|---------|-------------|
211
+ | `request_ttl_ms` | 5000 | Drop queued requests older than this (avoids wasting GPU on stale data) |
212
+ | `overflow_policy` | `"drop_oldest"` | What to do when the queue is full: `"drop_oldest"` evicts the stalest request, `"reject_newest"` drops the incoming one |
213
+ | `max_retries` | 0 | Re-queue failed dispatches up to N times before dropping |
214
+
215
+ ```python
216
+ server.use_scheduler(
217
+ "deadline_aware",
218
+ request_ttl_ms=2000, # 2s TTL
219
+ overflow_policy="drop_oldest", # keep fresh data, discard stale
220
+ max_retries=2, # retry transient failures twice
221
+ )
222
+ ```
223
+
224
+ ## Configuration
225
+
226
+ ```python
227
+ from inferential.config import InferentialConfig
228
+
229
+ config = InferentialConfig(
230
+ transport={"bind": "tcp://*:5555", "recv_hwm": 2000},
231
+ scheduling={
232
+ "strategy": "deadline_aware",
233
+ "max_queue_size": 500,
234
+ "request_ttl_ms": 3000,
235
+ "overflow_policy": "drop_oldest",
236
+ "max_retries": 1,
237
+ },
238
+ clients={
239
+ "defaults": {"latency_budget_ms": 50.0, "priority": 1},
240
+ "known": [
241
+ {"id": "agent-01", "model": "policy-v2", "latency_budget_ms": 30.0, "priority": 2},
242
+ ],
243
+ "accept_unknown": True,
244
+ },
245
+ response_tracking={"cadence_alpha": 0.3, "disconnect_timeout_s": 10.0},
246
+ metrics={"ring_buffer_size": 10000},
247
+ )
248
+
249
+ server = Server(config=config)
250
+ ```
251
+
252
+ ## Wire Protocol
253
+
254
+ Messages use protobuf serialization over ZMQ multipart frames:
255
+
256
+ ```
257
+ [identity | "" | envelope (protobuf) | payload (binary tensors)]
258
+ ```
259
+
260
+ - **Observation** (client -> server): client info, model ID, urgency, tensor descriptors, metadata
261
+ - **ModelResponse** (server -> client): response ID, inference latency, output tensors, metadata
262
+
263
+ Supported tensor dtypes: `float16`, `float32`, `float64`, `bfloat16`, `uint8`, `int32`, `int64`, `bool`.
264
+ Supported encodings: `raw`, `jpeg`, `png`.
265
+
266
+ ## Development
267
+
268
+ ```bash
269
+ # Generate protobuf code
270
+ make proto
271
+
272
+ # Run tests
273
+ make test
274
+
275
+ # Lint
276
+ make lint
277
+ ```
278
+
279
+ ## License
280
+
281
+ Apache-2.0