agentic-blocks 0.1.19__tar.gz → 0.1.20__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.
- {agentic_blocks-0.1.19/src/agentic_blocks.egg-info → agentic_blocks-0.1.20}/PKG-INFO +1 -1
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/pyproject.toml +1 -1
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/visualization/visualize.py +22 -24
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20/src/agentic_blocks.egg-info}/PKG-INFO +1 -1
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks.egg-info/SOURCES.txt +0 -2
- agentic_blocks-0.1.19/src/agentic_blocks/visualization/async_flow.py +0 -165
- agentic_blocks-0.1.19/src/agentic_blocks/visualization/async_loop_flow.py +0 -73
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/LICENSE +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/README.md +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/setup.cfg +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/__init__.py +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/agent.py +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/llm.py +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/mcp_client.py +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/messages.py +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/tracing/__init__.py +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/tracing/config.py +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/tracing/core.py +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/tracing/decorator.py +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/utils/tools_utils.py +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks.egg-info/dependency_links.txt +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks.egg-info/requires.txt +0 -0
- {agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks.egg-info/top_level.txt +0 -0
@@ -14,7 +14,7 @@ agentic_blocks = []
|
|
14
14
|
|
15
15
|
[project]
|
16
16
|
name = "agentic-blocks"
|
17
|
-
version = "0.1.
|
17
|
+
version = "0.1.20"
|
18
18
|
description = "Simple building blocks for agentic AI systems with MCP client and conversation management"
|
19
19
|
readme = "README.md"
|
20
20
|
requires-python = ">=3.11"
|
{agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks/visualization/visualize.py
RENAMED
@@ -15,8 +15,6 @@ from typing import Any, Optional, Tuple, Union
|
|
15
15
|
|
16
16
|
from pocketflow import Flow
|
17
17
|
|
18
|
-
from async_flow import order_pipeline
|
19
|
-
|
20
18
|
|
21
19
|
def build_mermaid(start):
|
22
20
|
ids, visited, lines = {}, set(), ["graph LR"]
|
@@ -268,16 +266,16 @@ def create_d3_visualization(
|
|
268
266
|
stroke-width: 1.5px;
|
269
267
|
}
|
270
268
|
.node-labels {
|
271
|
-
font-size:
|
269
|
+
font-size: 14px;
|
272
270
|
pointer-events: none;
|
273
271
|
}
|
274
272
|
.link-labels {
|
275
|
-
font-size:
|
273
|
+
font-size: 12px;
|
276
274
|
fill: #666;
|
277
275
|
pointer-events: none;
|
278
276
|
}
|
279
277
|
.group-link-labels {
|
280
|
-
font-size:
|
278
|
+
font-size: 13px;
|
281
279
|
font-weight: bold;
|
282
280
|
fill: #333;
|
283
281
|
pointer-events: none;
|
@@ -291,7 +289,7 @@ def create_d3_visualization(
|
|
291
289
|
ry: 10;
|
292
290
|
}
|
293
291
|
.group-label {
|
294
|
-
font-size:
|
292
|
+
font-size: 16px;
|
295
293
|
font-weight: bold;
|
296
294
|
pointer-events: none;
|
297
295
|
}
|
@@ -360,14 +358,14 @@ def create_d3_visualization(
|
|
360
358
|
|
361
359
|
// Create a force simulation
|
362
360
|
const simulation = d3.forceSimulation(data.nodes)
|
363
|
-
// Controls the distance between connected nodes
|
364
|
-
.force("link", d3.forceLink(data.links).id(d => d.id).distance(
|
365
|
-
// Controls how nodes repel each other -
|
366
|
-
.force("charge", d3.forceManyBody().strength(-
|
361
|
+
// Controls the distance between connected nodes - increased for larger visualization
|
362
|
+
.force("link", d3.forceLink(data.links).id(d => d.id).distance(200))
|
363
|
+
// Controls how nodes repel each other - increased repulsion for more spread
|
364
|
+
.force("charge", d3.forceManyBody().strength(-100))
|
367
365
|
// Centers the entire graph in the SVG
|
368
366
|
.force("center", d3.forceCenter(width / 2, height / 2))
|
369
|
-
// Prevents nodes from overlapping -
|
370
|
-
.force("collide", d3.forceCollide().radius(
|
367
|
+
// Prevents nodes from overlapping - increased radius for larger spacing
|
368
|
+
.force("collide", d3.forceCollide().radius(80));
|
371
369
|
|
372
370
|
// Group forces - create a force to keep nodes in the same group closer together
|
373
371
|
// This creates the effect of nodes clustering within their group boxes
|
@@ -432,7 +430,7 @@ def create_d3_visualization(
|
|
432
430
|
|
433
431
|
if (source && target) {
|
434
432
|
// Add a horizontal force to align groups
|
435
|
-
const desiredDx =
|
433
|
+
const desiredDx = 500; // Desired horizontal distance between linked groups - increased for larger layout
|
436
434
|
const dx = target.cx - source.cx;
|
437
435
|
const diff = desiredDx - Math.abs(dx);
|
438
436
|
|
@@ -525,21 +523,21 @@ def create_d3_visualization(
|
|
525
523
|
.attr("font-size", "10px")
|
526
524
|
.attr("fill", "#666");
|
527
525
|
|
528
|
-
// Create nodes
|
526
|
+
// Create nodes - increased size for larger visualization
|
529
527
|
const node = svg.append("g")
|
530
528
|
.attr("class", "nodes")
|
531
529
|
.selectAll("circle")
|
532
530
|
.data(data.nodes)
|
533
531
|
.enter()
|
534
532
|
.append("circle")
|
535
|
-
.attr("r",
|
533
|
+
.attr("r", 25)
|
536
534
|
.attr("fill", d => color(d.group))
|
537
535
|
.call(d3.drag()
|
538
536
|
.on("start", dragstarted)
|
539
537
|
.on("drag", dragged)
|
540
538
|
.on("end", dragended));
|
541
539
|
|
542
|
-
// Create node labels
|
540
|
+
// Create node labels - increased offset for larger nodes
|
543
541
|
const nodeLabel = svg.append("g")
|
544
542
|
.attr("class", "node-labels")
|
545
543
|
.selectAll("text")
|
@@ -548,7 +546,7 @@ def create_d3_visualization(
|
|
548
546
|
.append("text")
|
549
547
|
.text(d => d.name)
|
550
548
|
.attr("text-anchor", "middle")
|
551
|
-
.attr("dy",
|
549
|
+
.attr("dy", 40);
|
552
550
|
|
553
551
|
// Add tooltip on hover
|
554
552
|
node.append("title")
|
@@ -659,16 +657,16 @@ def create_d3_visualization(
|
|
659
657
|
if (d.nodes.length > 0) {
|
660
658
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
661
659
|
|
662
|
-
// Find the bounding box for all nodes in the group
|
660
|
+
// Find the bounding box for all nodes in the group - increased for larger nodes
|
663
661
|
d.nodes.forEach(n => {
|
664
|
-
minX = Math.min(minX, n.x -
|
665
|
-
minY = Math.min(minY, n.y -
|
666
|
-
maxX = Math.max(maxX, n.x +
|
667
|
-
maxY = Math.max(maxY, n.y +
|
662
|
+
minX = Math.min(minX, n.x - 40);
|
663
|
+
minY = Math.min(minY, n.y - 40);
|
664
|
+
maxX = Math.max(maxX, n.x + 40);
|
665
|
+
maxY = Math.max(maxY, n.y + 60); // Extra space for labels
|
668
666
|
});
|
669
667
|
|
670
|
-
// Add padding
|
671
|
-
const padding =
|
668
|
+
// Add padding - increased for larger visualization
|
669
|
+
const padding = 30;
|
672
670
|
minX -= padding;
|
673
671
|
minY -= padding;
|
674
672
|
maxX += padding;
|
@@ -16,6 +16,4 @@ src/agentic_blocks/tracing/config.py
|
|
16
16
|
src/agentic_blocks/tracing/core.py
|
17
17
|
src/agentic_blocks/tracing/decorator.py
|
18
18
|
src/agentic_blocks/utils/tools_utils.py
|
19
|
-
src/agentic_blocks/visualization/async_flow.py
|
20
|
-
src/agentic_blocks/visualization/async_loop_flow.py
|
21
19
|
src/agentic_blocks/visualization/visualize.py
|
@@ -1,165 +0,0 @@
|
|
1
|
-
from pocketflow import AsyncNode, AsyncFlow
|
2
|
-
import asyncio
|
3
|
-
|
4
|
-
|
5
|
-
# Define Payment Nodes
|
6
|
-
class ValidatePayment(AsyncNode):
|
7
|
-
async def exec_async(self, prep_res):
|
8
|
-
print("1.1.Validating payment...")
|
9
|
-
return "Payment validated successfully"
|
10
|
-
|
11
|
-
async def post_async(self, shared, prep_res, exec_res):
|
12
|
-
shared["payment_status"] = exec_res
|
13
|
-
return "default"
|
14
|
-
|
15
|
-
|
16
|
-
class ProcessPayment(AsyncNode):
|
17
|
-
async def exec_async(self, prep_res):
|
18
|
-
print("1.2.Processing payment...")
|
19
|
-
return "Payment processed successfully"
|
20
|
-
|
21
|
-
async def post_async(self, shared, prep_res, exec_res):
|
22
|
-
shared["payment_result"] = exec_res
|
23
|
-
return "default"
|
24
|
-
|
25
|
-
|
26
|
-
class PaymentConfirmation(AsyncNode):
|
27
|
-
async def exec_async(self, prep_res):
|
28
|
-
print("1.3.Confirming payment...")
|
29
|
-
return "Payment confirmed"
|
30
|
-
|
31
|
-
async def post_async(self, shared, prep_res, exec_res):
|
32
|
-
shared["payment_confirmation"] = exec_res
|
33
|
-
return "default"
|
34
|
-
|
35
|
-
|
36
|
-
# Define Inventory Nodes
|
37
|
-
class CheckStock(AsyncNode):
|
38
|
-
async def exec_async(self, prep_res):
|
39
|
-
print("2.1.Checking inventory stock...")
|
40
|
-
return "Stock available"
|
41
|
-
|
42
|
-
async def post_async(self, shared, prep_res, exec_res):
|
43
|
-
shared["stock_status"] = exec_res
|
44
|
-
return "default"
|
45
|
-
|
46
|
-
|
47
|
-
class ReserveItems(AsyncNode):
|
48
|
-
async def exec_async(self, prep_res):
|
49
|
-
print("2.2.Reserving items...")
|
50
|
-
return "Items reserved"
|
51
|
-
|
52
|
-
async def post_async(self, shared, prep_res, exec_res):
|
53
|
-
shared["reservation_status"] = exec_res
|
54
|
-
return "default"
|
55
|
-
|
56
|
-
|
57
|
-
class UpdateInventory(AsyncNode):
|
58
|
-
async def exec_async(self, prep_res):
|
59
|
-
print("2.3. Updating inventory...")
|
60
|
-
return "Inventory updated"
|
61
|
-
|
62
|
-
async def post_async(self, shared, prep_res, exec_res):
|
63
|
-
shared["inventory_update"] = exec_res
|
64
|
-
return "default"
|
65
|
-
|
66
|
-
|
67
|
-
# Define Shipping Nodes
|
68
|
-
class CreateLabel(AsyncNode):
|
69
|
-
async def exec_async(self, prep_res):
|
70
|
-
print("3.1 Creating shipping label...")
|
71
|
-
return "Shipping label created"
|
72
|
-
|
73
|
-
async def post_async(self, shared, prep_res, exec_res):
|
74
|
-
shared["shipping_label"] = exec_res
|
75
|
-
return "default"
|
76
|
-
|
77
|
-
|
78
|
-
class AssignCarrier(AsyncNode):
|
79
|
-
async def exec_async(self, prep_res):
|
80
|
-
print("3.2 Assigning carrier...")
|
81
|
-
return "Carrier assigned"
|
82
|
-
|
83
|
-
async def post_async(self, shared, prep_res, exec_res):
|
84
|
-
shared["carrier"] = exec_res
|
85
|
-
return "default"
|
86
|
-
|
87
|
-
|
88
|
-
class SchedulePickup(AsyncNode):
|
89
|
-
async def exec_async(self, prep_res):
|
90
|
-
print("3.3 Scheduling pickup...")
|
91
|
-
return "Pickup scheduled"
|
92
|
-
|
93
|
-
async def post_async(self, shared, prep_res, exec_res):
|
94
|
-
shared["pickup_status"] = exec_res
|
95
|
-
return "default"
|
96
|
-
|
97
|
-
|
98
|
-
# Create node instances
|
99
|
-
validate_payment = ValidatePayment()
|
100
|
-
process_payment = ProcessPayment()
|
101
|
-
payment_confirmation = PaymentConfirmation()
|
102
|
-
|
103
|
-
check_stock = CheckStock()
|
104
|
-
reserve_items = ReserveItems()
|
105
|
-
update_inventory = UpdateInventory()
|
106
|
-
|
107
|
-
create_label = CreateLabel()
|
108
|
-
assign_carrier = AssignCarrier()
|
109
|
-
schedule_pickup = SchedulePickup()
|
110
|
-
|
111
|
-
# Payment processing sub-flow
|
112
|
-
validate_payment >> process_payment >> payment_confirmation
|
113
|
-
payment_flow = AsyncFlow(start=validate_payment)
|
114
|
-
|
115
|
-
# Inventory sub-flow
|
116
|
-
check_stock >> reserve_items >> update_inventory
|
117
|
-
inventory_flow = AsyncFlow(start=check_stock)
|
118
|
-
|
119
|
-
# Shipping sub-flow
|
120
|
-
create_label >> assign_carrier >> schedule_pickup
|
121
|
-
shipping_flow = AsyncFlow(start=create_label)
|
122
|
-
|
123
|
-
# Connect the flows into a main order pipeline
|
124
|
-
payment_flow >> inventory_flow >> shipping_flow
|
125
|
-
# payment_flow >> inventory_flow >> create_label
|
126
|
-
# payment_flow >> inventory_flow >> assign_carrier
|
127
|
-
|
128
|
-
|
129
|
-
# Create the master flow
|
130
|
-
class OrderFlow(AsyncFlow):
|
131
|
-
pass
|
132
|
-
|
133
|
-
|
134
|
-
order_pipeline = OrderFlow(start=payment_flow)
|
135
|
-
|
136
|
-
# Create shared data structure
|
137
|
-
shared_data = {
|
138
|
-
"order_id": "ORD-12345",
|
139
|
-
"customer": "John Doe",
|
140
|
-
"items": [
|
141
|
-
{"id": "ITEM-001", "name": "Smartphone", "price": 999.99, "quantity": 1},
|
142
|
-
{"id": "ITEM-002", "name": "Phone case", "price": 29.99, "quantity": 1},
|
143
|
-
],
|
144
|
-
"shipping_address": {
|
145
|
-
"street": "123 Main St",
|
146
|
-
"city": "Anytown",
|
147
|
-
"state": "CA",
|
148
|
-
"zip": "12345",
|
149
|
-
},
|
150
|
-
}
|
151
|
-
|
152
|
-
|
153
|
-
# Run the entire pipeline asynchronously
|
154
|
-
async def main():
|
155
|
-
await order_pipeline.run_async(shared_data)
|
156
|
-
|
157
|
-
# Print final status
|
158
|
-
print("\nOrder processing completed!")
|
159
|
-
print(f"Payment: {shared_data.get('payment_confirmation')}")
|
160
|
-
print(f"Inventory: {shared_data.get('inventory_update')}")
|
161
|
-
print(f"Shipping: {shared_data.get('pickup_status')}")
|
162
|
-
|
163
|
-
|
164
|
-
if __name__ == "__main__":
|
165
|
-
asyncio.run(main())
|
@@ -1,73 +0,0 @@
|
|
1
|
-
from async_flow import *
|
2
|
-
from pocketflow import Flow, AsyncParallelBatchNode, Node
|
3
|
-
|
4
|
-
# Create node instances
|
5
|
-
validate_payment = ValidatePayment()
|
6
|
-
process_payment = ProcessPayment()
|
7
|
-
payment_confirmation = PaymentConfirmation()
|
8
|
-
|
9
|
-
check_stock = CheckStock()
|
10
|
-
reserve_items = ReserveItems()
|
11
|
-
update_inventory = UpdateInventory()
|
12
|
-
|
13
|
-
create_label = CreateLabel()
|
14
|
-
assign_carrier = AssignCarrier()
|
15
|
-
schedule_pickup = SchedulePickup()
|
16
|
-
|
17
|
-
# Payment processing sub-flow
|
18
|
-
validate_payment >> process_payment
|
19
|
-
validate_payment - "out_of_stock" >> validate_payment # 循环重试
|
20
|
-
process_payment - 'something fail' >> validate_payment
|
21
|
-
process_payment - 'pass' >> payment_confirmation
|
22
|
-
payment_flow = AsyncFlow(start=validate_payment)
|
23
|
-
|
24
|
-
# Inventory sub-flow
|
25
|
-
check_stock >> reserve_items >> update_inventory
|
26
|
-
inventory_flow = AsyncFlow(start=check_stock)
|
27
|
-
|
28
|
-
# Shipping sub-flow
|
29
|
-
create_label >> assign_carrier >> schedule_pickup
|
30
|
-
shipping_flow = AsyncFlow(start=create_label)
|
31
|
-
|
32
|
-
# Connect the flows into a main order pipeline
|
33
|
-
payment_flow >> inventory_flow >> shipping_flow
|
34
|
-
# payment_flow >> inventory_flow >> create_label
|
35
|
-
# payment_flow >> inventory_flow >> assign_carrier
|
36
|
-
|
37
|
-
|
38
|
-
# Create the master flow
|
39
|
-
class OrderFlow(AsyncFlow):
|
40
|
-
pass
|
41
|
-
|
42
|
-
order_pipeline = OrderFlow(start=payment_flow)
|
43
|
-
|
44
|
-
# Create shared data structure
|
45
|
-
shared_data = {
|
46
|
-
"order_id": "ORD-12345",
|
47
|
-
"customer": "John Doe",
|
48
|
-
"items": [
|
49
|
-
{"id": "ITEM-001", "name": "Smartphone", "price": 999.99, "quantity": 1},
|
50
|
-
{"id": "ITEM-002", "name": "Phone case", "price": 29.99, "quantity": 1},
|
51
|
-
],
|
52
|
-
"shipping_address": {
|
53
|
-
"street": "123 Main St",
|
54
|
-
"city": "Anytown",
|
55
|
-
"state": "CA",
|
56
|
-
"zip": "12345",
|
57
|
-
},
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
# Run the entire pipeline asynchronously
|
62
|
-
async def main():
|
63
|
-
await order_pipeline.run_async(shared_data)
|
64
|
-
|
65
|
-
# Print final status
|
66
|
-
print("\nOrder processing completed!")
|
67
|
-
print(f"Payment: {shared_data.get('payment_confirmation')}")
|
68
|
-
print(f"Inventory: {shared_data.get('inventory_update')}")
|
69
|
-
print(f"Shipping: {shared_data.get('pickup_status')}")
|
70
|
-
|
71
|
-
|
72
|
-
if __name__ == "__main__":
|
73
|
-
asyncio.run(main())
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{agentic_blocks-0.1.19 → agentic_blocks-0.1.20}/src/agentic_blocks.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|