agentstate-lib 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. agentstate_lib-0.1.0/.gitignore +226 -0
  2. agentstate_lib-0.1.0/CHANGELOG.md +0 -0
  3. agentstate_lib-0.1.0/LICENSE +21 -0
  4. agentstate_lib-0.1.0/PKG-INFO +33 -0
  5. agentstate_lib-0.1.0/README.md +3 -0
  6. agentstate_lib-0.1.0/agentstate/__init__.py +63 -0
  7. agentstate_lib-0.1.0/agentstate/api/__init__.py +0 -0
  8. agentstate_lib-0.1.0/agentstate/api/app.py +0 -0
  9. agentstate_lib-0.1.0/agentstate/api/auth.py +0 -0
  10. agentstate_lib-0.1.0/agentstate/api/cache.py +0 -0
  11. agentstate_lib-0.1.0/agentstate/api/routes.py +0 -0
  12. agentstate_lib-0.1.0/agentstate/api/streaming.py +0 -0
  13. agentstate_lib-0.1.0/agentstate/contrib/__init__.py +0 -0
  14. agentstate_lib-0.1.0/agentstate/contrib/base_agent.py +0 -0
  15. agentstate_lib-0.1.0/agentstate/coordination/__init__.py +0 -0
  16. agentstate_lib-0.1.0/agentstate/coordination/conflicts.py +0 -0
  17. agentstate_lib-0.1.0/agentstate/coordination/invariants.py +0 -0
  18. agentstate_lib-0.1.0/agentstate/core/__init__.py +30 -0
  19. agentstate_lib-0.1.0/agentstate/core/events.py +74 -0
  20. agentstate_lib-0.1.0/agentstate/core/patch.py +59 -0
  21. agentstate_lib-0.1.0/agentstate/core/state.py +49 -0
  22. agentstate_lib-0.1.0/agentstate/memory/__init__.py +11 -0
  23. agentstate_lib-0.1.0/agentstate/memory/checkpoint.py +0 -0
  24. agentstate_lib-0.1.0/agentstate/memory/replay.py +0 -0
  25. agentstate_lib-0.1.0/agentstate/memory/store.py +134 -0
  26. agentstate_lib-0.1.0/agentstate/observability/__init__.py +0 -0
  27. agentstate_lib-0.1.0/agentstate/observability/analysis.py +0 -0
  28. agentstate_lib-0.1.0/agentstate/observability/dashboard.py +0 -0
  29. agentstate_lib-0.1.0/agentstate/observability/tracing.py +0 -0
  30. agentstate_lib-0.1.0/agentstate/router/__init__.py +12 -0
  31. agentstate_lib-0.1.0/agentstate/router/context.py +24 -0
  32. agentstate_lib-0.1.0/agentstate/router/graph.py +162 -0
  33. agentstate_lib-0.1.0/agentstate/router/types.py +15 -0
  34. agentstate_lib-0.1.0/docs/benchmark.md +0 -0
  35. agentstate_lib-0.1.0/docs/build_instructions.md +1625 -0
  36. agentstate_lib-0.1.0/docs/decisions/ADR-001-event-sourcing.md +0 -0
  37. agentstate_lib-0.1.0/docs/decisions/ADR-002-protocol-over-abc.md +0 -0
  38. agentstate_lib-0.1.0/docs/decisions/ADR-003-patch-immutability.md +0 -0
  39. agentstate_lib-0.1.0/docs/decisions/ADR-004-agentfn-callable.md +0 -0
  40. agentstate_lib-0.1.0/docs/scaling.md +0 -0
  41. agentstate_lib-0.1.0/examples/benchmark/colab_setup.ipynb +83 -0
  42. agentstate_lib-0.1.0/examples/integrations/langchain_adapter.py +0 -0
  43. agentstate_lib-0.1.0/examples/integrations/langgraph_adapter.py +0 -0
  44. agentstate_lib-0.1.0/examples/models/anthropic_agent.py +0 -0
  45. agentstate_lib-0.1.0/examples/models/colab_ollama_agent.py +0 -0
  46. agentstate_lib-0.1.0/examples/models/groq_agent.py +0 -0
  47. agentstate_lib-0.1.0/examples/models/litellm_agent.py +0 -0
  48. agentstate_lib-0.1.0/examples/models/ollama_agent.py +0 -0
  49. agentstate_lib-0.1.0/examples/models/openai_agent.py +0 -0
  50. agentstate_lib-0.1.0/examples/models/rule_based_agent.py +0 -0
  51. agentstate_lib-0.1.0/examples/workflows/research_pipeline.py +0 -0
  52. agentstate_lib-0.1.0/examples/workflows/support_ticket.py +0 -0
  53. agentstate_lib-0.1.0/pyproject.toml +52 -0
  54. agentstate_lib-0.1.0/tests/__init__.py +0 -0
  55. agentstate_lib-0.1.0/tests/conftest.py +1 -0
  56. agentstate_lib-0.1.0/tests/integration/__init__.py +0 -0
  57. agentstate_lib-0.1.0/tests/integration/test_checkpoint_recovery.py +0 -0
  58. agentstate_lib-0.1.0/tests/integration/test_graph_run.py +71 -0
  59. agentstate_lib-0.1.0/tests/property/__init__.py +0 -0
  60. agentstate_lib-0.1.0/tests/property/test_patch_properties.py +0 -0
  61. agentstate_lib-0.1.0/tests/unit/__init__.py +0 -0
  62. agentstate_lib-0.1.0/tests/unit/test_conflicts.py +0 -0
  63. agentstate_lib-0.1.0/tests/unit/test_context.py +50 -0
  64. agentstate_lib-0.1.0/tests/unit/test_events.py +163 -0
  65. agentstate_lib-0.1.0/tests/unit/test_patch.py +56 -0
  66. agentstate_lib-0.1.0/tests/unit/test_replay.py +0 -0
  67. agentstate_lib-0.1.0/tests/unit/test_state.py +30 -0
  68. agentstate_lib-0.1.0/tests/unit/test_store.py +97 -0
  69. agentstate_lib-0.1.0/uv.lock +1160 -0
@@ -0,0 +1,226 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+
7
+ # db
8
+ *.db
9
+
10
+ .checkpoints/
11
+ examples/benchmark/results/*.json
12
+ .ngrok/
13
+
14
+ # C extensions
15
+ *.so
16
+
17
+ # Distribution / packaging
18
+ .Python
19
+ build/
20
+ develop-eggs/
21
+ dist/
22
+ downloads/
23
+ eggs/
24
+ .eggs/
25
+ lib/
26
+ lib64/
27
+ parts/
28
+ sdist/
29
+ var/
30
+ wheels/
31
+ share/python-wheels/
32
+ *.egg-info/
33
+ .installed.cfg
34
+ *.egg
35
+ MANIFEST
36
+
37
+ # PyInstaller
38
+ # Usually these files are written by a python script from a template
39
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
40
+ *.manifest
41
+ *.spec
42
+
43
+ # Installer logs
44
+ pip-log.txt
45
+ pip-delete-this-directory.txt
46
+
47
+ # Unit test / coverage reports
48
+ htmlcov/
49
+ .tox/
50
+ .nox/
51
+ .coverage
52
+ .coverage.*
53
+ .cache
54
+ nosetests.xml
55
+ coverage.xml
56
+ *.cover
57
+ *.py.cover
58
+ .hypothesis/
59
+ .pytest_cache/
60
+ cover/
61
+
62
+ # Translations
63
+ *.mo
64
+ *.pot
65
+
66
+ # Django stuff:
67
+ *.log
68
+ local_settings.py
69
+ db.sqlite3
70
+ db.sqlite3-journal
71
+
72
+ # Flask stuff:
73
+ instance/
74
+ .webassets-cache
75
+
76
+ # Scrapy stuff:
77
+ .scrapy
78
+
79
+ # Sphinx documentation
80
+ docs/_build/
81
+
82
+ # PyBuilder
83
+ .pybuilder/
84
+ target/
85
+
86
+ # Jupyter Notebook
87
+ .ipynb_checkpoints
88
+
89
+ # IPython
90
+ profile_default/
91
+ ipython_config.py
92
+
93
+ # pyenv
94
+ # For a library or package, you might want to ignore these files since the code is
95
+ # intended to run in multiple environments; otherwise, check them in:
96
+ # .python-version
97
+
98
+ # pipenv
99
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
100
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
101
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
102
+ # install all needed dependencies.
103
+ # Pipfile.lock
104
+
105
+ # UV
106
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
107
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
108
+ # commonly ignored for libraries.
109
+ # uv.lock
110
+
111
+ # poetry
112
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
113
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
114
+ # commonly ignored for libraries.
115
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
116
+ # poetry.lock
117
+ # poetry.toml
118
+
119
+ # pdm
120
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
121
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
122
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
123
+ # pdm.lock
124
+ # pdm.toml
125
+ .pdm-python
126
+ .pdm-build/
127
+
128
+ # pixi
129
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
130
+ # pixi.lock
131
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
132
+ # in the .venv directory. It is recommended not to include this directory in version control.
133
+ .pixi
134
+
135
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
136
+ __pypackages__/
137
+
138
+ # Celery stuff
139
+ celerybeat-schedule
140
+ celerybeat.pid
141
+
142
+ # Redis
143
+ *.rdb
144
+ *.aof
145
+ *.pid
146
+
147
+ # RabbitMQ
148
+ mnesia/
149
+ rabbitmq/
150
+ rabbitmq-data/
151
+
152
+ # ActiveMQ
153
+ activemq-data/
154
+
155
+ # SageMath parsed files
156
+ *.sage.py
157
+
158
+ # Environments
159
+ .env
160
+ .envrc
161
+ .venv
162
+ env/
163
+ venv/
164
+ ENV/
165
+ env.bak/
166
+ venv.bak/
167
+
168
+ # Spyder project settings
169
+ .spyderproject
170
+ .spyproject
171
+
172
+ # Rope project settings
173
+ .ropeproject
174
+
175
+ # mkdocs documentation
176
+ /site
177
+
178
+ # mypy
179
+ .mypy_cache/
180
+ .dmypy.json
181
+ dmypy.json
182
+
183
+ # Pyre type checker
184
+ .pyre/
185
+
186
+ # pytype static type analyzer
187
+ .pytype/
188
+
189
+ # Cython debug symbols
190
+ cython_debug/
191
+
192
+ # PyCharm
193
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
194
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
195
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
196
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
197
+ # .idea/
198
+
199
+ # Abstra
200
+ # Abstra is an AI-powered process automation framework.
201
+ # Ignore directories containing user credentials, local state, and settings.
202
+ # Learn more at https://abstra.io/docs
203
+ .abstra/
204
+
205
+ # Visual Studio Code
206
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
207
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
208
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
209
+ # you could uncomment the following to ignore the entire vscode folder
210
+ .vscode/
211
+ # Temporary file for partial code execution
212
+ tempCodeRunnerFile.py
213
+
214
+ # Ruff stuff:
215
+ .ruff_cache/
216
+
217
+ # PyPI configuration file
218
+ .pypirc
219
+
220
+ # Marimo
221
+ marimo/_static/
222
+ marimo/_lsp/
223
+ __marimo__/
224
+
225
+ # Streamlit
226
+ .streamlit/secrets.toml
File without changes
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tanveer kaur
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,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentstate_lib
3
+ Version: 0.1.0
4
+ Summary: Stateful coordination layer for multi-agent AI systems
5
+ Author-email: Tanveer Kaur <tanveerkaur1292@outlook.com>
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Keywords: agents,llm,multi-agent,orchestration,state
9
+ Requires-Python: >=3.11
10
+ Requires-Dist: aiosqlite>=0.19
11
+ Requires-Dist: pydantic>=2.0
12
+ Provides-Extra: api
13
+ Requires-Dist: fastapi>=0.100; extra == 'api'
14
+ Requires-Dist: uvicorn[standard]>=0.20; extra == 'api'
15
+ Provides-Extra: contrib
16
+ Provides-Extra: dashboard
17
+ Requires-Dist: rich>=13.0; extra == 'dashboard'
18
+ Provides-Extra: dev
19
+ Requires-Dist: httpx>=0.24; extra == 'dev'
20
+ Requires-Dist: hypothesis>=6.0; extra == 'dev'
21
+ Requires-Dist: mypy>=1.0; extra == 'dev'
22
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
23
+ Requires-Dist: pytest>=7.0; extra == 'dev'
24
+ Requires-Dist: ruff>=0.1; extra == 'dev'
25
+ Provides-Extra: otel
26
+ Requires-Dist: opentelemetry-api; extra == 'otel'
27
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc; extra == 'otel'
28
+ Requires-Dist: opentelemetry-sdk; extra == 'otel'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # agentstate
32
+ Building a stateful coordination layer for multi-agent AI systems.
33
+
@@ -0,0 +1,3 @@
1
+ # agentstate
2
+ Building a stateful coordination layer for multi-agent AI systems.
3
+
@@ -0,0 +1,63 @@
1
+ from __future__ import annotations
2
+
3
+ from agentstate.core.events import (
4
+ AgentErrored,
5
+ BaseStateEvent,
6
+ CheckpointSaved,
7
+ ConflictDetected,
8
+ PatchApplied,
9
+ StateEvent,
10
+ WorkflowCompleted,
11
+ WorkflowStarted,
12
+ event_adapter,
13
+ )
14
+ from agentstate.core.patch import (
15
+ StatePatch,
16
+ apply_patch,
17
+ get_nested,
18
+ set_nested,
19
+ )
20
+ from agentstate.core.state import (
21
+ Artifact,
22
+ Decision,
23
+ Goal,
24
+ SharedState,
25
+ Task,
26
+ WorkflowStatus,
27
+ )
28
+ from agentstate.memory.store import InMemoryStore, SQLiteStore, StateStore
29
+ from agentstate.router.context import slice_state
30
+ from agentstate.router.graph import AgentGraph
31
+ from agentstate.router.types import AgentFn, EdgeCondition
32
+
33
+ __version__ = "0.1.0"
34
+
35
+ __all__ = [
36
+ "SharedState",
37
+ "Task",
38
+ "Goal",
39
+ "Artifact",
40
+ "Decision",
41
+ "WorkflowStatus",
42
+ "StatePatch",
43
+ "apply_patch",
44
+ "set_nested",
45
+ "get_nested",
46
+ "StateEvent",
47
+ "BaseStateEvent",
48
+ "WorkflowStarted",
49
+ "WorkflowCompleted",
50
+ "PatchApplied",
51
+ "ConflictDetected",
52
+ "CheckpointSaved",
53
+ "AgentErrored",
54
+ "event_adapter",
55
+ "AgentGraph",
56
+ "AgentFn",
57
+ "EdgeCondition",
58
+ "slice_state",
59
+ "StateStore",
60
+ "InMemoryStore",
61
+ "SQLiteStore",
62
+ "__version__",
63
+ ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,30 @@
1
+ from .events import (
2
+ AgentErrored,
3
+ BaseStateEvent,
4
+ CheckpointSaved,
5
+ ConflictDetected,
6
+ PatchApplied,
7
+ StateEvent,
8
+ WorkflowCompleted,
9
+ WorkflowStarted,
10
+ event_adapter,
11
+ )
12
+ from .state import Artifact, Decision, Goal, SharedState, Task, WorkflowStatus
13
+
14
+ __all__ = [
15
+ "SharedState",
16
+ "Task",
17
+ "Goal",
18
+ "Artifact",
19
+ "Decision",
20
+ "WorkflowStatus",
21
+ "StateEvent",
22
+ "BaseStateEvent",
23
+ "WorkflowStarted",
24
+ "WorkflowCompleted",
25
+ "PatchApplied",
26
+ "ConflictDetected",
27
+ "CheckpointSaved",
28
+ "AgentErrored",
29
+ "event_adapter",
30
+ ]
@@ -0,0 +1,74 @@
1
+ import time
2
+ import uuid
3
+ from typing import Annotated, Any, Literal
4
+
5
+ from pydantic import BaseModel, Field, TypeAdapter
6
+
7
+
8
+ # This is the parent all events share
9
+ class BaseStateEvent(BaseModel):
10
+ event_id : str = Field(default_factory=lambda: str(uuid.uuid4()))
11
+ workflow_id : str
12
+ agent_id : str
13
+ timestamp : float = Field(default_factory=time.time)
14
+
15
+
16
+ # six subclasses inherting from BaseStateEvent,
17
+ # with each one, having a 'type' field typed as a literal with
18
+ # a single string value, and set its default to that string.
19
+
20
+ class WorkflowStarted(BaseStateEvent):
21
+ type : Literal["workflow_started"]
22
+ workflow_type : str
23
+ goal : str
24
+
25
+
26
+ class WorkflowCompleted(BaseStateEvent):
27
+ type : Literal["workflow_completed"]
28
+ final_status : Any
29
+
30
+
31
+ class PatchApplied(BaseStateEvent):
32
+ type : Literal["patch_applied"]
33
+ patch_id : str
34
+ target : str
35
+ old_value : Any
36
+ new_value : Any
37
+ reason : str
38
+
39
+
40
+ class ConflictDetected(BaseStateEvent):
41
+ type : Literal["conflict_detected"]
42
+ conflict_id : str
43
+ path : str
44
+ winner_agent_id : str
45
+ loser_agent_id : str
46
+ resolution_strategy : str
47
+
48
+
49
+ class CheckpointSaved(BaseStateEvent):
50
+ type : Literal["checkpoint_saved"]
51
+ checkpoint_id : str
52
+ event_count : int
53
+
54
+ class AgentErrored(BaseStateEvent):
55
+ type : Literal["agent_errored"]
56
+ error_type : str
57
+ error_message : str
58
+ retry_count : int
59
+
60
+ # Pydantic will use the type field to decide which model to instantiate
61
+ # when deserializing
62
+ StateEvent = Annotated[
63
+ WorkflowStarted
64
+ | WorkflowCompleted
65
+ | PatchApplied
66
+ | ConflictDetected
67
+ | CheckpointSaved
68
+ | AgentErrored,
69
+ Field(discriminator="type")
70
+ ]
71
+
72
+ # at module level, writing a typeadapter for statevent
73
+ # this is how you deserialize a JSON string into the correct event subtype
74
+ event_adapter: TypeAdapter[StateEvent] = TypeAdapter(StateEvent)
@@ -0,0 +1,59 @@
1
+ from __future__ import annotations
2
+
3
+ import time
4
+ import uuid
5
+ from typing import Any
6
+
7
+ from pydantic import BaseModel, Field
8
+
9
+ from agentstate.core.state import SharedState
10
+
11
+
12
+ # represents "one change an agent wants to make" to the shared state
13
+ class StatePatch(BaseModel):
14
+ patch_id:str = Field(default_factory=lambda: str(uuid.uuid4()))
15
+ agent_id: str
16
+ target : str # dotted path, eg: tasks.task_1.status
17
+ value : Any
18
+ reason : str
19
+ timestamp : float = Field(default_factory=time.time)
20
+ priority : int = 0
21
+
22
+ def set_nested(obj: dict[str, Any], path: str, value : Any) -> dict[str, Any]:
23
+ """
24
+ Set value at a dotted path inside a nested dict, creating dicts as needed.
25
+ """
26
+ parts = path.split(".") # turns "a.b.c" into ["a","b","c"]
27
+ current : dict[str, Any] = obj
28
+
29
+ for key in parts[:-1]:
30
+ if key not in current or not isinstance(current[key], dict):
31
+ current[key] = {}
32
+ current = current[key]
33
+
34
+ current[parts[-1]] = value
35
+ return obj
36
+
37
+ def get_nested(obj: dict[str, Any], path: str) -> Any:
38
+ """
39
+ Get value at a dotted path from a nested dict, or None if missing.
40
+ """
41
+
42
+ parts = path.split(".")
43
+ current : Any = obj
44
+
45
+ for key in parts:
46
+ if not isinstance(current, dict):
47
+ return None
48
+ if key not in current:
49
+ return None
50
+ current = current[key]
51
+
52
+ return current
53
+
54
+ # creates a dict view of SharedState with model_dump()
55
+ def apply_patch(state: SharedState, patch: StatePatch) -> SharedState:
56
+ """Return a new SharedState with the patch applied at patch.target"""
57
+ state_dict = state.model_dump()
58
+ set_nested(state_dict, patch.target, patch.value)
59
+ return SharedState.model_validate(state_dict)
@@ -0,0 +1,49 @@
1
+ import time
2
+ import uuid
3
+ from typing import Any, Literal
4
+
5
+ from pydantic import BaseModel, Field
6
+
7
+ WorkflowStatus = Literal["running", "complete", "failed", "paused"]
8
+
9
+ class Task(BaseModel):
10
+ id : str = Field(default_factory=lambda: str(uuid.uuid4()))
11
+ description : str
12
+ status : Literal["pending", "running", "done", "failed"] = 'pending'
13
+ result : Any | None = None
14
+ created_at : float = Field(default_factory=time.time)
15
+ updated_as: float = Field(default_factory=time.time)
16
+
17
+
18
+ class Goal(BaseModel):
19
+ id: str = Field(default_factory=lambda: str(uuid.uuid4()))
20
+ description : str
21
+ status : Literal["pending", "active", "complete", "failed"] = 'pending'
22
+ created_at : float = Field(default_factory=time.time)
23
+
24
+ class Artifact(BaseModel):
25
+ id : str = Field(default_factory=lambda : str(uuid.uuid4()))
26
+ produced_by : str
27
+ artifact_type : str
28
+ content : Any
29
+ created_at : float = Field(default_factory=time.time)
30
+
31
+ class Decision(BaseModel):
32
+ id : str = Field(default_factory=lambda : str(uuid.uuid4()))
33
+ made_by : str
34
+ description : str
35
+ rationale : str
36
+ timestamp : float = Field(default_factory=time.time)
37
+
38
+ class SharedState(BaseModel):
39
+ workflow_id : str = Field(default_factory=lambda: str(uuid.uuid4()))
40
+ workflow_type : str = "general"
41
+ goal : str
42
+ goals : dict[str, Goal] = Field(default_factory=dict)
43
+ tasks : dict[str, Task] = Field(default_factory=dict)
44
+ artifacts : dict[str, Artifact] = Field(default_factory=dict)
45
+ decisions : list[Decision] = Field(default_factory=list)
46
+ facts : dict[str, Any] = Field(default_factory=dict)
47
+ status : WorkflowStatus = 'running'
48
+ created_at : float = Field(default_factory=time.time)
49
+ updated_at : float = Field(default_factory=time.time)
@@ -0,0 +1,11 @@
1
+ from .store import (
2
+ InMemoryStore,
3
+ SQLiteStore,
4
+ StateStore,
5
+ )
6
+
7
+ __all__ = [
8
+ "StateStore",
9
+ "InMemoryStore",
10
+ "SQLiteStore",
11
+ ]
File without changes
File without changes