agentrun README

The project's README from github.com/Parcha-ai/agentrun. As one markdown file: README.md.

agent.run()

Add Jev-powered workflows to your agents.

AgentRun is a workflow language for the agents you already run. Define repeatable steps, use Jev for focused decisions, and call an agent when the work needs investigation. Your application keeps its tools, model access, permissions, and budgets.

Quickstart · Packages · Documentation · Examples · Pi extension · Agent instructions

Support workflow: search for an answer, check it with Jev, and return it or ask an agent to investigate. Check the investigation before returning it or escalating for review.

View the static diagram · Run this example

The support example below follows this workflow with scripted tools and model responses.

Quickstart

Requires Node 22.19+ and npm. In your project:

npm install @parcha/agentrun-dsl@beta
npx agentrun demo

This ticket-routing demo uses scripted decisions and needs no API key. Next, run and change a workflow in your own app. To run the support workflow shown above, use the checkout below. To build workflows with your agent, install the Pi extension.

Run the support example

To run the workflow in the animation, clone the examples and build:

git clone --branch main --single-branch https://github.com/Parcha-ai/agentrun.git
cd agentrun
# With nvm: nvm install && nvm use
npm ci --ignore-scripts
npm run build
npm run demo:support

This runs the interpreter with scripted tools, Jev answers, and agent responses. It needs no API key and sends no customer replies.

The command prints a report for each case:

Request Agent calls Decision calls Result
Reset a password 0 1 Return the help answer
Find an invoice 0 1 Return the help answer
Investigate a failed payment 1 2 Return the investigation answer
Payment still unresolved 1 2 Escalate for review
npm run demo:support -- payment
npm run test:support

Try npm run demo:support -- unresolved to see an escalation. It exits with code 2. The responses are scripted; changing a prompt does not change them.

Connect live Jev and your agent, or give these instructions to your coding agent.

Use one piece, or all of it

Use one piece

Each package works on its own. Install the ones you need.

Package What it does What it needs First command with no key Status
@parcha/agentrun-dsl Define, validate, inspect and run workflows Node 22.19+ npx agentrun demo published (@beta)
@parcha/agentrun-jev Jev typed decisions as a workflow's runJudge the DSL; TYPESAFE_API_KEY for live calls its README's offline test published (@beta)
@parcha/agentrun-pi The /agentrun Pi extension and a Pi-backed node runner Pi 1.1.0; a model for live runs; pi-durable for its ./durable entry /agentrun demo in Pi (scripted, no model calls) published (@beta); the ./durable entry is in this repository, not yet in the published beta
@parcha/pi-durable-disk Run a pi-durable agent on a network disk: one owner per run, a fence, a supervisor pi-durable and chord; an Archil account, a disk and an API key none yet published (@beta)
@parcha/pi-browser A browser for pi agents: crash-safe session custody, evidence with SHA-256, typed failures pi-durable and chord; a provider (a local Chrome needs no key, Browserbase needs its key) its README's no-key command not yet published; a release publishes it
@parcha/pi-vision Eyes for pi agents: documents, images, scans and video within the model's limits, a receipt for every look nothing for a document's text; Photon or sharp for images; pi-durable, chord and pi-ai in pi; a model that looks, for questions about a file its README's first read not yet published; a release publishes it
@parcha/pi-transport Boxes for pi agents: one interface over a directory, a container, a sandbox or a VM pi-durable and chord; Docker for the Docker provider the "A box" example in its README (needs Docker) held, not published

A held package is built, tested and verified with the others, and its manifest says "private": true; it installs from a packed tarball, not from npm.

Use all of it

One program puts the packages together and runs a job end to end on pi-durable: a durable run, the recovery driver, the node runner, the browser and vision. It uses a scripted model and a fake browser, needs no key, and prints the record and the receipts it cites.

npm ci --ignore-scripts
npm run build
npm run demo:reference

examples/reference/ has the job and the code. What a host supplies lists the seven functions the packages ask a host for, the install order and why, and what the example does not do yet.

What a workflow looks like

The support workflow requires answer text and a source reference. Jev must also answer yes with confidence of at least 0.8. Otherwise, the workflow allows one agent attempt and checks again. If the answer still fails those checks, it escalates for review. You choose the criteria and thresholds for your task.

These are the search and decision nodes from that workflow:

{
  node: 'call', label: 'find-answer', via: 'tool',
  tool: 'help.search', args: { request: '{request}' },
  out: 'Candidate', as: 'answer', deadline_s: 10,
},
{
  node: 'judge', label: 'check-existing-answer',
  state: { request: '{request}', answer: '{answer}' },
  out: 'Fit', as: 'fit',
}

Candidate and Fit refer to schemas in the workflow. Fit defines the question and its yes, no, and uncertain criteria. Code reads the decision and its confidence to choose the next step. Read the complete definition, including the agent and review path.

Write workflows as JSON or use the TypeScript builder and Zod contracts. The builder infers input and output types. The interpreter checks intermediate state paths at runtime. Workflows can call other workflows, map work in parallel, and run bounded loops.

Connect your application

Install the core and Jev adapter in your application with npm install @parcha/agentrun-dsl@beta @parcha/agentrun-jev@beta. Then:

  1. Supply adapters. Connect tools through runEffect, your existing agent through runNode, and Jev decisions through createJevRunner() as runJudge.
  2. Define and test the workflow. Write its schemas, steps, thresholds, and review path. Start with fixtures, then evaluate real decisions on labeled cases from your task.
  3. Give your agent a workflow tool. Register a function that calls runWorkflow as one of your agent's tools. Handle the workflow's output, escalation, and errors.

The support integration guide has a config template and live command. Live Jev calls need TYPESAFE_API_KEY from the TypeSafe dashboard, separate from your coding-agent login. Workflows without Jev decisions do not need that key. See host integration for permissions, cancellation, and recovery.

Use it in Pi

With Pi 1.1.0 installed, run these commands in your project:

pi install npm:@parcha/agentrun-pi@beta -l
pi --offline

-l installs in this project; --offline skips startup downloads. Pi asks whether you trust the project before loading its extension. No AgentRun checkout is needed.

Once Pi has model access, ask it to build a workflow:

/agentrun Research how this repository handles cancellation. Investigate the runtime and tests separately, then report gaps with file references.

Pi uses the packaged skill to build, inspect, and run the workflow. Run /reload if you install into an open Pi session. Use /agentrun save <name> and /agentrun load <name> for project-local definition revisions. Saves contain neither run input nor execution permission. Pi setup and limits.

More examples

Example What it demonstrates
Support answers Search, Jev checks, optional investigation, review fallback
Research a decision Nested workflows, parallel research, evidence selection, report writing
Rank a list A reusable workflow: Jev scores, code sorts and applies quotas, duplicates are dropped, long lists split themselves
Standalone TypeScript starter Install the packages in your own app; search and screen evidence

Research demo

From the built checkout, run a scripted research workflow: "Should our team move its docs from a wiki into the code repository?"

npm run demo
npm run eval:research

It plans subquestions, researches them in parallel, screens evidence, and writes a report. The evaluation checks six labeled cases with scripted responses. Connect real Jev and Pi models.

Packages, status, and contributing

Package Responsibility
@parcha/agentrun-dsl Define, validate, inspect, and execute workflows
@parcha/agentrun-jev Connect Jev typed decisions
@parcha/agentrun-pi Pi extension and agent runner
@parcha/pi-durable-disk Run pi-durable agents on a network disk (Archil): one owner per run, a fence, and a supervisor
@parcha/pi-browser A browser for pi agents: crash-safe session custody, evidence with SHA-256, typed failures (not yet published)
@parcha/pi-vision Eyes for pi agents: documents, images, scans and video within the model's limits, typed misses, a priced receipt for every look (not yet published)
@parcha/pi-transport Boxes for pi agents: one small interface over a directory, a container, a sandbox or a VM, providers for this machine and Docker, a strict config, and a conformance suite a vendor can run (not yet published)

This release is 0.1.0-beta.4. See the changelog and contracts and limits.

Ordinary functions may be enough for a fixed sequence. AgentRun stores the steps in a workflow document that you can inspect, rerun, or call from an agent. Code nodes execute JavaScript with process privileges; untrusted workflow authors require a host-controlled sandbox. Typed decisions and validated output shapes do not prove that an answer is factually correct.

For development setup and checks, see Contributing. Open an issue for bugs or proposals.

Code and documentation use Apache-2.0. Copyright 2026 Parcha Labs, Inc. Dependencies retain their own licenses. Built by Grep.ai.

agentrun (Parcha-ai/agentrun)

Searching Database…

这是什么?AgentRun 是一个工作流 DSL,能为你已经在用的智能体加上结构化、可重复的步骤:它用 Jev 来做聚焦的是/否判断,只有在确实需要深入调查时才会调用你的智能体,而你的应用仍然保留自己的工具、模型访问权限、权限设置和预算。
这是一个工具,还是一组独立的包?它是一族围绕核心 DSL 构建的独立 npm 包:@parcha/agentrun-dsl(定义/运行工作流)、@parcha/agentrun-jev(类型化判断)、@parcha/agentrun-pi(Pi 扩展),以及用于持久化执行、浏览器操作和文件处理的 pi-durable-disk、pi-browser、pi-vision 和 pi-transport。你只需要安装工作流用到的那些。
怎么才能把一个工作流跑起来?装有 Node 22.19+ 和 npm 的话,运行 'npx agentrun demo' 就能体验脚本化的工单路由示例;或者在你的应用里安装 '@parcha/agentrun-dsl@beta' 和 '@parcha/agentrun-jev@beta',用 runEffect 接入你的工具,用 runNode 接入你的智能体,用 createJevRunner() 作为 runJudge 来接入 Jev 判断。
试一试需要 TypeSafe 的 API 密钥吗?不需要,快速上手和演示命令完全运行在脚本化的工具和预设的 Jev/智能体响应上,无需任何密钥。只有当你接入真实的 Jev 判断时,才需要从 TypeSafe 控制台获取真正的 TYPESAFEAPIKEY。
运行别人写的工作流安全吗?默认并不安全:工作流的代码节点会以宿主进程自身的权限执行任意 JavaScript,所以不可信的工作流作者需要一个由宿主控制的沙箱。另外要注意,通过类型检查或置信度阈值并不保证答案真的正确。
目前哪些包是真正可用的?DSL、Jev 适配器和 Pi 扩展已经以 @beta 形式发布到 npm。pi-browser 和 pi-vision 已构建但尚未发布,pi-transport 处于'搁置'状态——和其他包一起做过测试,但只能通过私有 tarball 安装,不在 npm 上。
这里的 Jev 到底是什么?Jev 是一个类型化的判断服务,工作流调用它来做聚焦的是/否/不确定判断,并附带置信度分数;比如客服示例中,就要求给出置信度不低于 0.8 的'是',否则才回退到智能体。
AgentRun 是怎么和 Pi 编码智能体连接的?安装 @parcha/agentrun-pi 会给 Pi(1.1.0+)添加一个 /agentrun 扩展,让你可以在 Pi 会话内构建、查看、运行、保存和加载工作流,比如 '/agentrun demo' 或 '/agentrun run',无需检出代码。
工作流可以组合或并行运行吗?可以,工作流可以调用其他工作流、把任务并行映射到多个条目上,还可以运行有界循环,除了客服示例里展示的分支/升级逻辑之外都是支持的。
我怎么定义一个工作流?工作流可以用纯 JSON 编写,也可以用基于 Zod 契约的 TypeScript 构建器编写,后者能自动推断输入和输出类型;解释器会在运行时检查中间状态路径。
Creator
Parcha-ai
Size
17.8 MB
Stars
240
Updated
CommitOct 17
Age
24d
Commits · 90 Days