0g-workflows

Stripe-style payouts + LangChain-style workflows, enforced on-chain

0g-workflows

Created At

Open Agents

Project Description

Today, agent-based systems are built as loosely connected pipelines with no guarantees around execution, coordination, or payment. This project introduces a new primitive: on-chain workflows where agents execute step-by-step and are paid per successful execution.

Developers can compose workflows from independent agents, where each step defines its expected input/output types and cost. These workflows are enforced by smart contracts, turning what is normally off-chain orchestration into a verifiable on-chain execution graph. Each workflow run becomes a stateful instance that progresses deterministically from one step to the next.

Payments are natively integrated into execution. Each step is priced, and funds are routed through a protocol treasury that only releases payment when a step successfully completes. This tightly couples computation with incentives, ensuring agents are economically aligned with correct execution.

The system uses a modular architecture with a Diamond-based execution layer, allowing agents to be upgraded or extended without breaking existing workflows. A lightweight off-chain worker triggers execution for each step, enabling asynchronous workflows while preserving on-chain guarantees for state and payments.

Looking forward, this system can integrate directly with 0G’s storage and compute layers, enabling decentralized execution, persistent data storage, and a marketplace of specialized agents. Contributors can publish agents, have them composed into workflows, and earn per execution, forming an open ecosystem of composable, economically aligned automation.

How it's Made

The system is built in Solidity using Foundry and deployed on the 0G EVM testnet, with a modular architecture centered around a Diamond (EIP-2535-style) execution layer. The Diamond acts as a routing layer, delegating execution calls to different agent implementations while maintaining a unified interface.

Agents conform to a shared execution interface (IAgentExecution), allowing heterogeneous agent logic to be composed into workflows. An Agent Registry contract manages agent discovery and validation, while a Workflow Registry and Factory define and instantiate workflows.

Each workflow is deployed as a WorkflowInstance contract, which acts as a state machine. It stores execution state, validates step transitions, and processes each step sequentially. Every step specifies an agent, input/output types, and a cost, with type compatibility enforced on-chain to ensure deterministic execution.

User identity is represented using an ERC-721–compatible NFT model, which links to a UserStateLedger contract for tracking balances and workflow participation. This separates identity from mutable state and allows composable user-level interactions across workflows.

Economic coordination is handled by a ProtocolTreasury contract, which escrows funds and releases payments per step only after successful execution. This enforces a pay-per-step execution model and removes reliance on off-chain payment trust.

Execution is hybrid: workflow state, validation, and payments are enforced on-chain, while a Node.js worker monitors contract state and triggers step execution. This allows asynchronous workflows and integration with external systems.

Deployment and orchestration are handled via Foundry scripts, including full system deployment, agent registration, workflow creation, and execution initiation. A bootstrap script generates and funds wallets to simulate multi-agent interactions during testing.

background image mobile

Join the mailing list

Get the latest news and updates

0g-workflows | ETHGlobal