Tools

AgentRun Open-Source: Breaking Agents into Workflows Cuts Inference Costs by 80%

Parcha-ai has open-sourced a DSL that automatically converts agent execution traces into deterministic workflows, eliminating the need to pay for full LLM reasoning on steps that don't need it.

Font size

Parcha-ai has open-sourced AgentRun on GitHub, and it hit the Hacker News front page on day one. The core idea can be stated in one sentence: instead of having designers draw a workflow diagram first and then forcing the agent to follow it, AgentRun flips the process. Let the agent run, collect the traces it leaves behind, and have the DSL extract a deterministic workflow from that mess.

In other words, AgentRun doesn't chase full agent autonomy; it pushes back against running an agent loop for steps that don't need one.

The Real Problem AgentRun Solves

Over the past year, I've watched too many agent demos: throw GPT-4o at a problem, let it improvise, burn a few thousand tokens per run, most of which gets spent on "thinking about whether to call a tool." The result:

  • A single task costs tens of cents. Run it 1,000 times and you're out several hundred dollars.
  • The same input produces a different result on the next run.
  • When something breaks, you're left staring at a wall of tool-call logs, guessing intent.

AgentRun's contrarian stance is stated in the first paragraph of its README: "figure out which parts can become a workflow." Which steps are stable enough to escape the agent loop and run on their own? Those steps shouldn't trigger another round of LLM inference every time.

Four Node Types: Tool Calls / Code / System One / Agent

AgentRun's DSL breaks nodes into four categories. The key insight isn't "yet another agent framework." It's that the DSL admits a truth most frameworks ignore: not every step needs an LLM.

# From AgentRun's README
# A simplified version of a research workflow
from agentrun import AgentRun, ToolCall, Code, SystemOne, Agent

flow = AgentRun(
    nodes=[
        ToolCall(
            name="split_question",
            description="Break a research question into sub-questions",
            deterministic=True  # No LLM call, rule-based splitting
        ),
        Code(
            name="filter_subquestions",
            script="""
                # Keep only sub-questions that need deep investigation
                return [q for q in subquestions if q.depth > 2]
            """
        ),
        SystemOne(
            name="evidence_router",
            description="Jev-powered routing: deterministic relevance checks on evidence"
        ),
        Agent(
            name="deep_researcher",
            model="claude-sonnet-4.5",
            prompt="You are a senior researcher. Provide in-depth answers based on the sub-questions."
        )
    ],
    edges=[
        ("split_question", "filter_subquestions"),
        ("filter_subquestions", "evidence_router"),
        ("evidence_router", "deep_researcher")
    ]
)

Two node types deserve a closer look:

  • Jev-powered system one decisions: deterministic routing and evidence filtering that never calls an LLM. Take "is this search result relevant to the current sub-question?" That kind of judgment is perfectly served by embedding similarity plus a few rules; there's no reason to spin up a large model for it. Most workflow tools miss this capability. LangGraph lets you draw the graph, Dify wires up the LLM, but neither tells you which nodes shouldn't have an LLM attached in the first place.
  • Code nodes: run Python or Rust directly, with no LLM pass-through. Perfect for pure data processing, format conversion, and filtering.

Tool calls and full agents are familiar territory, so I'll skip the recap.

Traces Feeding Back Into the DSL: The Key Design

The most surprising piece of AgentRun's design is its reverse loop:

  1. Let an agent run a batch of tasks freely.
  2. The agent leaves traces and retro notes behind.
  3. A harness analyzes those traces and identifies which sub-steps are stable enough.
  4. Those stable steps are automatically promoted into deterministic workflow nodes.

From the README: "uses the traces and retro notes agents leave behind to figure out which parts can become a workflow."

That is bottom-up workflow generation.

A comparison with traditional approaches:

Approach Flow Pain Point
Traditional workflow (e.g., LangGraph) Designer draws the graph → writes code → runs → debugs Every flow change means rewriting
Traditional agent loop Let the LLM plan everything Expensive, slow, opaque
AgentRun Agent runs free → traces feed back → automatic stabilization Fast to start, converges over time

Last year I built a customer-service triage workflow on LangGraph, and just the three nodes of "intent classification → routing → response template selection" took me two weeks to tune. AgentRun's approach would have skipped the "draw the graph" step entirely; you just let an agent run 100 times and see what's actually stable.

The Cost Math: Which Steps Are Worth Stabilizing

Take a research workflow as an example (the same one from the README):

Full agent loop handling 10 sub-questions:

  • Each loop iteration: system prompt + tool definitions + history + output ≈ 8k input tokens
  • 10 iterations = 80k tokens
  • At Claude Sonnet 4.5 pricing (~$3/1M input), that's $0.24 per task just for input

After splitting into a workflow:

  • Split sub-questions: Code node, a few lines of Python ≈ 500 tokens
  • Filter sub-questions: pure rules, 0 tokens
  • Evidence routing: System One (embedding), ≈ 200 tokens
  • Run full agent on only 3 deep sub-questions: 3 × 8k = 24k tokens ≈ $0.072

Savings ≈ 70%. That lines up with the "80%" figure floating around Hacker News, assuming your sub-question filter is aggressive enough to cut at least half the steps. A loose filter won't save you much.

Where It Stands in the Agents vs. Workflows Debate

The DSL implies a hybrid architecture.

A quick look back at the last two years:

  • Late 2023 to 2024: all-in on agents. With the "AGI is next year" optimism running high, agents were supposed to handle everything, and workflows felt like a relic.
  • Starting in 2025: the pendulum swung back toward workflows. Anthropic made a point of discussing "cost control for computer use" in the Claude Sonnet 4.5 launch, and the LangChain team has publicly conceded more than once that "pure agents don't hold up in production."
  • AgentRun is practical evidence, not theory: it doesn't take sides. It says "look at your traces and decide."

I think that's the right posture. Any binary either/or approach hits a wall in real engineering.

Editor's Take

The reason AgentRun is more interesting than LangGraph or Dify comes down to one thing: it generates workflows bottom-up from traces, rather than top-down from a designer's whiteboard.

LangGraph's state graphs are elegant, but you have to know up front how many intent categories exist and how to route each one. In practice, those category boundaries only emerge after an agent has processed thousands of real queries. AgentRun's design philosophy is "let it run wild first, then extract order from the chaos." It's an attempt to transplant the machine-learning playbook into the orchestration layer.

A contrarian prediction: the agent framework gold rush may peak in 2026. Developers are exhausted by "yet another orchestration framework." Tools that come with a "cost ledger" and a "reverse loop," like AgentRun, have a better shot at breaking through, because they don't compete on DSL elegance; they compete on saving you money.

What's different this round: this isn't another drag-and-drop workflow editor. It admits a hard truth: good workflows aren't designed; they're discovered.

Where I'm still uncertain: the DSL learning curve looks shallow (only four node types), but the trace-to-workflow harness is a black box. You can't tell when it'll decide a step is "stable enough" to harden. For complex business processes, such as the layered approval chains in financial compliance, I'm skeptical. The notion of "deterministic" in those domains is fuzzy to begin with, and hardcoding it tends to backfire.

But if you're already burning cash on agent loops in production, it's worth spending an afternoon cloning the repo and kicking the tires.

Source: https://github.com/Parcha-ai/agentrun