A Python framework for dynamically crafting and managing multi-step API workflows with conditional logic and user prompts.
- Visual and code-based workflow designer supporting conditional branching
- Real-time API chaining and data aggregation
- Built-in user prompt system allowing external data or decisions to modulate workflow execution
pip install -e .from interaction_fabric.workflow import Workflow
from interaction_fabric.api_client import APIClient
from interaction_fabric.prompts import UserPrompt
api_client = APIClient()
workflow = Workflow([
{
'step': 'get_user',
'action': lambda ctx: api_client.get('/users', params={'id': ctx['user_id']}),
'next': lambda result, ctx: 'ask_continue' if result['active'] else 'end',
},
{
'step': 'ask_continue',
'action': lambda ctx: UserPrompt.ask('Continue with workflow?'),
'next': lambda result, ctx: 'process_data' if result else 'end',
},
{
'step': 'process_data',
'action': lambda ctx: api_client.post('/process', json=ctx['user_data']),
'next': 'end',
},
{
'step': 'end',
'action': lambda ctx: print('Workflow ended'),
}
])
workflow.run({'user_id': 42})To launch the visual workflow designer:
from interaction_fabric.visualizer import launch_designer
launch_designer()You can drag and drop steps, define conditional branches, and preview real-time execution.
Feel free to open issues or submit PRs for bugs, features, or improvements.