effect-durable-agent 0.1.0-alpha.1
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.
- package/CHANGELOG.md +10 -0
- package/CONTRIBUTING.md +26 -0
- package/LICENSE +21 -0
- package/README.md +305 -0
- package/SECURITY.md +8 -0
- package/dist/command-queues-CQ9cwRP7.d.ts +468 -0
- package/dist/commands-Ce1ec6kH.d.ts +104 -0
- package/dist/compaction-YayFKo_1.d.ts +144 -0
- package/dist/core-Hv3cFydL.d.ts +81 -0
- package/dist/domain/command-queues.d.ts +2 -0
- package/dist/domain/command-queues.js +97 -0
- package/dist/domain/command-queues.js.map +1 -0
- package/dist/domain/message-transcript.d.ts +2 -0
- package/dist/domain/message-transcript.js +111 -0
- package/dist/domain/message-transcript.js.map +1 -0
- package/dist/domain/reduced-state-schema.d.ts +996 -0
- package/dist/domain/reduced-state-schema.js +286 -0
- package/dist/domain/reduced-state-schema.js.map +1 -0
- package/dist/domain/reduced-state.d.ts +2 -0
- package/dist/domain/reduced-state.js +2 -0
- package/dist/durable-C3Rz7kg3.js +625 -0
- package/dist/durable-C3Rz7kg3.js.map +1 -0
- package/dist/durable-DlScwmCy.d.ts +7424 -0
- package/dist/durable-object-runtime-B7jwBY2R.js +1494 -0
- package/dist/durable-object-runtime-B7jwBY2R.js.map +1 -0
- package/dist/durable-object-runtime-pWv0ohlz.d.ts +257 -0
- package/dist/durable-object-storage-Czy7IPrh.d.ts +41 -0
- package/dist/events-Bb9-Cu-7.d.ts +918 -0
- package/dist/host/durable-object-runtime.d.ts +2 -0
- package/dist/host/durable-object-runtime.js +2 -0
- package/dist/host/durable-object-storage.d.ts +2 -0
- package/dist/host/durable-object-storage.js +0 -0
- package/dist/host/durable-object.d.ts +83 -0
- package/dist/host/durable-object.js +191 -0
- package/dist/host/durable-object.js.map +1 -0
- package/dist/host/websocket-wire.d.ts +2 -0
- package/dist/host/websocket-wire.js +88 -0
- package/dist/host/websocket-wire.js.map +1 -0
- package/dist/id-generator-C2Q15uZM.d.ts +33 -0
- package/dist/index-BVVgDSdq.d.ts +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/keep-alive-DYDsH6qN.d.ts +111 -0
- package/dist/keep-alive-p8dIcSVy.js +109 -0
- package/dist/keep-alive-p8dIcSVy.js.map +1 -0
- package/dist/message-transcript-BCHdHAe2.d.ts +32 -0
- package/dist/prompt-projector-9_02lk5-.d.ts +40 -0
- package/dist/reduced-state-C4nVVzz9.js +910 -0
- package/dist/reduced-state-C4nVVzz9.js.map +1 -0
- package/dist/reducer-registry-C0svUa63.d.ts +69 -0
- package/dist/runtime-C56FQxiL.d.ts +60 -0
- package/dist/services/compaction.d.ts +2 -0
- package/dist/services/compaction.js +426 -0
- package/dist/services/compaction.js.map +1 -0
- package/dist/services/id-generator.d.ts +2 -0
- package/dist/services/id-generator.js +56 -0
- package/dist/services/id-generator.js.map +1 -0
- package/dist/services/prompt-projector.d.ts +2 -0
- package/dist/services/prompt-projector.js +27 -0
- package/dist/services/prompt-projector.js.map +1 -0
- package/dist/services/reducer-registry.d.ts +2 -0
- package/dist/services/reducer-registry.js +71 -0
- package/dist/services/reducer-registry.js.map +1 -0
- package/dist/services/runtime.d.ts +2 -0
- package/dist/services/runtime.js +84 -0
- package/dist/services/runtime.js.map +1 -0
- package/dist/services/session-query.d.ts +2 -0
- package/dist/services/session-query.js +2 -0
- package/dist/services/session-store.d.ts +2 -0
- package/dist/services/session-store.js +2 -0
- package/dist/services/sink-registry.d.ts +2 -0
- package/dist/services/sink-registry.js +2 -0
- package/dist/services/span-names.d.ts +28 -0
- package/dist/services/span-names.js +42 -0
- package/dist/services/span-names.js.map +1 -0
- package/dist/services/tool-registry.d.ts +2 -0
- package/dist/services/tool-registry.js +46 -0
- package/dist/services/tool-registry.js.map +1 -0
- package/dist/services/tracing.d.ts +76 -0
- package/dist/services/tracing.js +116 -0
- package/dist/services/tracing.js.map +1 -0
- package/dist/session-query-DOc1KanA.js +2930 -0
- package/dist/session-query-DOc1KanA.js.map +1 -0
- package/dist/session-query-DlRo5Ufc.d.ts +769 -0
- package/dist/session-store-D2Ore1QC.d.ts +295 -0
- package/dist/session-store-pYxQW9qh.js +214 -0
- package/dist/session-store-pYxQW9qh.js.map +1 -0
- package/dist/sink-registry-CFC6xjsN.js +312 -0
- package/dist/sink-registry-CFC6xjsN.js.map +1 -0
- package/dist/sink-registry-CIU0LD3m.d.ts +158 -0
- package/dist/testkit/layers.d.ts +101 -0
- package/dist/testkit/layers.js +108 -0
- package/dist/testkit/layers.js.map +1 -0
- package/dist/tool-registry-CcnkAAQK.d.ts +51 -0
- package/dist/tracing-BXHAkxkx.d.ts +111 -0
- package/dist/types/commands.d.ts +2 -0
- package/dist/types/commands.js +60 -0
- package/dist/types/commands.js.map +1 -0
- package/dist/types/core.d.ts +2 -0
- package/dist/types/core.js +68 -0
- package/dist/types/core.js.map +1 -0
- package/dist/types/events/durable.d.ts +2 -0
- package/dist/types/events/durable.js +2 -0
- package/dist/types/events.d.ts +4 -0
- package/dist/types/events.js +90 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/tracing.d.ts +2 -0
- package/dist/types/tracing.js +99 -0
- package/dist/types/tracing.js.map +1 -0
- package/dist/websocket-wire-DvOu_6BJ.d.ts +16773 -0
- package/docs/assets/architecture.svg +106 -0
- package/docs/assets/event-sequence.svg +143 -0
- package/docs/assets/gcp-trace.png +0 -0
- package/docs/message-steering.md +831 -0
- package/docs/releasing.md +57 -0
- package/docs/spec.md +774 -0
- package/docs/subagents.md +725 -0
- package/docs/testing.md +64 -0
- package/docs/ui-projection.md +742 -0
- package/docs/websocket-protocol.md +613 -0
- package/examples/001-no-tools/README.md +65 -0
- package/examples/001-no-tools/worker.ts +79 -0
- package/examples/002-slack-bridge/README.md +134 -0
- package/examples/002-slack-bridge/events.ts +115 -0
- package/examples/002-slack-bridge/reducer.ts +216 -0
- package/examples/002-slack-bridge/scenario.test.ts +223 -0
- package/examples/002-slack-bridge/sinks.ts +109 -0
- package/examples/002-slack-bridge/worker.ts +140 -0
- package/examples/003-sandbox-lifecycle/README.md +78 -0
- package/examples/003-sandbox-lifecycle/events.ts +203 -0
- package/examples/003-sandbox-lifecycle/reducer.ts +305 -0
- package/examples/003-sandbox-lifecycle/scenario.test.ts +202 -0
- package/examples/_shared/event-id.ts +12 -0
- package/examples/_shared/http.ts +27 -0
- package/examples/_shared/openai.ts +33 -0
- package/package.json +181 -0
- package/testing/offline-trace/README.md +63 -0
- package/tooling/oxlint/index.mjs +15 -0
- package/tooling/oxlint/rules/effect-span-from-catalog.mjs +152 -0
- package/tooling/oxlint/rules/span-catalog-format.mjs +74 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Effect Durable Agent will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## 0.1.0-alpha.1
|
|
6
|
+
|
|
7
|
+
- Prepare the first public prerelease as `effect-durable-agent`
|
|
8
|
+
- Ship compiled ESM and TypeScript declarations for every supported subpath
|
|
9
|
+
- Add isolated package-consumer validation for Cloudflare Workers
|
|
10
|
+
- Add MIT licensing and trusted-publishing release automation
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Issues and pull requests for Effect Durable Agent live in
|
|
4
|
+
[`advait/effect-durable-agent`](https://github.com/advait/effect-durable-agent).
|
|
5
|
+
|
|
6
|
+
## Development
|
|
7
|
+
|
|
8
|
+
Install dependencies and run the full validation suite:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm install --frozen-lockfile
|
|
12
|
+
pnpm run ci
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Validate the distributable package, including an install into an isolated Cloudflare Worker:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm run build
|
|
19
|
+
pnpm run package:check
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use `pnpm run lint:fix` for automated formatting and lint fixes. Add tests for behavior changes, keep
|
|
23
|
+
the public event and state model explicit, and preserve compatibility across all exported
|
|
24
|
+
subpaths.
|
|
25
|
+
|
|
26
|
+
See [the release guide](./docs/releasing.md) for maintainer-only publishing steps.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Advait Shinde
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# effect-durable-agent
|
|
2
|
+
|
|
3
|
+
> EDA is a Redux-inspired durable state-management layer for agentic applications, hosted on
|
|
4
|
+
[Cloudflare Durable Objects](https://developers.cloudflare.com/durable-objects/).
|
|
5
|
+
|
|
6
|
+
## Why?
|
|
7
|
+
|
|
8
|
+
Once an agent runs tools, launches sandboxes, requests approval, or interacts with external systems,
|
|
9
|
+
you are no longer building a chat loop. You are building a real-time application with many
|
|
10
|
+
interdependent lifecycles.
|
|
11
|
+
|
|
12
|
+
Tool execution constantly changes what that application needs to represent: `Sandbox started`,
|
|
13
|
+
`File read`, `Approval requested`. EDA provides a clean framework for **expressing each change as an
|
|
14
|
+
event that transitions the application's state machine**. Product state and agent state coexist in
|
|
15
|
+
the same event sequence.
|
|
16
|
+
|
|
17
|
+
Your application describes how events like `SandboxStarted` and `ApprovalRequested` change its
|
|
18
|
+
state. EDA records them in one durable history, giving agent state and product state a shared source
|
|
19
|
+
of truth. It streams those same events to clients. Each client uses them to update its local state,
|
|
20
|
+
so every view converges on the durable session state—even across tabs and reconnects.
|
|
21
|
+
|
|
22
|
+
## One state machine for the whole application
|
|
23
|
+
|
|
24
|
+
For example, a coding-agent session might record:
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
Framework events and product events are not separate channels. They form the same history and
|
|
29
|
+
transition the same application state.
|
|
30
|
+
|
|
31
|
+
If you know Redux, the model is familiar:
|
|
32
|
+
|
|
33
|
+
- **Events** describe what happened.
|
|
34
|
+
- **Reducers** are pure functions that describe how each event changes state.
|
|
35
|
+
- **The durable event history** is the source of truth from which current state is derived.
|
|
36
|
+
|
|
37
|
+
EDA supplies the framework events and reducers for commands, runs, turns, messages, inference, and
|
|
38
|
+
tool calls. Applications add their own typed events and reducers for sandboxes, approvals, billing,
|
|
39
|
+
external conversations, delivery state, or anything else the product needs to represent.
|
|
40
|
+
|
|
41
|
+
## What this unlocks
|
|
42
|
+
|
|
43
|
+
### Live state on every client
|
|
44
|
+
|
|
45
|
+
EDA exposes serialized reducer snapshots and streams the ordered session history over a
|
|
46
|
+
reconnect-safe WebSocket protocol. In a server-side rendering (SSR) flow, the server renders state
|
|
47
|
+
through sequence `N`; the browser hydrates from that snapshot, follows events after `N`, and applies
|
|
48
|
+
its application projection as they arrive.
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
server snapshot through N
|
|
52
|
+
+
|
|
53
|
+
streamed events after N
|
|
54
|
+
=
|
|
55
|
+
current client state
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Every tab, embedded surface, or admin view follows the same durable session. Slow and disconnected
|
|
59
|
+
clients catch up from their last acknowledged sequence instead of guessing which updates they
|
|
60
|
+
missed.
|
|
61
|
+
|
|
62
|
+
### Durable side effects
|
|
63
|
+
|
|
64
|
+
EDA makes side effects durable.
|
|
65
|
+
|
|
66
|
+
If `AssistantMessageCommitted` should post a result to Slack and Slack is temporarily unavailable,
|
|
67
|
+
EDA retains the event and retries the delivery instead of losing it inside a failed callback.
|
|
68
|
+
Durable sinks run independently of the main agent loop, preserve event order, and converge
|
|
69
|
+
eventually. Each sink tracks its own persisted cursor, advances only after successful processing,
|
|
70
|
+
and retries failures with backoff.
|
|
71
|
+
|
|
72
|
+
Delivery is at-least-once, so external operations still need stable idempotency keys. The important
|
|
73
|
+
guarantee is that a transient process or network failure does not silently erase the work.
|
|
74
|
+
|
|
75
|
+
See the [Slack bridge example](./examples/002-slack-bridge) for idempotent ingress, a custom reducer,
|
|
76
|
+
and durable outbound delivery.
|
|
77
|
+
|
|
78
|
+
**Durable state. Durable side effects.**
|
|
79
|
+
|
|
80
|
+
### Agents survive deploys and failures
|
|
81
|
+
|
|
82
|
+
Deploys and failures restart the application—not the session.
|
|
83
|
+
|
|
84
|
+
EDA rebuilds framework and product state from durable history, repairs incomplete lifecycle
|
|
85
|
+
boundaries, and transparently continues eligible in-progress work in a replacement run. Completed
|
|
86
|
+
tool calls are not blindly repeated, queued commands remain durable, and reconnecting clients see
|
|
87
|
+
the recovery transitions before new live activity.
|
|
88
|
+
|
|
89
|
+
### Production sessions become UI fixtures
|
|
90
|
+
|
|
91
|
+
Because application state is a pure projection of durable events, a production event sequence can
|
|
92
|
+
become a test fixture.
|
|
93
|
+
|
|
94
|
+
Replay it one event at a time through the same reducers, stop at any sequence, and assert exactly
|
|
95
|
+
what the UI should show: the running tool card, the active sandbox, the pending approval, the
|
|
96
|
+
completed delivery, or the recovered run. A difficult production session becomes a reproducible UI
|
|
97
|
+
test instead of a story in a bug report.
|
|
98
|
+
|
|
99
|
+
The package includes pure reducer tests, generated state-machine properties, canned-model journeys,
|
|
100
|
+
crash-prefix simulations, and an [offline trace harness](./testing/offline-trace) that writes
|
|
101
|
+
durable and live event artifacts.
|
|
102
|
+
|
|
103
|
+
### Tracing for every agent run
|
|
104
|
+
|
|
105
|
+
See what happened, in what order, and where the time went.
|
|
106
|
+
|
|
107
|
+
EDA uses Effect spans across meaningful runtime boundaries, including command admission, runs,
|
|
108
|
+
turns, model inference, tools, event streaming, durable sinks, and recovery. Trace context survives
|
|
109
|
+
the durable boundaries that separate ingress, execution, and side effects, and Effect telemetry can
|
|
110
|
+
be exported through OpenTelemetry to Google Cloud Trace or another existing backend.
|
|
111
|
+
|
|
112
|
+

|
|
113
|
+
|
|
114
|
+
### Built for Cloudflare Durable Objects
|
|
115
|
+
|
|
116
|
+
EDA's first host maps one session to one
|
|
117
|
+
[Cloudflare Durable Object](https://developers.cloudflare.com/durable-objects/). The object is the
|
|
118
|
+
durable coordinator for that session's state, execution, SQLite event log, live WebSockets, alarms,
|
|
119
|
+
and sink cursors.
|
|
120
|
+
|
|
121
|
+
This is an unusually natural fit:
|
|
122
|
+
|
|
123
|
+
- Deterministic routing sends every request for a session to the same logical object
|
|
124
|
+
- Per-object SQLite stores the ordered history beside the runtime that owns it
|
|
125
|
+
- WebSockets terminate at the same boundary that owns the state
|
|
126
|
+
- Alarms wake evicted sessions for recovery, keep-alive, and sink draining
|
|
127
|
+
|
|
128
|
+
Durable Objects are the first host, not the whole architecture. EDA's runtime depends on small
|
|
129
|
+
storage, scheduling, identity, and live-delivery boundaries that another platform can implement
|
|
130
|
+
with equivalent semantics.
|
|
131
|
+
|
|
132
|
+
## Core concepts
|
|
133
|
+
|
|
134
|
+

|
|
135
|
+
|
|
136
|
+
Effect owns the execution around this state machine: structured concurrency, streams, interruption,
|
|
137
|
+
scoped resources, typed failures, retries, services, and tracing. The event history owns durable
|
|
138
|
+
truth.
|
|
139
|
+
|
|
140
|
+
### Durable and ephemeral events
|
|
141
|
+
|
|
142
|
+
EDA's ordered event stream carries two types of events:
|
|
143
|
+
|
|
144
|
+
- **Durable events** are persisted facts with a monotonically increasing per-session `seq`. They
|
|
145
|
+
drive reducers, recovery, reconnect, tests, and durable sinks
|
|
146
|
+
- **Ephemeral events** carry live-only details such as text deltas, reasoning deltas, and speculative
|
|
147
|
+
tool parameters. They are positioned against the current durable head but are not durable truth
|
|
148
|
+
|
|
149
|
+
A durable event is published live only after storage commits it.
|
|
150
|
+
|
|
151
|
+
### Pure reducers
|
|
152
|
+
|
|
153
|
+
Reducers turn durable events into current state. EDA's framework reducer derives commands, runs,
|
|
154
|
+
turns, messages, inference, and tool state. Applications register their own reducers for product
|
|
155
|
+
state such as sandboxes, approvals, billing, or external delivery.
|
|
156
|
+
|
|
157
|
+
Framework and application reducers fold the same ordered history. Their checkpoints accelerate
|
|
158
|
+
startup and snapshots; the event log remains the source of truth.
|
|
159
|
+
|
|
160
|
+
### Live event stream
|
|
161
|
+
|
|
162
|
+
Clients begin with a reducer snapshot through sequence `N`, replay durable events after `N`, and
|
|
163
|
+
then follow new durable and ephemeral events live. Sequence-based catch-up lets every connected
|
|
164
|
+
view converge without coupling a slow client to agent execution.
|
|
165
|
+
|
|
166
|
+
### Durable sinks
|
|
167
|
+
|
|
168
|
+
Durable sinks process committed events outside the main agent loop. Each sink preserves event
|
|
169
|
+
ordering, tracks an independent durable cursor, and advances only after successful processing.
|
|
170
|
+
Failures retry with backoff, so external systems converge eventually without blocking the agent.
|
|
171
|
+
|
|
172
|
+
### Session runtime
|
|
173
|
+
|
|
174
|
+
One session has at most one active run and turn. The runtime:
|
|
175
|
+
|
|
176
|
+
1. Durably admits a command
|
|
177
|
+
2. Starts and traces the run, turn, and inference
|
|
178
|
+
3. Commits message and tool lifecycle facts
|
|
179
|
+
4. Folds framework and application reducers
|
|
180
|
+
5. Publishes positioned events to live clients
|
|
181
|
+
6. Drains durable sinks
|
|
182
|
+
7. Recovers from the durable history after a restart
|
|
183
|
+
|
|
184
|
+
## Get started
|
|
185
|
+
|
|
186
|
+
Install EDA from npm:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
pnpm add effect-durable-agent@alpha
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The smallest host is a concrete Durable Object subclass:
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
import { EDASessionDurableObject } from "effect-durable-agent/host/durable-object"
|
|
196
|
+
|
|
197
|
+
export class MyAgentSession extends EDASessionDurableObject<MyEnv> {
|
|
198
|
+
constructor(ctx: DurableObjectState, env: MyEnv) {
|
|
199
|
+
super(ctx, env, makeAgentOptions(env))
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The options provide the model, tools, application reducers, durable sinks, and runtime policy. The
|
|
205
|
+
host then submits commands to the session and follows its snapshot or event stream.
|
|
206
|
+
|
|
207
|
+
Start with the executable examples:
|
|
208
|
+
|
|
209
|
+
| Example | What it demonstrates |
|
|
210
|
+
| --- | --- |
|
|
211
|
+
| [`001-no-tools`](./examples/001-no-tools) | Minimal Durable Object session and durable command admission. |
|
|
212
|
+
| [`002-slack-bridge`](./examples/002-slack-bridge) | Idempotent ingress, application events and reducers, and a retrying durable sink. |
|
|
213
|
+
| [`003-sandbox-lifecycle`](./examples/003-sandbox-lifecycle) | Tool and product events reduced into one UI model, including snapshot-to-stream handoff. |
|
|
214
|
+
|
|
215
|
+
## Why Effect?
|
|
216
|
+
|
|
217
|
+
Agent sessions combine long-running model streams, concurrent tools, interruption, cleanup, retries,
|
|
218
|
+
external services, and observability. EDA uses [Effect](https://effect.website/) so those concerns
|
|
219
|
+
share one structured execution model rather than a collection of detached promises and callbacks.
|
|
220
|
+
|
|
221
|
+
Effect is the implementation foundation, not the product pitch. The reason to use EDA is the
|
|
222
|
+
durable application model; Effect is what lets the runtime execute that model with scoped resources,
|
|
223
|
+
typed boundaries, structured concurrency, and first-class tracing.
|
|
224
|
+
|
|
225
|
+
## Why EDA instead of another agent SDK or framework?
|
|
226
|
+
|
|
227
|
+
Consider a coding agent that:
|
|
228
|
+
|
|
229
|
+
- Launches a sandbox and reads files
|
|
230
|
+
- Streams progress to two browser tabs
|
|
231
|
+
- Pauses for human approval
|
|
232
|
+
- Posts its result to Slack after approval
|
|
233
|
+
- Keeps working through a deployment
|
|
234
|
+
|
|
235
|
+
That product needs more than a model loop. It needs durable application state, live client
|
|
236
|
+
synchronization, restart recovery, and reliable external delivery. Agent frameworks make different
|
|
237
|
+
parts of that system their primary durable abstraction:
|
|
238
|
+
|
|
239
|
+
| Center of gravity | Projects | Durable model |
|
|
240
|
+
| --- | --- | --- |
|
|
241
|
+
| Agent execution | [OpenAI Agents SDK](https://openai.github.io/openai-agents-js/), [Pi](https://pi.dev/docs/latest/sdk) | Live agent runs plus separately persisted conversations, run snapshots, or session entries. |
|
|
242
|
+
| Durable agent harness | [Cloudflare Project Think](https://developers.cloudflare.com/agents/harnesses/think/), [Flue](https://flueframework.com/), [Vercel Eve](https://vercel.com/eve) | Durable runtime history plus framework-specific state, action, hook, and extension surfaces. |
|
|
243
|
+
| Workflow graph | [LangChain / LangGraph](https://docs.langchain.com/oss/javascript/langgraph/overview) | Reducer-managed graph state persisted as checkpoints between super-steps. |
|
|
244
|
+
| Application state | **Effect Durable Agent** | Application-authored product and agent events in one ordered history. |
|
|
245
|
+
|
|
246
|
+
All of these frameworks can build agents. The difference is what each architecture makes primary.
|
|
247
|
+
Among them, EDA is the one whose central abstraction is an application-authored history shared by
|
|
248
|
+
agent execution, product state, clients, tests, and side effects.
|
|
249
|
+
|
|
250
|
+
In the scenario above, `SandboxStarted`, `FileRead`, `ApprovalRequested`, and
|
|
251
|
+
`SlackReplyDelivered` live beside model and tool events. The same history drives server state,
|
|
252
|
+
client catch-up, restart recovery, production-derived UI fixtures, and durable sink delivery.
|
|
253
|
+
|
|
254
|
+
<details>
|
|
255
|
+
<summary>Primary sources used for this comparison</summary>
|
|
256
|
+
|
|
257
|
+
- Think: [state snapshots](https://developers.cloudflare.com/agents/runtime/lifecycle/state/),
|
|
258
|
+
[actions](https://developers.cloudflare.com/agents/harnesses/think/actions/), and
|
|
259
|
+
[durable fibers](https://developers.cloudflare.com/agents/runtime/execution/durable-execution/)
|
|
260
|
+
- OpenAI Agents SDK: [sessions](https://openai.github.io/openai-agents-js/guides/sessions/),
|
|
261
|
+
[serialized run state](https://openai.github.io/openai-agents-js/guides/human-in-the-loop/), and
|
|
262
|
+
[streaming](https://openai.github.io/openai-agents-js/guides/streaming/)
|
|
263
|
+
- Pi:
|
|
264
|
+
[RPC events](https://pi.dev/docs/latest/rpc#events) and
|
|
265
|
+
[session format](https://pi.dev/docs/latest/session-format)
|
|
266
|
+
- Flue: [events](https://flueframework.com/docs/api/events-reference/) and
|
|
267
|
+
[application data boundaries](https://flueframework.com/docs/guide/database/)
|
|
268
|
+
- Eve: [application state](https://eve.dev/docs/guides/state),
|
|
269
|
+
[client reducers](https://eve.dev/docs/guides/frontend/overview), and
|
|
270
|
+
[event hooks](https://eve.dev/docs/guides/hooks)
|
|
271
|
+
- LangGraph: [graph state](https://docs.langchain.com/oss/javascript/langgraph/graph-api) and
|
|
272
|
+
[persistence](https://docs.langchain.com/oss/javascript/langgraph/persistence)
|
|
273
|
+
|
|
274
|
+
</details>
|
|
275
|
+
|
|
276
|
+
## Capabilities
|
|
277
|
+
|
|
278
|
+
- Effect-native agent runtime with command, run, turn, inference, message, and tool lifecycles
|
|
279
|
+
- Cloudflare Durable Object host with one session per object and SQLite event storage
|
|
280
|
+
- Typed custom durable application events and pure application reducers
|
|
281
|
+
- Reducer checkpoints and serialized snapshots
|
|
282
|
+
- Reconnect-safe event streaming with sequence resume and WebSocket ACK flow control
|
|
283
|
+
- Durable sinks with persisted cursors, at-least-once delivery, and retry
|
|
284
|
+
- Deterministic startup recovery with transparent continuation of eligible work
|
|
285
|
+
- Pluggable model-context compaction policies and executors
|
|
286
|
+
- Interoperability with [Effect AI](https://www.effect.website/docs/v3/ai/introduction) models,
|
|
287
|
+
providers, prompts, and toolkits
|
|
288
|
+
- Tool calls run as scoped Effect programs for interruption-safe cancellation and resource cleanup
|
|
289
|
+
- Trace propagation and Effect span instrumentation across runtime boundaries
|
|
290
|
+
- Queue, steer, interrupt, stop, and idempotent command admission
|
|
291
|
+
|
|
292
|
+
## Documentation
|
|
293
|
+
|
|
294
|
+
- [Current implementation](./docs/spec.md)
|
|
295
|
+
- [Testing strategy](./docs/testing.md)
|
|
296
|
+
- [WebSocket live-event protocol](./docs/websocket-protocol.md)
|
|
297
|
+
- [Message steering](./docs/message-steering.md)
|
|
298
|
+
- [UI projection proposal](./docs/ui-projection.md)
|
|
299
|
+
- [Subagents proposal](./docs/subagents.md)
|
|
300
|
+
|
|
301
|
+
## Contributing and license
|
|
302
|
+
|
|
303
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) to run the project and validate the npm package. Effect
|
|
304
|
+
Durable Agent is available under the [MIT License](./LICENSE). Please report vulnerabilities
|
|
305
|
+
through the process in [SECURITY.md](./SECURITY.md).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
Please do not report security vulnerabilities in public issues.
|
|
4
|
+
|
|
5
|
+
After the standalone repository is public, use GitHub's private vulnerability reporting for
|
|
6
|
+
`advait/effect-durable-agent`. Include the affected version, impact, reproduction steps, and any
|
|
7
|
+
known mitigations. Maintainers will acknowledge the report and coordinate disclosure through that
|
|
8
|
+
private thread.
|