halfabyte-synapse 0.2.0__py3-none-any.whl
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.
- halfabyte_synapse-0.2.0.dist-info/METADATA +254 -0
- halfabyte_synapse-0.2.0.dist-info/RECORD +102 -0
- halfabyte_synapse-0.2.0.dist-info/WHEEL +5 -0
- halfabyte_synapse-0.2.0.dist-info/entry_points.txt +2 -0
- halfabyte_synapse-0.2.0.dist-info/licenses/LICENSE +21 -0
- halfabyte_synapse-0.2.0.dist-info/top_level.txt +1 -0
- synapse/__init__.py +57 -0
- synapse/__main__.py +14 -0
- synapse/alerts.py +227 -0
- synapse/api/__init__.py +0 -0
- synapse/api/main.py +967 -0
- synapse/bot.py +161 -0
- synapse/capsule.py +58 -0
- synapse/chaos_panel.py +138 -0
- synapse/chatops.py +363 -0
- synapse/ci.py +109 -0
- synapse/cli.py +1321 -0
- synapse/core/__init__.py +0 -0
- synapse/core/agents.py +70 -0
- synapse/core/effects.py +345 -0
- synapse/core/hashing.py +85 -0
- synapse/core/lattice.py +60 -0
- synapse/core/retention.py +87 -0
- synapse/core/sir.py +654 -0
- synapse/core/store.py +568 -0
- synapse/core/store_mongo.py +420 -0
- synapse/correctness/__init__.py +6 -0
- synapse/correctness/audit.py +107 -0
- synapse/correctness/chaos.py +180 -0
- synapse/correctness/equivalence.py +114 -0
- synapse/correctness/firewall.py +274 -0
- synapse/correctness/net_rule.py +114 -0
- synapse/correctness/preconditions.py +212 -0
- synapse/correctness/receipt.py +80 -0
- synapse/correctness/runner.py +199 -0
- synapse/correctness/splits.py +39 -0
- synapse/correctness/verify.py +240 -0
- synapse/data/models.yaml +85 -0
- synapse/demo.py +477 -0
- synapse/doctor.py +80 -0
- synapse/export.py +51 -0
- synapse/frontend/__init__.py +0 -0
- synapse/frontend/adapters/__init__.py +0 -0
- synapse/frontend/adapters/adk.py +300 -0
- synapse/frontend/adapters/crewai.py +441 -0
- synapse/frontend/adapters/langgraph.py +290 -0
- synapse/frontend/dsl.py +602 -0
- synapse/frontend/importers/__init__.py +45 -0
- synapse/frontend/importers/_common.py +102 -0
- synapse/frontend/importers/blackbox.py +41 -0
- synapse/frontend/importers/langfuse.py +64 -0
- synapse/frontend/importers/otel.py +105 -0
- synapse/frontend/lift.py +376 -0
- synapse/insights.py +205 -0
- synapse/mcp/__init__.py +22 -0
- synapse/mcp/__main__.py +5 -0
- synapse/mcp/prompts.py +88 -0
- synapse/mcp/protocol.py +35 -0
- synapse/mcp/registry.py +123 -0
- synapse/mcp/resources.py +84 -0
- synapse/mcp/server.py +124 -0
- synapse/mcp/tools.py +531 -0
- synapse/menus.py +146 -0
- synapse/monitor.py +144 -0
- synapse/passes/__init__.py +5 -0
- synapse/passes/base.py +414 -0
- synapse/passes/batch.py +189 -0
- synapse/passes/constfold.py +204 -0
- synapse/passes/context_prune.py +214 -0
- synapse/passes/context_trim.py +96 -0
- synapse/passes/cse.py +195 -0
- synapse/passes/dce.py +125 -0
- synapse/passes/downgrade.py +241 -0
- synapse/passes/early_exit.py +232 -0
- synapse/passes/loop_cutoff.py +140 -0
- synapse/passes/manager.py +439 -0
- synapse/passes/memoize.py +161 -0
- synapse/passes/parallelize.py +325 -0
- synapse/passes/speculate.py +178 -0
- synapse/profile/__init__.py +20 -0
- synapse/profile/collect.py +275 -0
- synapse/profile/costmodel.py +85 -0
- synapse/profile/critical_path.py +98 -0
- synapse/profile/ledger.py +145 -0
- synapse/profile/presentation.py +65 -0
- synapse/profile/pricing.py +25 -0
- synapse/profile/waste.py +64 -0
- synapse/proxy.py +123 -0
- synapse/quarantine.py +24 -0
- synapse/runtime/__init__.py +0 -0
- synapse/runtime/cache.py +157 -0
- synapse/runtime/executor.py +667 -0
- synapse/runtime/meter.py +89 -0
- synapse/runtime/providers.py +434 -0
- synapse/runtime/rate_gate.py +71 -0
- synapse/runtime/recording.py +199 -0
- synapse/runtime/scheduler.py +686 -0
- synapse/runtime/semantic.py +97 -0
- synapse/search.py +183 -0
- synapse/skills/__init__.py +32 -0
- synapse/skills/synapse/SKILL.md +73 -0
- synapse/skills/synapse/references/effects.md +24 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: halfabyte-synapse
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A compiler and runtime for AI agent workflows: faster and cheaper runs, with side effects protected and every change checked by a firewall.
|
|
5
|
+
Author: Aryan Lomte, Radhesh, Aditya, Advay Chavan
|
|
6
|
+
Maintainer: Half a Byte
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Keywords: ai-agents,llm,compiler,optimization,workflow,intermediate-representation,agent-runtime,scheduling,caching,profiling,observability,mcp,benchmarking,groq,ollama,crewai,langgraph,google-adk,whatsapp
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
17
|
+
Classifier: Topic :: Software Development :: Testing
|
|
18
|
+
Classifier: Topic :: System :: Benchmark
|
|
19
|
+
Classifier: Topic :: System :: Monitoring
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Environment :: Console
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: pydantic>=2.5
|
|
26
|
+
Requires-Dist: pyyaml>=6
|
|
27
|
+
Requires-Dist: python-dotenv>=1
|
|
28
|
+
Requires-Dist: openai>=1.40
|
|
29
|
+
Requires-Dist: psutil>=5.9
|
|
30
|
+
Provides-Extra: ui
|
|
31
|
+
Requires-Dist: fastapi>=0.110; extra == "ui"
|
|
32
|
+
Requires-Dist: uvicorn[standard]>=0.29; extra == "ui"
|
|
33
|
+
Requires-Dist: sse-starlette>=2; extra == "ui"
|
|
34
|
+
Provides-Extra: ml
|
|
35
|
+
Requires-Dist: scikit-learn>=1.4; extra == "ml"
|
|
36
|
+
Requires-Dist: lightgbm>=4; extra == "ml"
|
|
37
|
+
Requires-Dist: numpy; extra == "ml"
|
|
38
|
+
Provides-Extra: bench
|
|
39
|
+
Requires-Dist: rank-bm25>=0.2; extra == "bench"
|
|
40
|
+
Requires-Dist: datasets>=2.18; extra == "bench"
|
|
41
|
+
Provides-Extra: cloud
|
|
42
|
+
Requires-Dist: pymongo>=4.6; extra == "cloud"
|
|
43
|
+
Provides-Extra: crewai
|
|
44
|
+
Requires-Dist: crewai<1.16,>=1.15; extra == "crewai"
|
|
45
|
+
Provides-Extra: langgraph
|
|
46
|
+
Requires-Dist: langgraph<1.1,>=1.0; extra == "langgraph"
|
|
47
|
+
Provides-Extra: adk
|
|
48
|
+
Requires-Dist: google-adk<2.14,>=2.13; extra == "adk"
|
|
49
|
+
Provides-Extra: dev
|
|
50
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
51
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
52
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
53
|
+
Requires-Dist: mongomock>=4.1; extra == "dev"
|
|
54
|
+
Provides-Extra: all
|
|
55
|
+
Requires-Dist: halfabyte-synapse[bench,cloud,ml,ui]; extra == "all"
|
|
56
|
+
Dynamic: license-file
|
|
57
|
+
|
|
58
|
+
# Synapse
|
|
59
|
+
|
|
60
|
+
**A compiler and runtime for AI agent workflows.** It finds the work your agent repeats or waits for, makes it faster and cheaper, and refuses any change it can't check.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install halfabyte-synapse
|
|
64
|
+
synapse demo
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
No API key, GPU or model needed: the demo runs on a built-in fake provider. The package is `halfabyte-synapse`; the command and the import are both `synapse`.
|
|
68
|
+
|
|
69
|
+
Built by team **Half a Byte** for the BitNBuild 2026 "Around the World" final round (GDG On Campus, Fr. Conceicao Rodrigues College of Engineering), AI/ML problem statement 2.
|
|
70
|
+
|
|
71
|
+
## Why it exists
|
|
72
|
+
|
|
73
|
+
Agents run steps one after another even when nothing connects them, repeat calls they have already made, and send context nobody reads. Fixing that by hand is easy to get wrong: run two steps together, and a model may answer differently. Cache a step, and an email may never get sent.
|
|
74
|
+
|
|
75
|
+
Synapse treats a workflow as a program:
|
|
76
|
+
|
|
77
|
+
1. **Compile** it to SIR, a graph where every dependency is explicit and every step declares what it can do to the world.
|
|
78
|
+
2. **Profile** real runs: time on the clock, tokens from the provider, and cost from listed prices. If nobody reported a number, it stays blank.
|
|
79
|
+
3. **Optimize** with passes that each state when they are safe. The passes are chosen by measuring them.
|
|
80
|
+
4. **Check** the result with a firewall that runs both versions on real tasks and returns **APPROVE** or **BLOCK**.
|
|
81
|
+
|
|
82
|
+
## What makes it different
|
|
83
|
+
|
|
84
|
+
- **It says no.** A BLOCK shows which tasks broke. You can plant a fault and watch the firewall catch it.
|
|
85
|
+
- **Side effects are law.** A step that sends an email or moves money is never cached, reordered or repeated. Steps that can't be undone never run while Synapse is testing.
|
|
86
|
+
- **It measures what others assume.** `synapse audit` checks whether a model server keeps its answers when requests overlap. On local Ollama, 5 of 6 prompts changed under concurrency.
|
|
87
|
+
- **It counts its own cost.** The savings ledger counts every run Synapse makes to check an optimization, and says when that pays back, including "never".
|
|
88
|
+
- **It says what it can't do.** Unknown values stay blank, demo results are labelled, and `batch` is listed as marking steps only.
|
|
89
|
+
|
|
90
|
+
## Real results
|
|
91
|
+
|
|
92
|
+
Held-out tasks on Groq `qwen/qwen3.8-27b`, `memoize` and `parallelize`, cold cache. Costs use Groq's listed prices.
|
|
93
|
+
|
|
94
|
+
| Workflow | Tasks | Time (p50) | Speedup | Tokens per task | Cost per task | Tasks passing | Answers broken | Firewall |
|
|
95
|
+
|---|---|---|---|---|---|---|---|---|
|
|
96
|
+
| `research_fanout` | 41 | 2.35 s to 1.39 s | 1.82x | 2,333 to 2,040 (-12.6%) | $0.00264 to $0.00232 (-12.2%) | 36 to 36 | 0 | **APPROVE** |
|
|
97
|
+
| `code_review` | 41 | 1.64 s to 0.81 s | 2.15x | no change | no change | 25 to 25 | 0 | **BLOCK** |
|
|
98
|
+
|
|
99
|
+
How to read this:
|
|
100
|
+
|
|
101
|
+
- **The APPROVE rests on cost and tokens.** Both speedups fall just inside the measured noise band (47.9% and 52.7%, against time gains of 41.1% and 50.7%), so the firewall doesn't count them as proven. That's why `code_review` is blocked even though nothing broke.
|
|
102
|
+
- **This is a second look at these tasks.** They ran first on a local model, and we chose this provider after seeing those results.
|
|
103
|
+
- **Locally, the same tasks blocked.** On Ollama, `research_fanout` reached 1.51x with 2 answers broken. That break led us to find that Ollama changes answers under concurrent requests.
|
|
104
|
+
- **Checking has a cost.** At these savings, the `research_fanout` check pays for itself after about 1,230 runs.
|
|
105
|
+
|
|
106
|
+
Fake-provider demos measure scheduling, not a model, so don't read them as model performance. "Verified" here means on these tasks, not proven for every input.
|
|
107
|
+
|
|
108
|
+
## Effect tiers
|
|
109
|
+
|
|
110
|
+
Every step has one, and it decides what Synapse may do. An undeclared tool is assumed to be `external`.
|
|
111
|
+
|
|
112
|
+
| Effect | Means | Example | What's allowed |
|
|
113
|
+
|---|---|---|---|
|
|
114
|
+
| `pure` | Same input, same output, nothing else happens | A seeded model call, a parse | Every rewrite, except merging random samples |
|
|
115
|
+
| `read` | Looks at the outside world | Web search, retrieval | Reuse while still fresh, overlap |
|
|
116
|
+
| `write` | Changes the workflow's own state | An agent's memory | Ordered by key, overlap only on separate keys |
|
|
117
|
+
| `external` | Changes the outside world | An email, a POST | Nothing: never repeated, reordered or cached |
|
|
118
|
+
| `irreversible` | Can't be undone | An order, a payment | As `external`, and never run while testing |
|
|
119
|
+
|
|
120
|
+
## Passes
|
|
121
|
+
|
|
122
|
+
`synapse passes` prints each one's safety rule, and `synapse explain PASS` explains one.
|
|
123
|
+
|
|
124
|
+
| Pass | What it does | Default |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| `constfold` | Works out pure steps over fixed values at compile time | on |
|
|
127
|
+
| `dce` | Removes steps whose results nothing uses | on |
|
|
128
|
+
| `context_prune` | Drops arguments a prompt never references | on |
|
|
129
|
+
| `cse` | Merges steps that compute the same thing | on |
|
|
130
|
+
| `loop_cutoff` | Stops a loop once its state stops changing | on |
|
|
131
|
+
| `memoize` | Serves a repeat from a content-addressed cache | on |
|
|
132
|
+
| `parallelize` | Runs independent steps together, within limits | on |
|
|
133
|
+
| `downgrade` | Moves a call to a cheaper model on the same provider | on |
|
|
134
|
+
| `speculate` | Starts a read before its branch is decided, within a budget | off |
|
|
135
|
+
| `context_trim` | Clips context, kept only if the firewall approves | off |
|
|
136
|
+
| `early_exit` | Ends early on a calibrated confidence signal | off |
|
|
137
|
+
| `batch` | Marks calls that could share a request. **The runtime doesn't fuse them yet** | off |
|
|
138
|
+
|
|
139
|
+
## Tools
|
|
140
|
+
|
|
141
|
+
### Commands
|
|
142
|
+
|
|
143
|
+
| Command | What it does |
|
|
144
|
+
|---|---|
|
|
145
|
+
| `synapse demo [--workflow NAME\|all]` | Compile, optimize and compare, with no provider |
|
|
146
|
+
| `synapse compile`, `graph`, `graphs` | Turn a workflow into SIR, and read it back |
|
|
147
|
+
| `synapse import FORMAT FILE` | Turn an OTel, Langfuse or Black Box trace into SIR |
|
|
148
|
+
| `synapse optimize`, `run`, `compare` | Optimize, execute with measurements, compare |
|
|
149
|
+
| `synapse profile`, `why`, `explain` | Measured profile, why a step wasn't optimized, what a pass does |
|
|
150
|
+
| `synapse verify GRAPH` | Run the firewall |
|
|
151
|
+
| `synapse force GRAPH PASS` | Apply one pass and let the firewall judge it |
|
|
152
|
+
| `synapse replay GRAPH` | Check on recordings: tokens only where a prompt changed |
|
|
153
|
+
| `synapse receipt GRAPH` | A record of the verdict that shows if it was edited; `--check FILE --rerun` tests one |
|
|
154
|
+
| `synapse savings GRAPH` | What checking cost, what it saves per run, when it pays back |
|
|
155
|
+
| `synapse audit --model ID` | Does this model keep its answers under concurrent requests? |
|
|
156
|
+
| `synapse chaos GRAPH FAULT` | Break a demo workflow on purpose |
|
|
157
|
+
| `synapse diagnose FORMAT FILE` | Waste report on a trace, changing nothing |
|
|
158
|
+
| `synapse agents`, `export`, `capsule` | Multi-agent view, Mermaid, DOT or JSON export, one run as a file |
|
|
159
|
+
| `synapse crew`, `langgraph`, `adk` | Run a CrewAI, LangGraph or Google ADK workflow through Synapse |
|
|
160
|
+
| `synapse proxy --upstream URL` | Point any OpenAI client's `base_url` here to record its calls |
|
|
161
|
+
| `synapse ci pin\|run WORKFLOW` | Fail when a workflow gets slower, costlier or less correct |
|
|
162
|
+
| `synapse monitor` | Watch runs and alert on crashes, slowdowns and overspend |
|
|
163
|
+
| `synapse alerts`, `digest` | Test alert channels, send a summary |
|
|
164
|
+
| `synapse bot` | Operate Synapse from WhatsApp and Slack |
|
|
165
|
+
| `synapse storage`, `doctor`, `models` | What's stored, find setup problems, check model names |
|
|
166
|
+
| `synapse ui`, `mcp`, `skill` | Serve the API, run the MCP server, install the agent Skill |
|
|
167
|
+
| `synapse bench` | Benchmark suite, from a repository checkout only |
|
|
168
|
+
|
|
169
|
+
### Write a workflow
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
from synapse import Effect, node, workflow
|
|
173
|
+
|
|
174
|
+
@node(kind="retrieval", target="web_search", effect=Effect.READ, staleness_s=3600)
|
|
175
|
+
def search(query: str) -> list[str]:
|
|
176
|
+
...
|
|
177
|
+
|
|
178
|
+
@node(kind="io", target="send_email", effect=Effect.EXTERNAL)
|
|
179
|
+
def send(text: str) -> str:
|
|
180
|
+
...
|
|
181
|
+
|
|
182
|
+
@workflow(name="my_agent")
|
|
183
|
+
def my_agent(question: str):
|
|
184
|
+
...
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Multi-agent workflows wrap steps in `with agent("researcher"):`, and they're still one graph.
|
|
188
|
+
|
|
189
|
+
### Use it with no code changes
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
synapse proxy --upstream https://api.groq.com/openai/v1
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Point your client's `base_url` at `http://127.0.0.1:8030/v1`. Synapse records every call and serves exact repeats only when `temperature` is 0. `GET /synapse/report` shows the waste. It sees model calls, not your tools. Streaming isn't supported yet.
|
|
196
|
+
|
|
197
|
+
### Use it from an AI agent
|
|
198
|
+
|
|
199
|
+
`synapse mcp` is an MCP server with 21 tools, such as `optimize`, `why_not_optimized`, `verify`, `savings` and `inject_fault`. `synapse skill --target openclaw` installs a lean Skill instead (`hermes`, `claude` or a folder also work). Start a new agent session afterwards.
|
|
200
|
+
|
|
201
|
+
### Operate it from WhatsApp and Slack
|
|
202
|
+
|
|
203
|
+
`synapse bot` gives you tappable WhatsApp menus through Twilio, and buttons in Slack. Send `hi`, or type a command such as `health`, `spend`, `verify research_fanout`, `chaos research_fanout crash`, `pending` or `ship`. Only signed requests from allowed numbers get in. Nothing runs live, and `ship` refuses anything the firewall hasn't approved. Email is outbound only.
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
synapse bot --port 8010
|
|
207
|
+
ngrok http 8010 # any tunnel works; set SYNAPSE_BOT_URL to its address
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Install options
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
pip install "halfabyte-synapse[ui]" # the API server
|
|
214
|
+
pip install "halfabyte-synapse[cloud]" # MongoDB or Atlas as the store
|
|
215
|
+
pip install "halfabyte-synapse[ml]" # the learned pass policy
|
|
216
|
+
pip install "halfabyte-synapse[all]" # all of the above, plus benchmark loaders
|
|
217
|
+
pip install "halfabyte-synapse[crewai]" # or [langgraph], or [adk]
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
`crewai` and `adk` can't share an environment, because their OpenTelemetry requirements clash.
|
|
221
|
+
|
|
222
|
+
## Configuration
|
|
223
|
+
|
|
224
|
+
Settings live in `.env`, and models live in `models.yaml`. Everything is optional.
|
|
225
|
+
|
|
226
|
+
| Setting | For |
|
|
227
|
+
|---|---|
|
|
228
|
+
| `GROQ_API_KEYS`, `OPENROUTER_API_KEYS` | Comma-separated keys for those providers |
|
|
229
|
+
| `SYNAPSE_STORE` | `mongodb+srv://...` for a shared store. Local SQLite otherwise |
|
|
230
|
+
| `SYNAPSE_READ_ONLY=1` | API serves reads only, for public hosting |
|
|
231
|
+
| `SLACK_WEBHOOK_URL`, `SLACK_SIGNING_SECRET` | Slack alerts, commands and buttons |
|
|
232
|
+
| `TWILIO_ACCOUNT_SID`, `TWILIO_AUTH_TOKEN`, `TWILIO_WHATSAPP_FROM`, `ALERT_WHATSAPP_TO` | WhatsApp |
|
|
233
|
+
| `EMAILJS_SERVICE_ID`, `EMAILJS_TEMPLATE_ID`, `EMAILJS_PUBLIC_KEY`, `EMAILJS_PRIVATE_KEY`, `ALERT_EMAIL_TO` | Email |
|
|
234
|
+
| `SYNAPSE_RPM_<PROVIDER>`, `SYNAPSE_TPM_<PROVIDER>` | Wait before a rate limit is hit |
|
|
235
|
+
| `SYNAPSE_RECEIPT_KEY` | Sign receipts |
|
|
236
|
+
|
|
237
|
+
Runs are stored locally by default, as digests rather than full outputs, for 30 days, with a 256 MB cache. `synapse storage` shows what's held.
|
|
238
|
+
|
|
239
|
+
## Limits
|
|
240
|
+
|
|
241
|
+
- Correctness is checked on your tasks, not proven for every input. Without checkers, there's nothing to judge against.
|
|
242
|
+
- `verify`, `force`, `replay` and `chaos` run on built-in demo workflows. Real corpora run through `synapse bench` in a repository checkout.
|
|
243
|
+
- Replay can't see a server that changes answers under load, so run `synapse audit` first.
|
|
244
|
+
- A live run never reuses recordings, so only stubbed runs resume after a crash.
|
|
245
|
+
- The semantic cache uses word overlap, not embeddings, and is experimental.
|
|
246
|
+
- Adapters refuse what they can't compile safely, such as CrewAI hierarchical crews and LangGraph conditional edges.
|
|
247
|
+
|
|
248
|
+
## Team
|
|
249
|
+
|
|
250
|
+
Half a Byte: Aryan Lomte ([Aryan-lomte05](https://github.com/Aryan-lomte05)), Radhesh ([rad117](https://github.com/rad117)), Aditya ([02Aditya2323](https://github.com/02Aditya2323)), Advay Chavan ([advay1608](https://github.com/advay1608)).
|
|
251
|
+
|
|
252
|
+
## License
|
|
253
|
+
|
|
254
|
+
MIT.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
halfabyte_synapse-0.2.0.dist-info/licenses/LICENSE,sha256=TgqA3Z6fXkUJczI8JIfr7GZ6hiTbCvXdLbM5SciUmSo,1068
|
|
2
|
+
synapse/__init__.py,sha256=cGrKhE8gLQWE1JBYJ4JgJanhWAKj5JvC2_Y3mP-9_QU,1212
|
|
3
|
+
synapse/__main__.py,sha256=7g780qnuYI5ZkcXg2uRv6e35ooajF7LgJysuiQGALXA,463
|
|
4
|
+
synapse/alerts.py,sha256=xhRlQ-AFvmVNQDy_PCMrITopb8edaM4hnn8eiq6IQlk,9678
|
|
5
|
+
synapse/bot.py,sha256=zb_ct8lmOJVExSb79UKENpW7zNjlF4v-ZNKsYzrXw5s,7698
|
|
6
|
+
synapse/capsule.py,sha256=RhFYz75Y0HVgP4UjsuPbxmPJkparlP0nnBHUh5Dm0AE,2740
|
|
7
|
+
synapse/chaos_panel.py,sha256=3IWaC571mgyVB3nlC97ohs1zFxXRGn6sqYDs-oo5Wsc,6338
|
|
8
|
+
synapse/chatops.py,sha256=1TvIIsQ8iN2tFP1g-MJYBd4bnp-0BMRzcQnIviBmpMM,16484
|
|
9
|
+
synapse/ci.py,sha256=h_eOzjKTww_Eo56mZCjkLXo2D5vndtDXShXHel5Ph60,4978
|
|
10
|
+
synapse/cli.py,sha256=4pCLsRlEx5Tj6cmJTuMMifotrsdTmRmPLlwie6mQcCk,56637
|
|
11
|
+
synapse/demo.py,sha256=tU27JjMbnn1hUyTXo6THb-cVqoYQ_4JbYtiSAJk5KbY,20211
|
|
12
|
+
synapse/doctor.py,sha256=NseZHmnZu39YAIrfF7RAyeqYuM06kw6TGCYTAAEutQM,3816
|
|
13
|
+
synapse/export.py,sha256=umij6dqep54a2DEsrVcqZLWl0I0O6gJLn6kAin7IIGs,1817
|
|
14
|
+
synapse/insights.py,sha256=qbkYPPIiZOEL6pfj78ISTO9LEuJtNtgpx6UK_aNhgkc,8861
|
|
15
|
+
synapse/menus.py,sha256=n8fhTMWnGgI9QmQN5iTKChoj3Jti4_VwaBbrwNKlG40,6212
|
|
16
|
+
synapse/monitor.py,sha256=zIJFoqqPOofAyMcT0jPAPEuWBjh1GTOROVhv5JCkhMk,6608
|
|
17
|
+
synapse/proxy.py,sha256=TiDid8_ot9WZuYGWo39ZNkt8aEhaeswIzFzK07AYsjs,5480
|
|
18
|
+
synapse/quarantine.py,sha256=hpVsfO0pMWPns425WlDjJPcQrK0uqTPb2oYtQ7m2MIA,789
|
|
19
|
+
synapse/search.py,sha256=xUwAggy4XVi4jNK1bAESxMHpd9eaEFc-_zdYp3WJr7k,9385
|
|
20
|
+
synapse/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
synapse/api/main.py,sha256=_buUpcSRDPF3WQl_UxWwWMSFXKcxwSo66oHLZWWVLck,37711
|
|
22
|
+
synapse/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
synapse/core/agents.py,sha256=lVPSN8BgeZn2uLCAU8fIBJ6sTkv9EyGT0nHELpvEoog,2841
|
|
24
|
+
synapse/core/effects.py,sha256=gE_CDJwtf3H1zCvO7qpkpnDqefNi6OBg7O9BkqLsFhU,14592
|
|
25
|
+
synapse/core/hashing.py,sha256=ij9TONvF3d1xKHYcsEFNnDIOwreJeYK_30D8pO8fHDA,3554
|
|
26
|
+
synapse/core/lattice.py,sha256=EAMvhx14Kq4r2Z6qVG-Qo7gVZEJ4ciGYRxHtCgE0YY8,2894
|
|
27
|
+
synapse/core/retention.py,sha256=BJRh7ULyvUseGYEE3W96ksVS2brL24SzMIO-stFU64E,3447
|
|
28
|
+
synapse/core/sir.py,sha256=gjWeQbutXqOyr06pgEWaEvUtOuU1jlznShDQHJHssTM,25856
|
|
29
|
+
synapse/core/store.py,sha256=EJfwcinBrdwhg4wIaJz_ICEBSPd7Kpv__2hsm9Zfo3M,24724
|
|
30
|
+
synapse/core/store_mongo.py,sha256=ONxInKJL63tBgw-8_xkeLSSlDP0QZwrZAz6-ACiIAz8,17545
|
|
31
|
+
synapse/correctness/__init__.py,sha256=T5dpD95WrivRj7TfIBcrdjbF_UWDSi2yVu4qNe3zB7Y,221
|
|
32
|
+
synapse/correctness/audit.py,sha256=0PrRSs1h5P4omuVs5-l7xOJZkpxV5bPsyN_I73PVp0Y,4654
|
|
33
|
+
synapse/correctness/chaos.py,sha256=yN7bpNpViP3IXTlXbTtaS0g0pwqNalByysFqoxbkWlY,7185
|
|
34
|
+
synapse/correctness/equivalence.py,sha256=gceZCyCa71yksK9G8lvn-QxZhcm_yEvj9miSGI9cPM8,4426
|
|
35
|
+
synapse/correctness/firewall.py,sha256=0fbTetTvKfUhL1THu6EwEnQIew3Z5NvqJkaYH55fXr0,12132
|
|
36
|
+
synapse/correctness/net_rule.py,sha256=LwKGYvX4NgMxt9jDAH7Rx_b39jLPZXNYLDggoZaLjNY,5439
|
|
37
|
+
synapse/correctness/preconditions.py,sha256=62NFHLZDjmeVEJ0zV9zUKTqGT-S1vc_WWB3awe7BRnk,8411
|
|
38
|
+
synapse/correctness/receipt.py,sha256=oAyhH8cJAWc_42vOYXT4fzVvWEs2Sv_Y0-OdcVWmTSM,3475
|
|
39
|
+
synapse/correctness/runner.py,sha256=lCYMvz_N0JN-Fp1UDd4M61OWB3a0bMpRfksR86z34rA,9385
|
|
40
|
+
synapse/correctness/splits.py,sha256=GTbIfxHi_GiV6NUO6u-h-Rn1OSvch-65kpt8_A5UGW4,1360
|
|
41
|
+
synapse/correctness/verify.py,sha256=ALXlY50zyLFff7GEhvTNzVOAV4lt86MXocymv_Bxx3I,10822
|
|
42
|
+
synapse/data/models.yaml,sha256=LKAvyjp7tQhwFSMLUTRUbLyeetljPOCIWOXEyCA3epU,3108
|
|
43
|
+
synapse/frontend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
+
synapse/frontend/dsl.py,sha256=rkjVwDHWOkl-pcTAcZA2m24WzH7h6boIE6bM3pq2QW4,24461
|
|
45
|
+
synapse/frontend/lift.py,sha256=DnTLIhUqpqdJtpWoETDVzXZvkKdYwNAzStmmNoS3qrY,15158
|
|
46
|
+
synapse/frontend/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
|
+
synapse/frontend/adapters/adk.py,sha256=3nRTKmaGSy9QYDQXpU59xxXr8e8Kge93YUZuf-6wLRM,15152
|
|
48
|
+
synapse/frontend/adapters/crewai.py,sha256=UvdJsL_ZAXpRV_Zh71aERjMHeNKT2kQKkZfMYAcjdJg,19113
|
|
49
|
+
synapse/frontend/adapters/langgraph.py,sha256=y_1XXULZloIqQtOThYY8x67DTyOCzFQuoagb4Rx04nE,13610
|
|
50
|
+
synapse/frontend/importers/__init__.py,sha256=-NIzgDBD-35BomXTPOp-zyghdK3yM5l9slmMAHd9D14,1571
|
|
51
|
+
synapse/frontend/importers/_common.py,sha256=a5zRxCRfVmdaTFmDZT8_SLhxQ513jLZol0Acnv-ffFQ,3925
|
|
52
|
+
synapse/frontend/importers/blackbox.py,sha256=sYbub0-dgMjk4Z1ChuzThWXM0Kesz8DMd4sV0PtuR0I,1816
|
|
53
|
+
synapse/frontend/importers/langfuse.py,sha256=xftnOs5ENPEYXtItVAQOSSkViGZfgNQ2mxmEN7wAfoQ,3056
|
|
54
|
+
synapse/frontend/importers/otel.py,sha256=725GZu_aESx_CzltdQ_BI5Dr5bmW0toHR6WXgjUY7cA,4513
|
|
55
|
+
synapse/mcp/__init__.py,sha256=qNKlB00jTpgn8aKDH5YJHnHcf7GBT2So9cHkKHka4sw,1085
|
|
56
|
+
synapse/mcp/__main__.py,sha256=rKr8Rh-vtu4r9GR2_vyhM6lEzmmMll4pUZpqDmCOcss,68
|
|
57
|
+
synapse/mcp/prompts.py,sha256=SlqFEUVLM3tabfobVWY61f-azvuWBwJBgwjMAseUE48,4178
|
|
58
|
+
synapse/mcp/protocol.py,sha256=3CYqjqFSf0Ap2dV_MR-rjNSfxjSpc95DXmQjA1yfo9k,1127
|
|
59
|
+
synapse/mcp/registry.py,sha256=3M-RVFSJLYYZZ_X9ta9e3uY8K5TMVBhOYwSkmSalgVo,3610
|
|
60
|
+
synapse/mcp/resources.py,sha256=9O2t4bWvGyzsCSDPcTrtSl_G-RmwUvgPpwIBm-b9Fvg,2935
|
|
61
|
+
synapse/mcp/server.py,sha256=RaDEKpVZUxzE4UYZ-TY1p8c46_YZtOxoMbc0eVCZ4eY,5356
|
|
62
|
+
synapse/mcp/tools.py,sha256=vBG4BKlRMlF7zholKPtRSEQ7CQ98LTSNKvlMiPQ2l2g,19357
|
|
63
|
+
synapse/passes/__init__.py,sha256=VBm6-u3mNpR0TB30e_X2SEJ6Dh5jUnfhJFQoFIlGork,185
|
|
64
|
+
synapse/passes/base.py,sha256=lwszAyOa9mQfZDru_HPvEY226THAHH1Y3IdhTekruiY,15490
|
|
65
|
+
synapse/passes/batch.py,sha256=hI6hUyFT0m2UORi9P-jV5OM31PE0QoGuB_RGaJnHQAA,7596
|
|
66
|
+
synapse/passes/constfold.py,sha256=ZPslJ2ZyqdgUrkR6ysCzqDKx2mwNPwRAqA5GHxOHfGQ,8265
|
|
67
|
+
synapse/passes/context_prune.py,sha256=9nObaDCaL7RLbPRAhZdhrRbSNvD_MIGVUAmo-fcmEiQ,9331
|
|
68
|
+
synapse/passes/context_trim.py,sha256=hX_m00PQh-pwT_DL5eKpL2zzZyapS6sgmo1D62eX_0w,3879
|
|
69
|
+
synapse/passes/cse.py,sha256=FfMyuj682qUssASqBA8MC3omKwhfbFSl9rRSSA2twCA,8466
|
|
70
|
+
synapse/passes/dce.py,sha256=sQvspjc56tpwI_FL7-4YatnQQ-eXBPgUc0HThgdWDzA,4872
|
|
71
|
+
synapse/passes/downgrade.py,sha256=eyoSPPfRJ6_rl_EiU5RmFL5R4lgQj34Y5oKweV9vJwc,10305
|
|
72
|
+
synapse/passes/early_exit.py,sha256=pvFspqf4hoC-GwljOJokjlka6qLaH2U1KMl5mZZqKnk,9367
|
|
73
|
+
synapse/passes/loop_cutoff.py,sha256=5k6NsUcoWs0PJbXT1TxxagKrT_qpHx3ApZ5enHYYNHQ,5983
|
|
74
|
+
synapse/passes/manager.py,sha256=4xhs514hl_qRbM7Y7TAuPi-_hU4x-AuGf6Lk0OPOoq4,20864
|
|
75
|
+
synapse/passes/memoize.py,sha256=ux6lOj3aj-weQ79EOFXyYzyW-usXs7UIykRHPI2Pmlo,6275
|
|
76
|
+
synapse/passes/parallelize.py,sha256=rEFKaZmELbXMEuZOXI78JIOuekeaR_v_uTHx_x9T1Hc,14716
|
|
77
|
+
synapse/passes/speculate.py,sha256=8bbtNTYyTQmFmHaU9ciB8E4-Tbt48qyMgfo1r38gaLI,7255
|
|
78
|
+
synapse/profile/__init__.py,sha256=F2z4JPAwusCpggRME8l5BQ61xio8Q8SGkPKTiFi1KyA,521
|
|
79
|
+
synapse/profile/collect.py,sha256=DJt4fIq6zicaOdACCofaHIiJlPosozgQlvZZqLplFKQ,10052
|
|
80
|
+
synapse/profile/costmodel.py,sha256=O2KOrvJxXouc4W21q5BJGvgajLZJcwW8qUwWMoLR-d8,2896
|
|
81
|
+
synapse/profile/critical_path.py,sha256=D4M6F6ela9swMSC-0158LXrkSK1yXAPSNgIOKUVagrA,3728
|
|
82
|
+
synapse/profile/ledger.py,sha256=wV7w5iG-P35PoMLiEURVov0d0HB5PY0VlQzThStbKGU,5662
|
|
83
|
+
synapse/profile/presentation.py,sha256=icf5NhuKNxANigaaCAFgTPzS26rwshQks51RUgSbfq4,2465
|
|
84
|
+
synapse/profile/pricing.py,sha256=3mu6Dw9w3o8qSfrW5zCvx7Q67736Ha0HIiDLCrtn1vg,1012
|
|
85
|
+
synapse/profile/waste.py,sha256=HtJfVnipPG6o5dnZj5rLI42RvMEaGnwfy17dAFS2NSs,3009
|
|
86
|
+
synapse/runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
87
|
+
synapse/runtime/cache.py,sha256=mingMM7ss09-tFBv6_WVwzkkfd3ZdvCOWkTMa162XZk,6158
|
|
88
|
+
synapse/runtime/executor.py,sha256=S_1YwaRfIBP9kp_1r9DkoE3HDAgefalUsC59OH5Z7Lg,27685
|
|
89
|
+
synapse/runtime/meter.py,sha256=kUf2VoWHOraWL8JjblCM4_zzYVHrlvCCiUY8ZIxrtDk,2974
|
|
90
|
+
synapse/runtime/providers.py,sha256=fKvJc_0WZ1NwGFHqZQae9eYF7x0UdWVfLB5zGmyrNAk,16623
|
|
91
|
+
synapse/runtime/rate_gate.py,sha256=Ig1Wm2TMxhlhPmBKE7C0DgX61Wid6y9d9FRGzT9TEqY,2463
|
|
92
|
+
synapse/runtime/recording.py,sha256=8MrpDGtUqTXXiOt3_3wUek0rI_b1r5tn7NX48Xiaqlw,9580
|
|
93
|
+
synapse/runtime/scheduler.py,sha256=lhxrC5NsslGxeYLCDT9NLkNyOjwj2lzJ5y2zJ91ogKU,28955
|
|
94
|
+
synapse/runtime/semantic.py,sha256=ZKvO6QePXeeBwGVzNkRD1FYWzc5HbNAcSnXzXWlcTb4,3910
|
|
95
|
+
synapse/skills/__init__.py,sha256=pBREu9OlbkYbkAyWlXgONeFKoXqHtwID71HuHBF4MPA,1323
|
|
96
|
+
synapse/skills/synapse/SKILL.md,sha256=pEXcdYhQQ9BMt6ykoedIbwoTbP7P0u85VxiMoKv5sEM,2659
|
|
97
|
+
synapse/skills/synapse/references/effects.md,sha256=QueHSHoao5IGa5pZDY-aPNsGSF6I2pVqq9gZnzNtJVI,1139
|
|
98
|
+
halfabyte_synapse-0.2.0.dist-info/METADATA,sha256=41vwW_5DszTBkNixILP7VgpE4dTDnZEHJv8y58TjDDc,14115
|
|
99
|
+
halfabyte_synapse-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
100
|
+
halfabyte_synapse-0.2.0.dist-info/entry_points.txt,sha256=9X_dETmbBzuxS_BwJpH1k8Lo17r57J76kcs_NohBHyY,45
|
|
101
|
+
halfabyte_synapse-0.2.0.dist-info/top_level.txt,sha256=v_1YsqjmoSCzCKs7oIhzTNmWtSYoORiBMv1TJkOhx8A,8
|
|
102
|
+
halfabyte_synapse-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Half a Byte
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
synapse
|
synapse/__init__.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""SYNAPSE — a compiler and runtime for AI agent workflows.
|
|
2
|
+
|
|
3
|
+
Lift a workflow into SIR (an effect-typed IR with explicit data dependencies), profile
|
|
4
|
+
it with measured numbers, apply optimization passes chosen from that profile, and prove
|
|
5
|
+
the optimized version still behaves before shipping it.
|
|
6
|
+
|
|
7
|
+
from synapse import workflow, node, Effect
|
|
8
|
+
|
|
9
|
+
@node(kind="retrieval", effect=Effect.READ, staleness_s=3600)
|
|
10
|
+
def search(query: str) -> list[dict]: ...
|
|
11
|
+
|
|
12
|
+
@workflow
|
|
13
|
+
def research(question: str) -> str: ...
|
|
14
|
+
|
|
15
|
+
Calling `research("...")` builds a `Graph` and executes nothing. See docs/IR_SPEC.md.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
__version__ = "0.2.0"
|
|
21
|
+
|
|
22
|
+
from synapse.core.sir import (
|
|
23
|
+
SIR_VERSION,
|
|
24
|
+
Determinism,
|
|
25
|
+
Effect,
|
|
26
|
+
Graph,
|
|
27
|
+
Literal_,
|
|
28
|
+
Node,
|
|
29
|
+
NodeKind,
|
|
30
|
+
NodeProfile,
|
|
31
|
+
NoiseBand,
|
|
32
|
+
Profile,
|
|
33
|
+
Ref,
|
|
34
|
+
Region,
|
|
35
|
+
)
|
|
36
|
+
from synapse.frontend.dsl import agent, model, node, tool, workflow
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
"SIR_VERSION",
|
|
40
|
+
"Determinism",
|
|
41
|
+
"Effect",
|
|
42
|
+
"Graph",
|
|
43
|
+
"Literal_",
|
|
44
|
+
"Node",
|
|
45
|
+
"NodeKind",
|
|
46
|
+
"NodeProfile",
|
|
47
|
+
"NoiseBand",
|
|
48
|
+
"Profile",
|
|
49
|
+
"Ref",
|
|
50
|
+
"Region",
|
|
51
|
+
"__version__",
|
|
52
|
+
"agent",
|
|
53
|
+
"model",
|
|
54
|
+
"node",
|
|
55
|
+
"tool",
|
|
56
|
+
"workflow",
|
|
57
|
+
]
|
synapse/__main__.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""`py -3 -m synapse ...` -- the same CLI, without needing the script shim on PATH.
|
|
2
|
+
|
|
3
|
+
pip installs the `synapse` console script into a per-user Scripts directory that is
|
|
4
|
+
often not on PATH on Windows, and it says so in a warning nobody reads at 3 a.m. This
|
|
5
|
+
module means the demo never depends on that: `py -3 -m synapse demo` always works from
|
|
6
|
+
a checkout or an install.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
from synapse.cli import main
|
|
12
|
+
|
|
13
|
+
if __name__ == "__main__":
|
|
14
|
+
sys.exit(main())
|