aethergraph 0.1.0a1__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.
Files changed (182) hide show
  1. aethergraph/__init__.py +49 -0
  2. aethergraph/config/__init__.py +0 -0
  3. aethergraph/config/config.py +121 -0
  4. aethergraph/config/context.py +16 -0
  5. aethergraph/config/llm.py +26 -0
  6. aethergraph/config/loader.py +60 -0
  7. aethergraph/config/runtime.py +9 -0
  8. aethergraph/contracts/errors/errors.py +44 -0
  9. aethergraph/contracts/services/artifacts.py +142 -0
  10. aethergraph/contracts/services/channel.py +72 -0
  11. aethergraph/contracts/services/continuations.py +23 -0
  12. aethergraph/contracts/services/eventbus.py +12 -0
  13. aethergraph/contracts/services/kv.py +24 -0
  14. aethergraph/contracts/services/llm.py +17 -0
  15. aethergraph/contracts/services/mcp.py +22 -0
  16. aethergraph/contracts/services/memory.py +108 -0
  17. aethergraph/contracts/services/resume.py +28 -0
  18. aethergraph/contracts/services/state_stores.py +33 -0
  19. aethergraph/contracts/services/wakeup.py +28 -0
  20. aethergraph/core/execution/base_scheduler.py +77 -0
  21. aethergraph/core/execution/forward_scheduler.py +777 -0
  22. aethergraph/core/execution/global_scheduler.py +634 -0
  23. aethergraph/core/execution/retry_policy.py +22 -0
  24. aethergraph/core/execution/step_forward.py +411 -0
  25. aethergraph/core/execution/step_result.py +18 -0
  26. aethergraph/core/execution/wait_types.py +72 -0
  27. aethergraph/core/graph/graph_builder.py +192 -0
  28. aethergraph/core/graph/graph_fn.py +219 -0
  29. aethergraph/core/graph/graph_io.py +67 -0
  30. aethergraph/core/graph/graph_refs.py +154 -0
  31. aethergraph/core/graph/graph_spec.py +115 -0
  32. aethergraph/core/graph/graph_state.py +59 -0
  33. aethergraph/core/graph/graphify.py +128 -0
  34. aethergraph/core/graph/interpreter.py +145 -0
  35. aethergraph/core/graph/node_handle.py +33 -0
  36. aethergraph/core/graph/node_spec.py +46 -0
  37. aethergraph/core/graph/node_state.py +63 -0
  38. aethergraph/core/graph/task_graph.py +747 -0
  39. aethergraph/core/graph/task_node.py +82 -0
  40. aethergraph/core/graph/utils.py +37 -0
  41. aethergraph/core/graph/visualize.py +239 -0
  42. aethergraph/core/runtime/ad_hoc_context.py +61 -0
  43. aethergraph/core/runtime/base_service.py +153 -0
  44. aethergraph/core/runtime/bind_adapter.py +42 -0
  45. aethergraph/core/runtime/bound_memory.py +69 -0
  46. aethergraph/core/runtime/execution_context.py +220 -0
  47. aethergraph/core/runtime/graph_runner.py +349 -0
  48. aethergraph/core/runtime/lifecycle.py +26 -0
  49. aethergraph/core/runtime/node_context.py +203 -0
  50. aethergraph/core/runtime/node_services.py +30 -0
  51. aethergraph/core/runtime/recovery.py +159 -0
  52. aethergraph/core/runtime/run_registration.py +33 -0
  53. aethergraph/core/runtime/runtime_env.py +157 -0
  54. aethergraph/core/runtime/runtime_registry.py +32 -0
  55. aethergraph/core/runtime/runtime_services.py +224 -0
  56. aethergraph/core/runtime/wakeup_watcher.py +40 -0
  57. aethergraph/core/tools/__init__.py +10 -0
  58. aethergraph/core/tools/builtins/channel_tools.py +194 -0
  59. aethergraph/core/tools/builtins/toolset.py +134 -0
  60. aethergraph/core/tools/toolkit.py +510 -0
  61. aethergraph/core/tools/waitable.py +109 -0
  62. aethergraph/plugins/channel/__init__.py +0 -0
  63. aethergraph/plugins/channel/adapters/__init__.py +0 -0
  64. aethergraph/plugins/channel/adapters/console.py +106 -0
  65. aethergraph/plugins/channel/adapters/file.py +102 -0
  66. aethergraph/plugins/channel/adapters/slack.py +285 -0
  67. aethergraph/plugins/channel/adapters/telegram.py +302 -0
  68. aethergraph/plugins/channel/adapters/webhook.py +104 -0
  69. aethergraph/plugins/channel/adapters/webui.py +134 -0
  70. aethergraph/plugins/channel/routes/__init__.py +0 -0
  71. aethergraph/plugins/channel/routes/console_routes.py +86 -0
  72. aethergraph/plugins/channel/routes/slack_routes.py +49 -0
  73. aethergraph/plugins/channel/routes/telegram_routes.py +26 -0
  74. aethergraph/plugins/channel/routes/webui_routes.py +136 -0
  75. aethergraph/plugins/channel/utils/__init__.py +0 -0
  76. aethergraph/plugins/channel/utils/slack_utils.py +278 -0
  77. aethergraph/plugins/channel/utils/telegram_utils.py +324 -0
  78. aethergraph/plugins/channel/websockets/slack_ws.py +68 -0
  79. aethergraph/plugins/channel/websockets/telegram_polling.py +151 -0
  80. aethergraph/plugins/mcp/fs_server.py +128 -0
  81. aethergraph/plugins/mcp/http_server.py +101 -0
  82. aethergraph/plugins/mcp/ws_server.py +180 -0
  83. aethergraph/plugins/net/http.py +10 -0
  84. aethergraph/plugins/utils/data_io.py +359 -0
  85. aethergraph/runner/__init__.py +5 -0
  86. aethergraph/runtime/__init__.py +62 -0
  87. aethergraph/server/__init__.py +3 -0
  88. aethergraph/server/app_factory.py +84 -0
  89. aethergraph/server/start.py +122 -0
  90. aethergraph/services/__init__.py +10 -0
  91. aethergraph/services/artifacts/facade.py +284 -0
  92. aethergraph/services/artifacts/factory.py +35 -0
  93. aethergraph/services/artifacts/fs_store.py +656 -0
  94. aethergraph/services/artifacts/jsonl_index.py +123 -0
  95. aethergraph/services/artifacts/paths.py +23 -0
  96. aethergraph/services/artifacts/sqlite_index.py +209 -0
  97. aethergraph/services/artifacts/utils.py +124 -0
  98. aethergraph/services/auth/dev.py +16 -0
  99. aethergraph/services/channel/channel_bus.py +293 -0
  100. aethergraph/services/channel/factory.py +44 -0
  101. aethergraph/services/channel/session.py +511 -0
  102. aethergraph/services/channel/wait_helpers.py +57 -0
  103. aethergraph/services/clock/clock.py +9 -0
  104. aethergraph/services/container/default_container.py +320 -0
  105. aethergraph/services/continuations/continuation.py +56 -0
  106. aethergraph/services/continuations/factory.py +34 -0
  107. aethergraph/services/continuations/stores/fs_store.py +264 -0
  108. aethergraph/services/continuations/stores/inmem_store.py +95 -0
  109. aethergraph/services/eventbus/inmem.py +21 -0
  110. aethergraph/services/features/static.py +10 -0
  111. aethergraph/services/kv/ephemeral.py +90 -0
  112. aethergraph/services/kv/factory.py +27 -0
  113. aethergraph/services/kv/layered.py +41 -0
  114. aethergraph/services/kv/sqlite_kv.py +128 -0
  115. aethergraph/services/llm/factory.py +157 -0
  116. aethergraph/services/llm/generic_client.py +542 -0
  117. aethergraph/services/llm/providers.py +3 -0
  118. aethergraph/services/llm/service.py +105 -0
  119. aethergraph/services/logger/base.py +36 -0
  120. aethergraph/services/logger/compat.py +50 -0
  121. aethergraph/services/logger/formatters.py +106 -0
  122. aethergraph/services/logger/std.py +203 -0
  123. aethergraph/services/mcp/helpers.py +23 -0
  124. aethergraph/services/mcp/http_client.py +70 -0
  125. aethergraph/services/mcp/mcp_tools.py +21 -0
  126. aethergraph/services/mcp/registry.py +14 -0
  127. aethergraph/services/mcp/service.py +100 -0
  128. aethergraph/services/mcp/stdio_client.py +70 -0
  129. aethergraph/services/mcp/ws_client.py +115 -0
  130. aethergraph/services/memory/bound.py +106 -0
  131. aethergraph/services/memory/distillers/episode.py +116 -0
  132. aethergraph/services/memory/distillers/rolling.py +74 -0
  133. aethergraph/services/memory/facade.py +633 -0
  134. aethergraph/services/memory/factory.py +78 -0
  135. aethergraph/services/memory/hotlog_kv.py +27 -0
  136. aethergraph/services/memory/indices.py +74 -0
  137. aethergraph/services/memory/io_helpers.py +72 -0
  138. aethergraph/services/memory/persist_fs.py +40 -0
  139. aethergraph/services/memory/resolver.py +152 -0
  140. aethergraph/services/metering/noop.py +4 -0
  141. aethergraph/services/prompts/file_store.py +41 -0
  142. aethergraph/services/rag/chunker.py +29 -0
  143. aethergraph/services/rag/facade.py +593 -0
  144. aethergraph/services/rag/index/base.py +27 -0
  145. aethergraph/services/rag/index/faiss_index.py +121 -0
  146. aethergraph/services/rag/index/sqlite_index.py +134 -0
  147. aethergraph/services/rag/index_factory.py +52 -0
  148. aethergraph/services/rag/parsers/md.py +7 -0
  149. aethergraph/services/rag/parsers/pdf.py +14 -0
  150. aethergraph/services/rag/parsers/txt.py +7 -0
  151. aethergraph/services/rag/utils/hybrid.py +39 -0
  152. aethergraph/services/rag/utils/make_fs_key.py +62 -0
  153. aethergraph/services/redactor/simple.py +16 -0
  154. aethergraph/services/registry/key_parsing.py +44 -0
  155. aethergraph/services/registry/registry_key.py +19 -0
  156. aethergraph/services/registry/unified_registry.py +185 -0
  157. aethergraph/services/resume/multi_scheduler_resume_bus.py +65 -0
  158. aethergraph/services/resume/router.py +73 -0
  159. aethergraph/services/schedulers/registry.py +41 -0
  160. aethergraph/services/secrets/base.py +7 -0
  161. aethergraph/services/secrets/env.py +8 -0
  162. aethergraph/services/state_stores/externalize.py +135 -0
  163. aethergraph/services/state_stores/graph_observer.py +131 -0
  164. aethergraph/services/state_stores/json_store.py +67 -0
  165. aethergraph/services/state_stores/resume_policy.py +119 -0
  166. aethergraph/services/state_stores/serialize.py +249 -0
  167. aethergraph/services/state_stores/utils.py +91 -0
  168. aethergraph/services/state_stores/validate.py +78 -0
  169. aethergraph/services/tracing/noop.py +18 -0
  170. aethergraph/services/waits/wait_registry.py +91 -0
  171. aethergraph/services/wakeup/memory_queue.py +57 -0
  172. aethergraph/services/wakeup/scanner_producer.py +56 -0
  173. aethergraph/services/wakeup/worker.py +31 -0
  174. aethergraph/tools/__init__.py +25 -0
  175. aethergraph/utils/optdeps.py +8 -0
  176. aethergraph-0.1.0a1.dist-info/METADATA +410 -0
  177. aethergraph-0.1.0a1.dist-info/RECORD +182 -0
  178. aethergraph-0.1.0a1.dist-info/WHEEL +5 -0
  179. aethergraph-0.1.0a1.dist-info/entry_points.txt +2 -0
  180. aethergraph-0.1.0a1.dist-info/licenses/LICENSE +176 -0
  181. aethergraph-0.1.0a1.dist-info/licenses/NOTICE +31 -0
  182. aethergraph-0.1.0a1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,91 @@
1
+ import asyncio
2
+ import threading
3
+ from typing import Any
4
+
5
+
6
+ class WaitRegistry:
7
+ """
8
+ In-process registry for cooperative waits.
9
+ - register(token): binds a Future to the *current* running loop
10
+ - resolve(token, payload): from any thread/loop, completes that Future
11
+ - cancel(token): cancels a pending wait
12
+
13
+ Use this only for cooperative (same-process) resumes.
14
+ All other resumes should go via ResumeBus/Scheduler.
15
+ """
16
+
17
+ def __init__(self) -> None:
18
+ # token -> (owning_loop, future)
19
+ self._futs: dict[str, tuple[asyncio.AbstractEventLoop, asyncio.Future]] = {}
20
+ self._lock = threading.RLock()
21
+ # If a resume arrives before register()
22
+ self._pending_payloads: dict[str, Any] = {}
23
+
24
+ def register(self, token: str) -> asyncio.Future:
25
+ """Create or reuse a Future on the current loop; deliver any early payload."""
26
+ loop = asyncio.get_running_loop()
27
+ with self._lock:
28
+ entry = self._futs.get(token)
29
+ if entry:
30
+ el, fut = entry
31
+ if fut.done() or getattr(el, "is_closed", lambda: False)():
32
+ fut = loop.create_future()
33
+ self._futs[token] = (loop, fut)
34
+ else:
35
+ fut = loop.create_future()
36
+ self._futs[token] = (loop, fut)
37
+ # deliver early resume if present
38
+ if token in self._pending_payloads:
39
+ payload = self._pending_payloads.pop(token)
40
+ loop.call_soon(fut.set_result, payload)
41
+ return fut
42
+
43
+ def resolve(self, token: str, payload: dict | None = None) -> bool:
44
+ """Resolve from any thread; returns True if delivered to a registered Future."""
45
+ payload = payload or {}
46
+ with self._lock:
47
+ entry = self._futs.pop(token, None)
48
+ if not entry:
49
+ # resume before register: stash
50
+ self._pending_payloads[token] = payload
51
+ return False
52
+ loop, fut = entry
53
+
54
+ if not fut.done():
55
+ loop.call_soon_threadsafe(fut.set_result, payload)
56
+ return True
57
+
58
+ def cancel(self, token: str, exc: BaseException | None = None) -> bool:
59
+ """Cancel from any thread; returns True if a Future was present."""
60
+ with self._lock:
61
+ entry = self._futs.pop(token, None)
62
+ self._pending_payloads.pop(token, None)
63
+ if not entry:
64
+ return False
65
+ loop, fut = entry
66
+ if not fut.done():
67
+ loop.call_soon_threadsafe(
68
+ fut.set_exception, exc or asyncio.CancelledError(f"Wait cancelled: {token}")
69
+ )
70
+ return True
71
+
72
+ # --- optional helpers ---
73
+ def has(self, token: str) -> bool:
74
+ with self._lock:
75
+ return token in self._futs or token in self._pending_payloads
76
+
77
+ def size(self) -> int:
78
+ with self._lock:
79
+ return len(self._futs)
80
+
81
+ def shutdown(self) -> None:
82
+ """Best-effort cleanup; cancels outstanding futures."""
83
+ with self._lock:
84
+ items = list(self._futs.items())
85
+ self._futs.clear()
86
+ self._pending_payloads.clear()
87
+ for _, (loop, fut) in items:
88
+ if not fut.done():
89
+ loop.call_soon_threadsafe(
90
+ fut.set_exception, asyncio.CancelledError("Registry shutdown")
91
+ )
@@ -0,0 +1,57 @@
1
+ from dataclasses import dataclass
2
+ import heapq
3
+ import threading
4
+ import time
5
+ import uuid
6
+
7
+
8
+ @dataclass
9
+ class _Lease:
10
+ id: str
11
+ msg: dict
12
+ visibility_deadline: float
13
+
14
+
15
+ class ThreadSafeWakeupQueue:
16
+ def __init__(self):
17
+ self._ready: list[tuple[float, int, dict]] = []
18
+ self._inflight: dict[str, _Lease] = {} # lease.id -> lease
19
+ self._ctr = 0
20
+ self._lock = threading.RLock()
21
+
22
+ async def enqueue(self, topic: str, msg: dict, delay_s: float = 0) -> str:
23
+ with self._lock:
24
+ self._ctr += 1
25
+ heapq.heappush(self._ready, (time.time() + delay_s, self._ctr, msg))
26
+ return msg.get("job_id") or str(self._ctr)
27
+
28
+ async def lease(self, topic: str, max_items: int = 1, lease_s: int = 60) -> list[_Lease]:
29
+ out = []
30
+ now = time.time()
31
+ with self._lock:
32
+ while self._ready and len(out) < max_items:
33
+ visible_at, _, msg = self._ready[0]
34
+ if visible_at > now:
35
+ break
36
+ heapq.heappop(self._ready)
37
+ lid = uuid.uuid4().hex
38
+ lease = _Lease(lid, msg, now + lease_s)
39
+ self._inflight[lid] = lease
40
+ out.append(lease)
41
+ return out
42
+
43
+ async def extend(self, lease: _Lease, lease_s: int) -> None:
44
+ with self._lock:
45
+ if lease.id in self._inflight:
46
+ self._inflight[lease.id].visibility_deadline = time.time() + lease_s
47
+
48
+ async def ack(self, lease: _Lease) -> None:
49
+ with self._lock:
50
+ self._inflight.pop(lease.id, None)
51
+
52
+ async def nack(self, lease: _Lease, requeue_delay_s: float = 5) -> None:
53
+ with self._lock:
54
+ lease = self._inflight.pop(lease.id, None)
55
+ if lease:
56
+ self._ctr += 1
57
+ heapq.heappush(self._ready, (time.time() + requeue_delay_s, self._ctr, lease.msg))
@@ -0,0 +1,56 @@
1
+ import asyncio
2
+ from datetime import datetime, timezone
3
+
4
+ from aethergraph.contracts.services.wakeup import WakeupQueue
5
+
6
+
7
+ # services/wakeup/scanner_producer.py
8
+ class ScannerProducer:
9
+ def __init__(self, store, queue: WakeupQueue, logger, tick_sec=1.0, topic="default"):
10
+ self.store = store
11
+ self.queue = queue
12
+ self.logger = logger
13
+ self.tick_sec = tick_sec
14
+ self.topic = topic
15
+ self._task = None
16
+ self._stopped = asyncio.Event()
17
+
18
+ def start(self):
19
+ if not self._task:
20
+ self._task = asyncio.create_task(self._loop())
21
+
22
+ async def stop(self):
23
+ self._stopped.set()
24
+ if self._task:
25
+ await self._task
26
+
27
+ async def _loop(self):
28
+ while not self._stopped.is_set():
29
+ await asyncio.sleep(self.tick_sec)
30
+ now = datetime.now(timezone.utc)
31
+ for c in self._iter_continuations():
32
+ if c.poll:
33
+ # poll; if hit -> enqueue
34
+ payload = await self._try_poll(c)
35
+ if payload is not None:
36
+ await self.queue.enqueue(
37
+ self.topic,
38
+ {
39
+ "kind": "resume",
40
+ "run_id": c.run_id,
41
+ "node_id": c.node_id,
42
+ "token": c.token,
43
+ "payload": payload,
44
+ },
45
+ )
46
+ elif c.next_wakeup_at and now >= c.next_wakeup_at:
47
+ await self.queue.enqueue(
48
+ self.topic,
49
+ {
50
+ "kind": "resume",
51
+ "run_id": c.run_id,
52
+ "node_id": c.node_id,
53
+ "token": c.token,
54
+ "payload": {"deadline_fired": True},
55
+ },
56
+ )
@@ -0,0 +1,31 @@
1
+ import asyncio
2
+
3
+ from aethergraph.contracts.services.wakeup import WakeupQueue
4
+
5
+
6
+ class WakeWorker:
7
+ def __init__(self, queue: WakeupQueue, resume_bus, logger, topic="default"):
8
+ self.queue = queue
9
+ self.resume_bus = resume_bus
10
+ self.logger = logger
11
+ self.topic = topic
12
+
13
+ async def run_forever(self):
14
+ while True:
15
+ leases = await self.queue.lease(self.topic, max_items=1, lease_s=60)
16
+ if not leases:
17
+ await asyncio.sleep(0.2)
18
+ continue
19
+ lease = leases[0]
20
+ try:
21
+ msg = lease.msg
22
+ await self.resume_bus.enqueue_resume(
23
+ run_id=msg["run_id"],
24
+ node_id=msg["node_id"],
25
+ token=msg["token"],
26
+ payload=msg["payload"],
27
+ )
28
+ await self.queue.ack(lease)
29
+ except Exception as e:
30
+ self.logger.error("resume_failed", err=str(e), node=msg.get("node_id"))
31
+ await self.queue.nack(lease, requeue_delay_s=2)
@@ -0,0 +1,25 @@
1
+ # redirect tools imports for clean imports
2
+
3
+ from aethergraph.core.tools.builtins.toolset import (
4
+ ask_approval,
5
+ ask_files,
6
+ ask_text,
7
+ get_latest_uploads,
8
+ send_buttons,
9
+ send_file,
10
+ send_image,
11
+ send_text,
12
+ wait_text,
13
+ )
14
+
15
+ __all__ = [
16
+ "ask_approval",
17
+ "ask_files",
18
+ "ask_text",
19
+ "get_latest_uploads",
20
+ "send_buttons",
21
+ "send_file",
22
+ "send_image",
23
+ "send_text",
24
+ "wait_text",
25
+ ]
@@ -0,0 +1,8 @@
1
+ # src/aethergraph/utils/optdeps.py
2
+ def require(pkg: str, extra: str):
3
+ try:
4
+ __import__(pkg)
5
+ except ImportError as e:
6
+ raise RuntimeError(
7
+ f"{pkg} is required for this feature. Install with: pip install 'aethergraph[{extra}]'"
8
+ ) from e
@@ -0,0 +1,410 @@
1
+ Metadata-Version: 2.4
2
+ Name: aethergraph
3
+ Version: 0.1.0a1
4
+ Summary: Python-first agentic DAG execution framework
5
+ Author-email: Zhaocheng Liu <zhaocheng@aiperture.io>
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+ Project-URL: Homepage, https://github.com/AIperture/aethergraph
183
+ Project-URL: Repository, https://github.com/AIperture/aethergraph
184
+ Project-URL: Documentation, https://aiperture.github.io/aethergraph-docs/
185
+ Project-URL: Issues, https://github.com/AIperture/aethergraph/issues
186
+ Keywords: agents,workflow,DAG,LLM,orchestration,research,aethergraph
187
+ Classifier: Development Status :: 3 - Alpha
188
+ Classifier: Intended Audience :: Science/Research
189
+ Classifier: Intended Audience :: Developers
190
+ Classifier: License :: OSI Approved :: Apache Software License
191
+ Classifier: Programming Language :: Python :: 3
192
+ Classifier: Programming Language :: Python :: 3 :: Only
193
+ Classifier: Programming Language :: Python :: 3.10
194
+ Classifier: Programming Language :: Python :: 3.11
195
+ Classifier: Programming Language :: Python :: 3.12
196
+ Classifier: Topic :: Scientific/Engineering
197
+ Classifier: Topic :: Software Development :: Libraries
198
+ Requires-Python: >=3.10
199
+ Description-Content-Type: text/markdown
200
+ License-File: LICENSE
201
+ License-File: NOTICE
202
+ Requires-Dist: fastapi>=0.110
203
+ Requires-Dist: uvicorn[standard]>=0.31
204
+ Requires-Dist: pydantic>=2.6
205
+ Requires-Dist: pydantic-settings>=2.2
206
+ Requires-Dist: numpy>=1.24
207
+ Requires-Dist: networkx>=3.1
208
+ Requires-Dist: python-multipart>=0.0.9
209
+ Requires-Dist: jsonschema>=4.18
210
+ Requires-Dist: httpx>=0.27
211
+ Requires-Dist: aiohttp>=3.9
212
+ Provides-Extra: slack
213
+ Requires-Dist: slack_sdk>=3.27.0; extra == "slack"
214
+ Requires-Dist: aiohttp>=3.9; extra == "slack"
215
+ Provides-Extra: telegram
216
+ Requires-Dist: aiohttp>=3.9; extra == "telegram"
217
+ Provides-Extra: webhook
218
+ Requires-Dist: aiohttp>=3.9; extra == "webhook"
219
+ Provides-Extra: discord
220
+ Requires-Dist: aiohttp>=3.9; extra == "discord"
221
+ Provides-Extra: channels
222
+ Requires-Dist: aethergraph[slack]; extra == "channels"
223
+ Requires-Dist: aethergraph[telegram]; extra == "channels"
224
+ Requires-Dist: aethergraph[webhook]; extra == "channels"
225
+ Provides-Extra: faiss
226
+ Requires-Dist: faiss-cpu>=1.7.4; extra == "faiss"
227
+ Provides-Extra: dev
228
+ Requires-Dist: ruff>=0.5; extra == "dev"
229
+ Requires-Dist: black>=24.1.0; extra == "dev"
230
+ Requires-Dist: mypy>=1.8.0; extra == "dev"
231
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
232
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
233
+ Requires-Dist: types-requests>=2.31.0.10; extra == "dev"
234
+ Provides-Extra: docs
235
+ Requires-Dist: mkdocs>=1.5; extra == "docs"
236
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
237
+ Requires-Dist: mkdocstrings[python]>=0.24; extra == "docs"
238
+ Provides-Extra: test
239
+ Requires-Dist: pytest>=8.0.0; extra == "test"
240
+ Requires-Dist: pytest-asyncio>=0.23; extra == "test"
241
+ Requires-Dist: coverage>=7.4; extra == "test"
242
+ Dynamic: license-file
243
+
244
+ <p align="center">
245
+ <img src="assets/logo.png" alt="AetherGraph" width="360"/>
246
+ </p>
247
+
248
+ # AetherGraph
249
+
250
+ **AetherGraph** is a **Python‑first agentic DAG execution framework** for building and orchestrating AI‑powered workflows. It pairs a clean, function‑oriented developer experience with a resilient runtime—event‑driven waits, resumable runs, and pluggable services (LLM, memory, artifacts, RAG)—so you can start simple and scale to complex R&D pipelines.
251
+
252
+ Use AetherGraph to prototype interactive assistants, simulation/optimization loops, data transforms, or multi‑step automations without boilerplate. It works **with or without LLMs**—bring your own tools and services, and compose them into repeatable, observable graphs.
253
+
254
+ ---
255
+
256
+ ## Requirements
257
+
258
+ * Python **3.10+**
259
+ * macOS, Linux, or Windows
260
+ * *(Optional)* LLM API keys (OpenAI, Anthropic, Google, etc.)
261
+ * *(Optional extras)* `slack` adapter
262
+
263
+ ---
264
+
265
+ ## Install
266
+
267
+ ### Option A — PyPI (recommended)
268
+
269
+ ```bash
270
+ pip install aethergraph
271
+ ```
272
+
273
+ Optional extras:
274
+
275
+ ```bash
276
+ # Slack adapter
277
+ pip install "aethergraph[slack]"
278
+
279
+ # Dev tooling (linting, tests, types)
280
+ pip install "aethergraph[dev]"
281
+ ```
282
+
283
+
284
+ ### Option B — From source (editable dev mode)
285
+
286
+ ```bash
287
+ git clone https://github.com/AIperture/aethergraph.git
288
+ cd aethergraph
289
+
290
+ # Base
291
+ pip install -e .
292
+
293
+ # With extras
294
+ echo "(optional)" && pip install -e ".[slack,dev]"
295
+ ```
296
+
297
+ ---
298
+
299
+ ## Configure (optional)
300
+
301
+ Most examples run without an LLM, but for LLM‑backed flows set keys via environment variables or a local secrets file.
302
+
303
+ Minimal example (OpenAI):
304
+
305
+ ```ini
306
+ # .env (example)
307
+ AETHERGRAPH_LLM__ENABLED=true
308
+ AETHERGRAPH_LLM__DEFAULT__PROVIDER=openai
309
+ AETHERGRAPH_LLM__DEFAULT__MODEL=gpt-4o-mini
310
+ AETHERGRAPH_LLM__DEFAULT__API_KEY=sk-...your-key...
311
+ ```
312
+
313
+ Or inline in a script at runtime (for on‑demand key setting):
314
+
315
+ ```python
316
+ from aethergraph.runtime import register_llm_client
317
+
318
+ open_ai_client = register_llm_client(
319
+ profile="my_llm",
320
+ provider="openai",
321
+ model="gpt-4o-mini",
322
+ api_key="sk-...your-key...",
323
+ )
324
+ ```
325
+
326
+ See our docs for setup of **external channel** methods for real-time interaction.
327
+
328
+
329
+ > **Where should `.env` live?** In your **project root** (the directory where you run your Python entry point). You can override with `AETHERGRAPH_ENV_FILE=/path/to/.env` if needed.
330
+
331
+ ---
332
+
333
+ ## Quickstart (60 seconds)
334
+
335
+ 1. Verify install:
336
+
337
+ ```bash
338
+ python -c "import aethergraph; print('AetherGraph OK, version:', getattr(aethergraph, '__version__', 'dev'))"
339
+ ```
340
+
341
+ 2. Run a minimal graph:
342
+
343
+ ```bash
344
+ python - <<'PY'
345
+ from aethergraph import graph_fn, NodeContext
346
+ from aethergraph.runner import run
347
+
348
+ @graph_fn(name="hello_world")
349
+ async def hello_world(context: NodeContext):
350
+ print("Hello from AetherGraph!")
351
+ return {"ok": True}
352
+
353
+ run(hello_world)
354
+ PY
355
+ ```
356
+
357
+ ---
358
+
359
+ ## Examples
360
+
361
+ Quick‑start scripts live under `examples/` in this repo. A growing gallery of standalone examples will be published at:
362
+
363
+ * **Repo:** [https://github.com/AIperture/aethergraph-examples](https://github.com/AIperture/aethergraph-examples)
364
+ * **Path:** `examples/`
365
+
366
+ Run an example:
367
+
368
+ ```bash
369
+ cd examples
370
+ python hello_world.py
371
+ ```
372
+
373
+ ---
374
+
375
+ ## Troubleshooting
376
+
377
+ * **`ModuleNotFoundError`**: ensure you installed into the active venv and that your shell is using it.
378
+ * **LLM/API errors**: confirm provider/model/key configuration (env vars or your local secrets file).
379
+ * **Windows path quirks**: clear any local cache folders (e.g., `.rag/`) and re‑run; verify write permissions.
380
+ * **Slack extra**: install with `pip install "aethergraph[slack]"` if you need Slack channel integration.
381
+
382
+ ---
383
+
384
+ ## Contributing (early phase)
385
+
386
+ * Use feature branches and open a PR against `main`.
387
+ * Keep public examples free of real secrets.
388
+ * Run tests locally before pushing.
389
+
390
+ Dev install:
391
+
392
+ ```bash
393
+ pip install -e .[dev]
394
+ pytest -q
395
+ ```
396
+
397
+ ---
398
+
399
+ ## Project Links
400
+
401
+ * **Source:** [https://github.com/AIperture/aethergraph](https://github.com/AIperture/aethergraph)
402
+ * **Issues:** [https://github.com/AIperture/aethergraph/issues](https://github.com/AIperture/aethergraph/issues)
403
+ * **Examples:** [https://github.com/AIperture/aethergraph-examples](https://github.com/AIperture/aethergraph-examples)
404
+ * **Docs (preview):** [https://aiperture.github.io/aethergraph-docs/](https://aiperture.github.io/aethergraph-docs/)
405
+
406
+ ---
407
+
408
+ ## License
409
+
410
+ **Apache‑2.0** — see `LICENSE`.