flowscript-agents 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.
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .venv/
8
+ *.tmp
9
+ .flowscript-*
10
+ *.jsonl
11
+
@@ -0,0 +1,285 @@
1
+ Metadata-Version: 2.4
2
+ Name: flowscript-agents
3
+ Version: 0.1.0
4
+ Summary: FlowScript integrations for AI agent frameworks. Decision intelligence memory for LangGraph, CrewAI, Google ADK, and OpenAI Agents SDK.
5
+ Project-URL: Homepage, https://flowscript.org
6
+ Project-URL: Repository, https://github.com/phillipclapham/flowscript-agents
7
+ Project-URL: Issues, https://github.com/phillipclapham/flowscript-agents/issues
8
+ Project-URL: Documentation, https://flowscript.org
9
+ Author-email: Phillip Clapham <me@phillipclapham.com>
10
+ License-Expression: MIT
11
+ Keywords: agent-memory,ai-agents,crewai,decision-intelligence,flowscript,google-adk,langgraph,llm,openai-agents
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: flowscript-ldp>=0.2.1
23
+ Provides-Extra: all
24
+ Requires-Dist: crewai>=0.80.0; extra == 'all'
25
+ Requires-Dist: google-adk>=1.0.0; extra == 'all'
26
+ Requires-Dist: langgraph-checkpoint>=2.0.0; extra == 'all'
27
+ Requires-Dist: langgraph>=0.2.0; extra == 'all'
28
+ Requires-Dist: openai-agents>=0.1.0; extra == 'all'
29
+ Provides-Extra: crewai
30
+ Requires-Dist: crewai>=0.80.0; extra == 'crewai'
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
33
+ Requires-Dist: pytest>=8.0; extra == 'dev'
34
+ Provides-Extra: google-adk
35
+ Requires-Dist: google-adk>=1.0.0; extra == 'google-adk'
36
+ Provides-Extra: langgraph
37
+ Requires-Dist: langgraph-checkpoint>=2.0.0; extra == 'langgraph'
38
+ Requires-Dist: langgraph>=0.2.0; extra == 'langgraph'
39
+ Provides-Extra: openai-agents
40
+ Requires-Dist: openai-agents>=0.1.0; extra == 'openai-agents'
41
+ Description-Content-Type: text/markdown
42
+
43
+ # flowscript-agents
44
+
45
+ **Drop-in reasoning memory for AI agent frameworks.**
46
+
47
+ [![Tests](https://img.shields.io/badge/tests-96%20passing-brightgreen)](https://github.com/phillipclapham/flowscript-agents) [![PyPI](https://img.shields.io/pypi/v/flowscript-agents)](https://pypi.org/project/flowscript-agents/) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://pypi.org/project/flowscript-agents/)
48
+
49
+ ---
50
+
51
+ ## The Problem
52
+
53
+ Agent memory today is vector search over blobs. Your agent made a decision — why? What's blocking it? What tradeoffs did it weigh? Embeddings can't answer that.
54
+
55
+ **flowscript-agents** replaces flat memory with queryable reasoning for LangGraph, CrewAI, Google ADK, and OpenAI Agents SDK. Same interfaces your framework expects, but now `memory.query.tensions()` actually works.
56
+
57
+ Built on [flowscript-core](https://www.npmjs.com/package/flowscript-core) (TypeScript SDK) and [flowscript-ldp](https://pypi.org/project/flowscript-ldp/) (Python IR + query engine).
58
+
59
+ ---
60
+
61
+ ## Install
62
+
63
+ ```bash
64
+ # Core (framework-agnostic Memory class)
65
+ pip install flowscript-agents
66
+
67
+ # With your framework
68
+ pip install flowscript-agents[langgraph]
69
+ pip install flowscript-agents[crewai]
70
+ pip install flowscript-agents[google-adk]
71
+ pip install flowscript-agents[openai-agents]
72
+
73
+ # Everything
74
+ pip install flowscript-agents[all]
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Quick Start (Framework-Agnostic)
80
+
81
+ The `Memory` class works standalone — no framework required.
82
+
83
+ ```python
84
+ from flowscript_agents import Memory
85
+
86
+ mem = Memory()
87
+
88
+ q = mem.question("Which database for agent sessions?")
89
+ mem.alternative(q, "Redis").decide(rationale="speed critical")
90
+ mem.alternative(q, "SQLite").block(reason="no concurrent writes")
91
+ mem.tension(
92
+ mem.thought("Redis gives sub-ms reads"),
93
+ mem.thought("cluster costs $200/mo"),
94
+ axis="performance vs cost"
95
+ )
96
+
97
+ # Semantic queries — the thing no other memory gives you
98
+ print(mem.query.tensions()) # tradeoffs with named axes
99
+ print(mem.query.blocked()) # blockers + downstream impact
100
+ print(mem.query.alternatives(q.id)) # options + their states
101
+
102
+ # Persist
103
+ mem.save("./agent-memory.json")
104
+
105
+ # Next session
106
+ mem2 = Memory.load_or_create("./agent-memory.json")
107
+ ```
108
+
109
+ ---
110
+
111
+ ## LangGraph
112
+
113
+ Drop-in `BaseStore` implementation. Use as your LangGraph store — every item becomes a queryable FlowScript node.
114
+
115
+ ```python
116
+ from flowscript_agents.langgraph import FlowScriptStore
117
+
118
+ store = FlowScriptStore("./agent-memory.json")
119
+
120
+ # Standard LangGraph store operations
121
+ store.put(("agents", "planner"), "db_decision", {"value": "chose Redis for speed"})
122
+ items = store.search(("agents", "planner"), query="Redis")
123
+
124
+ # FlowScript queries on the same data
125
+ blockers = store.memory.query.blocked()
126
+ tensions = store.memory.query.tensions()
127
+
128
+ # Async support included
129
+ items = await store.aget(("agents",), "key")
130
+ await store.aput(("agents",), "key", {"value": "data"})
131
+ ```
132
+
133
+ **Install:** `pip install flowscript-agents[langgraph]`
134
+
135
+ ---
136
+
137
+ ## CrewAI
138
+
139
+ Duck-typed `StorageBackend` — plug into CrewAI's memory system.
140
+
141
+ ```python
142
+ from flowscript_agents.crewai import FlowScriptStorage
143
+
144
+ storage = FlowScriptStorage("./crew-memory.json")
145
+
146
+ # Standard CrewAI storage operations
147
+ storage.save({"content": "User prefers concise answers", "score": 0.9})
148
+ results = storage.search("user preferences", limit=5)
149
+
150
+ # Scoped storage
151
+ storage.save({"content": "API rate limit hit"}, metadata={"scope": "errors"})
152
+ scoped = storage.search("rate limit", scope="errors")
153
+
154
+ # FlowScript queries
155
+ tensions = storage.memory.query.tensions()
156
+ blockers = storage.memory.query.blocked()
157
+ ```
158
+
159
+ **Install:** `pip install flowscript-agents[crewai]`
160
+
161
+ ---
162
+
163
+ ## Google ADK
164
+
165
+ `BaseMemoryService` implementation for ADK agents.
166
+
167
+ ```python
168
+ from flowscript_agents.google_adk import FlowScriptMemoryService
169
+
170
+ memory_service = FlowScriptMemoryService("./adk-memory.json")
171
+
172
+ # Use with ADK Runner
173
+ # runner = Runner(agent=agent, memory_service=memory_service, ...)
174
+
175
+ # Session events are automatically extracted as FlowScript nodes
176
+ await memory_service.add_session_to_memory(session)
177
+
178
+ # Search enriched with FlowScript query results
179
+ results = await memory_service.search_memory("my-app", "user-1", "database decision")
180
+ # Results include tensions, blockers when search matches reasoning patterns
181
+
182
+ # Direct query access
183
+ tensions = memory_service.memory.query.tensions()
184
+ ```
185
+
186
+ **Install:** `pip install flowscript-agents[google-adk]`
187
+
188
+ ---
189
+
190
+ ## OpenAI Agents SDK
191
+
192
+ Session protocol implementation for the OpenAI Agents SDK.
193
+
194
+ ```python
195
+ from flowscript_agents.openai_agents import FlowScriptSession
196
+
197
+ session = FlowScriptSession("conversation_123", "./openai-memory.json")
198
+
199
+ # Standard session operations
200
+ session.add_items([
201
+ {"role": "user", "content": "Which database should we use?"},
202
+ {"role": "assistant", "content": "I recommend Redis for the speed requirement."}
203
+ ])
204
+ history = session.get_items(limit=10)
205
+
206
+ # FlowScript queries on conversation reasoning
207
+ tensions = session.memory.query.tensions()
208
+ blockers = session.memory.query.blocked()
209
+ ```
210
+
211
+ **Install:** `pip install flowscript-agents[openai-agents]`
212
+
213
+ ---
214
+
215
+ ## What You Get That Vector Memory Doesn't
216
+
217
+ | Capability | Vector stores | flowscript-agents |
218
+ |:-----------|:-------------|:-----------------|
219
+ | "Why did we decide X?" | Dig through logs | `memory.query.why(node_id)` |
220
+ | "What's blocking progress?" | Hope you logged it | `memory.query.blocked()` |
221
+ | "What tradeoffs exist?" | Good luck | `memory.query.tensions()` |
222
+ | "What alternatives were considered?" | Not tracked | `memory.query.alternatives(q_id)` |
223
+ | "What if we remove this?" | Rebuild from scratch | `memory.query.what_if(node_id)` |
224
+ | Human-readable export | JSON blobs | `.fs` files your PM can read |
225
+
226
+ These aren't complementary to embeddings — they're orthogonal. Use both: vector search for "find similar," FlowScript for "understand reasoning."
227
+
228
+ ---
229
+
230
+ ## API Reference
231
+
232
+ ### Memory (core)
233
+
234
+ ```python
235
+ from flowscript_agents import Memory
236
+
237
+ mem = Memory() # new empty
238
+ mem = Memory.load("./memory.json") # from file
239
+ mem = Memory.load_or_create("./mem.json") # zero-friction entry
240
+
241
+ # Build reasoning
242
+ node = mem.thought("content") # also: statement, question, action, insight, completion
243
+ alt = mem.alternative(question, "option") # linked to question
244
+ node.causes(other) # causal relationship
245
+ node.tension_with(other, axis="speed vs cost")
246
+ node.decide(rationale="reason") # state: decided
247
+ node.block(reason="why") # state: blocked
248
+ node.unblock() # remove blocked state
249
+
250
+ # Query
251
+ mem.query.why(node_id) # causal chain
252
+ mem.query.tensions() # all tensions with axes
253
+ mem.query.blocked() # all blockers + impact
254
+ mem.query.alternatives(question_id) # options + states
255
+ mem.query.what_if(node_id) # downstream impact
256
+
257
+ # Persist
258
+ mem.save("./memory.json") # atomic write
259
+ mem.save() # re-save to loaded path
260
+ ```
261
+
262
+ ### Adapters
263
+
264
+ | Framework | Class | Interface |
265
+ |:----------|:------|:----------|
266
+ | LangGraph | `FlowScriptStore` | `BaseStore` (get/put/search/delete + async) |
267
+ | CrewAI | `FlowScriptStorage` | `StorageBackend` (save/search/update/delete + scopes) |
268
+ | Google ADK | `FlowScriptMemoryService` | `BaseMemoryService` (add_session/search_memory) |
269
+ | OpenAI Agents | `FlowScriptSession` | `Session` (get_items/add_items/pop_item/clear) |
270
+
271
+ All adapters expose `.memory` for direct FlowScript query access.
272
+
273
+ ---
274
+
275
+ ## Ecosystem
276
+
277
+ - **[flowscript-core](https://www.npmjs.com/package/flowscript-core)** — TypeScript SDK with `Memory` class, `asTools()` (12 OpenAI-format tools), token budgeting, audit trail
278
+ - **[flowscript-ldp](https://pypi.org/project/flowscript-ldp/)** — Python IR types + query engine (the foundation this package builds on)
279
+ - **[flowscript.org](https://flowscript.org)** — Web editor, D3 visualization, live query panel
280
+
281
+ ---
282
+
283
+ ## License
284
+
285
+ MIT
@@ -0,0 +1,243 @@
1
+ # flowscript-agents
2
+
3
+ **Drop-in reasoning memory for AI agent frameworks.**
4
+
5
+ [![Tests](https://img.shields.io/badge/tests-96%20passing-brightgreen)](https://github.com/phillipclapham/flowscript-agents) [![PyPI](https://img.shields.io/pypi/v/flowscript-agents)](https://pypi.org/project/flowscript-agents/) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://pypi.org/project/flowscript-agents/)
6
+
7
+ ---
8
+
9
+ ## The Problem
10
+
11
+ Agent memory today is vector search over blobs. Your agent made a decision — why? What's blocking it? What tradeoffs did it weigh? Embeddings can't answer that.
12
+
13
+ **flowscript-agents** replaces flat memory with queryable reasoning for LangGraph, CrewAI, Google ADK, and OpenAI Agents SDK. Same interfaces your framework expects, but now `memory.query.tensions()` actually works.
14
+
15
+ Built on [flowscript-core](https://www.npmjs.com/package/flowscript-core) (TypeScript SDK) and [flowscript-ldp](https://pypi.org/project/flowscript-ldp/) (Python IR + query engine).
16
+
17
+ ---
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ # Core (framework-agnostic Memory class)
23
+ pip install flowscript-agents
24
+
25
+ # With your framework
26
+ pip install flowscript-agents[langgraph]
27
+ pip install flowscript-agents[crewai]
28
+ pip install flowscript-agents[google-adk]
29
+ pip install flowscript-agents[openai-agents]
30
+
31
+ # Everything
32
+ pip install flowscript-agents[all]
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Quick Start (Framework-Agnostic)
38
+
39
+ The `Memory` class works standalone — no framework required.
40
+
41
+ ```python
42
+ from flowscript_agents import Memory
43
+
44
+ mem = Memory()
45
+
46
+ q = mem.question("Which database for agent sessions?")
47
+ mem.alternative(q, "Redis").decide(rationale="speed critical")
48
+ mem.alternative(q, "SQLite").block(reason="no concurrent writes")
49
+ mem.tension(
50
+ mem.thought("Redis gives sub-ms reads"),
51
+ mem.thought("cluster costs $200/mo"),
52
+ axis="performance vs cost"
53
+ )
54
+
55
+ # Semantic queries — the thing no other memory gives you
56
+ print(mem.query.tensions()) # tradeoffs with named axes
57
+ print(mem.query.blocked()) # blockers + downstream impact
58
+ print(mem.query.alternatives(q.id)) # options + their states
59
+
60
+ # Persist
61
+ mem.save("./agent-memory.json")
62
+
63
+ # Next session
64
+ mem2 = Memory.load_or_create("./agent-memory.json")
65
+ ```
66
+
67
+ ---
68
+
69
+ ## LangGraph
70
+
71
+ Drop-in `BaseStore` implementation. Use as your LangGraph store — every item becomes a queryable FlowScript node.
72
+
73
+ ```python
74
+ from flowscript_agents.langgraph import FlowScriptStore
75
+
76
+ store = FlowScriptStore("./agent-memory.json")
77
+
78
+ # Standard LangGraph store operations
79
+ store.put(("agents", "planner"), "db_decision", {"value": "chose Redis for speed"})
80
+ items = store.search(("agents", "planner"), query="Redis")
81
+
82
+ # FlowScript queries on the same data
83
+ blockers = store.memory.query.blocked()
84
+ tensions = store.memory.query.tensions()
85
+
86
+ # Async support included
87
+ items = await store.aget(("agents",), "key")
88
+ await store.aput(("agents",), "key", {"value": "data"})
89
+ ```
90
+
91
+ **Install:** `pip install flowscript-agents[langgraph]`
92
+
93
+ ---
94
+
95
+ ## CrewAI
96
+
97
+ Duck-typed `StorageBackend` — plug into CrewAI's memory system.
98
+
99
+ ```python
100
+ from flowscript_agents.crewai import FlowScriptStorage
101
+
102
+ storage = FlowScriptStorage("./crew-memory.json")
103
+
104
+ # Standard CrewAI storage operations
105
+ storage.save({"content": "User prefers concise answers", "score": 0.9})
106
+ results = storage.search("user preferences", limit=5)
107
+
108
+ # Scoped storage
109
+ storage.save({"content": "API rate limit hit"}, metadata={"scope": "errors"})
110
+ scoped = storage.search("rate limit", scope="errors")
111
+
112
+ # FlowScript queries
113
+ tensions = storage.memory.query.tensions()
114
+ blockers = storage.memory.query.blocked()
115
+ ```
116
+
117
+ **Install:** `pip install flowscript-agents[crewai]`
118
+
119
+ ---
120
+
121
+ ## Google ADK
122
+
123
+ `BaseMemoryService` implementation for ADK agents.
124
+
125
+ ```python
126
+ from flowscript_agents.google_adk import FlowScriptMemoryService
127
+
128
+ memory_service = FlowScriptMemoryService("./adk-memory.json")
129
+
130
+ # Use with ADK Runner
131
+ # runner = Runner(agent=agent, memory_service=memory_service, ...)
132
+
133
+ # Session events are automatically extracted as FlowScript nodes
134
+ await memory_service.add_session_to_memory(session)
135
+
136
+ # Search enriched with FlowScript query results
137
+ results = await memory_service.search_memory("my-app", "user-1", "database decision")
138
+ # Results include tensions, blockers when search matches reasoning patterns
139
+
140
+ # Direct query access
141
+ tensions = memory_service.memory.query.tensions()
142
+ ```
143
+
144
+ **Install:** `pip install flowscript-agents[google-adk]`
145
+
146
+ ---
147
+
148
+ ## OpenAI Agents SDK
149
+
150
+ Session protocol implementation for the OpenAI Agents SDK.
151
+
152
+ ```python
153
+ from flowscript_agents.openai_agents import FlowScriptSession
154
+
155
+ session = FlowScriptSession("conversation_123", "./openai-memory.json")
156
+
157
+ # Standard session operations
158
+ session.add_items([
159
+ {"role": "user", "content": "Which database should we use?"},
160
+ {"role": "assistant", "content": "I recommend Redis for the speed requirement."}
161
+ ])
162
+ history = session.get_items(limit=10)
163
+
164
+ # FlowScript queries on conversation reasoning
165
+ tensions = session.memory.query.tensions()
166
+ blockers = session.memory.query.blocked()
167
+ ```
168
+
169
+ **Install:** `pip install flowscript-agents[openai-agents]`
170
+
171
+ ---
172
+
173
+ ## What You Get That Vector Memory Doesn't
174
+
175
+ | Capability | Vector stores | flowscript-agents |
176
+ |:-----------|:-------------|:-----------------|
177
+ | "Why did we decide X?" | Dig through logs | `memory.query.why(node_id)` |
178
+ | "What's blocking progress?" | Hope you logged it | `memory.query.blocked()` |
179
+ | "What tradeoffs exist?" | Good luck | `memory.query.tensions()` |
180
+ | "What alternatives were considered?" | Not tracked | `memory.query.alternatives(q_id)` |
181
+ | "What if we remove this?" | Rebuild from scratch | `memory.query.what_if(node_id)` |
182
+ | Human-readable export | JSON blobs | `.fs` files your PM can read |
183
+
184
+ These aren't complementary to embeddings — they're orthogonal. Use both: vector search for "find similar," FlowScript for "understand reasoning."
185
+
186
+ ---
187
+
188
+ ## API Reference
189
+
190
+ ### Memory (core)
191
+
192
+ ```python
193
+ from flowscript_agents import Memory
194
+
195
+ mem = Memory() # new empty
196
+ mem = Memory.load("./memory.json") # from file
197
+ mem = Memory.load_or_create("./mem.json") # zero-friction entry
198
+
199
+ # Build reasoning
200
+ node = mem.thought("content") # also: statement, question, action, insight, completion
201
+ alt = mem.alternative(question, "option") # linked to question
202
+ node.causes(other) # causal relationship
203
+ node.tension_with(other, axis="speed vs cost")
204
+ node.decide(rationale="reason") # state: decided
205
+ node.block(reason="why") # state: blocked
206
+ node.unblock() # remove blocked state
207
+
208
+ # Query
209
+ mem.query.why(node_id) # causal chain
210
+ mem.query.tensions() # all tensions with axes
211
+ mem.query.blocked() # all blockers + impact
212
+ mem.query.alternatives(question_id) # options + states
213
+ mem.query.what_if(node_id) # downstream impact
214
+
215
+ # Persist
216
+ mem.save("./memory.json") # atomic write
217
+ mem.save() # re-save to loaded path
218
+ ```
219
+
220
+ ### Adapters
221
+
222
+ | Framework | Class | Interface |
223
+ |:----------|:------|:----------|
224
+ | LangGraph | `FlowScriptStore` | `BaseStore` (get/put/search/delete + async) |
225
+ | CrewAI | `FlowScriptStorage` | `StorageBackend` (save/search/update/delete + scopes) |
226
+ | Google ADK | `FlowScriptMemoryService` | `BaseMemoryService` (add_session/search_memory) |
227
+ | OpenAI Agents | `FlowScriptSession` | `Session` (get_items/add_items/pop_item/clear) |
228
+
229
+ All adapters expose `.memory` for direct FlowScript query access.
230
+
231
+ ---
232
+
233
+ ## Ecosystem
234
+
235
+ - **[flowscript-core](https://www.npmjs.com/package/flowscript-core)** — TypeScript SDK with `Memory` class, `asTools()` (12 OpenAI-format tools), token budgeting, audit trail
236
+ - **[flowscript-ldp](https://pypi.org/project/flowscript-ldp/)** — Python IR types + query engine (the foundation this package builds on)
237
+ - **[flowscript.org](https://flowscript.org)** — Web editor, D3 visualization, live query panel
238
+
239
+ ---
240
+
241
+ ## License
242
+
243
+ MIT