Pathway VM - declarative workflow execution engine for AI agents
Project description
Pathway Engine
Declarative workflow execution engine for AI agents.
Installation
pip install pathway-engine
With LLM providers:
pip install pathway-engine[openai]
pip install pathway-engine[anthropic]
pip install pathway-engine[all-llm]
Quick Start
from pathway_engine import Pathway, LLMNode, TransformNode, Connection, PathwayVM, Context
# Define a pathway
pathway = Pathway(
id="greeting",
name="Greeting Pipeline",
nodes={
"greet": LLMNode(
id="greet",
prompt="Write a friendly greeting for {{name}}",
model="gpt-4o",
),
"format": TransformNode(
id="format",
expr="greet.response.upper()",
),
},
connections=[
Connection(from_node="greet", to_node="format"),
],
)
# Execute
ctx = Context(tools={}) # Add tools as needed
vm = PathwayVM(ctx)
result = await vm.execute(pathway, inputs={"name": "World"})
print(result.outputs)
Core Concepts
Pathway
A directed graph of nodes that defines a workflow.
Nodes
Compute units that process data:
- LLMNode - Call language models
- ToolNode - Execute tools/functions
- TransformNode - Transform data with expressions
- RouterNode - Route to different paths based on conditions
- GateNode - Binary if/else routing
- MemoryReadNode / MemoryWriteNode - Persist state
- EventSourceNode - Stream events (timers, webhooks)
- AgentLoopNode - Agentic tool-use loops
Connection
Data flow between nodes.
Context
Runtime services injected into the VM:
ctx = Context(
tools={
"search.web": my_search_handler,
"workspace.read": my_file_handler,
},
memory=my_memory_store,
extras={"custom": "services"},
)
PathwayVM
Executes pathways:
vm = PathwayVM(ctx)
result = await vm.execute(pathway, inputs={"key": "value"})
Streaming
Built-in event sources for reactive workflows:
from pathway_engine import EventSourceNode, WEBHOOK_BUS
# Timer-based
timer = EventSourceNode(
id="tick",
source="timer.interval",
config={"seconds": 60},
)
# Webhook-based
webhook = EventSourceNode(
id="events",
source="webhook.listen",
config={"topic": "my-events"},
)
# Publish to webhook
WEBHOOK_BUS.publish("my-events", {"data": "hello"})
Packs & Triggers
Organize pathways into deployable packs:
from pathway_engine import Pack, Trigger, pack_builder
@pack_builder
def my_pack():
return Pack(
id="my-pack",
name="My Pack",
pathways={"main": my_pathway},
triggers=[
Trigger(
id="on-webhook",
source="webhook.my-topic",
pathway="main",
),
],
)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pathway_engine-0.1.0.tar.gz.
File metadata
- Download URL: pathway_engine-0.1.0.tar.gz
- Upload date:
- Size: 112.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b6f686c1bf65e476992fdb3c904e7be7a6fde5f41132bda38a753564abccc29
|
|
| MD5 |
8f10056db66255343c8a96212cb6eed3
|
|
| BLAKE2b-256 |
3323c7a79da71c46e922f40f3d176b3dde04545ca167c1334f883a5751bc0751
|
File details
Details for the file pathway_engine-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pathway_engine-0.1.0-py3-none-any.whl
- Upload date:
- Size: 156.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5ba4331d6eebb79f6105d0e2d4581773a3dd7666a68d1c9caec671fa306cde9
|
|
| MD5 |
17b38284098c3882710d50ff4d6c2b49
|
|
| BLAKE2b-256 |
0728d5ce3571cdb3498741752cbae21fba8e15f792a0087aab39290f40fc3154
|