# Reasonflow

> SDK-first agent orchestration framework. Build LLM pipelines as DAGs with >> chaining, parallel() branches, and 4 node types (LLM, Code, Decision, MCP). Auto cost/token tracking, budget enforcement, retries, JSON traces, and CLI. Supports OpenAI, Anthropic, Google, and Ollama.

- **Type:** MCP server
- **Install:** `agentstack add mcp-kosminus-reasonflow`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [kosminus](https://agentstack.voostack.com/s/kosminus)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [kosminus](https://github.com/kosminus)
- **Source:** https://github.com/kosminus/reasonflow

## Install

```sh
agentstack add mcp-kosminus-reasonflow
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# ReasonFlow

SDK-first, MCP-native agent orchestration framework.

```python
from reasonflow import DAG, LLMNode, CodeNode, DecisionNode, parallel

@CodeNode
def step1(state):
    return {"greeting": f"Hello, {state['name']}!"}

@CodeNode
def step2(state):
    return {"upper": state["greeting"].upper()}

dag = DAG("hello")
dag.connect(step1 >> step2)
result = dag.run(name="World")
print(result["upper"])  # HELLO, WORLD!
```

## Install

```bash
pip install reasonflow
```

## Setup

Copy `.env.example` to `.env` and add your API keys:

```bash
cp .env.example .env
```

Supports cloud providers (OpenAI, Anthropic, Google) and local models via Ollama — use model names like `ollama/llama3` in `@LLMNode(model=...)`.

## Features

- 4 node types: `LLMNode`, `MCPNode`, `CodeNode`, `DecisionNode`
- `>>` operator for DAG construction
- `parallel()` for concurrent branches
- Automatic cost/token tracking per node
- Built-in retries with error-type awareness
- MCP-native tool integration
- JSON execution traces
- CLI: `reasonflow run`, `reasonflow trace`
- Debug mode: `--debug` flag, `DAG(debug=True)`, or per-node `.debug()`

## Examples

```bash
# Research pipeline — parallel branches + LLM synthesis
reasonflow run examples/research_pipeline.py -v topic="AI safety"

# Multi-model debate — 3 LLMs argue in parallel, judge synthesizes
reasonflow run examples/multi_model_debate.py -v question="Should we adopt microservices?"

# Email drafter — bullets → LLM draft → LLM review → save
reasonflow run examples/email_drafter.py -v recipient="Engineering" -v subject="Q1 Update"

# Code reviewer — git diff → LLM code review → saved report
reasonflow run examples/code_reviewer.py -v repo_path="."

# CSV analyzer — parse CSV + compute stats → LLM insights
reasonflow run examples/csv_analyzer.py -v csv_path="data.csv"

# Git changelog — git log → LLM-generated release notes
reasonflow run examples/git_changelog.py -v repo_path="."

# Web scraper — fetch URL → strip HTML → LLM summary
reasonflow run examples/web_scraper_summarizer.py -v url="https://example.com"

# Log analyzer — read logs → grep errors → LLM categorize
reasonflow run examples/log_analyzer.py -v log_path="/var/log/system.log"

# Health check — parallel system checks → DecisionNode → alert/report
reasonflow run examples/health_check.py

# Test runner — pytest → DecisionNode → LLM failure analysis
reasonflow run examples/test_runner.py -v test_path="tests/"

# Process manager — ps/grep/kill via CodeNodes
reasonflow run examples/process_manager.py

# Run & analyze — execute a Python script → LLM analyzes output
reasonflow run examples/run_and_analyze.py

# Docker cleanup — parallel inventory → decide → prune (dry-run default)
reasonflow run examples/docker_cleanup.py

# Debug mode — see each node's output
reasonflow run examples/process_manager.py --debug
```

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [kosminus](https://github.com/kosminus)
- **Source:** [kosminus/reasonflow](https://github.com/kosminus/reasonflow)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-kosminus-reasonflow
- Seller: https://agentstack.voostack.com/s/kosminus
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
