Inspiration
Agent workflows are usually reviewed after they have already become code, prompts, and framework-specific configuration. At that point, important decisions such as branching, tool use, approval gates, parallel work, retries, and failure paths are scattered across files and difficult to understand as one system.
I built GraphContract because I wanted humans and coding agents to agree on agent behavior before implementation—not debug that agreement afterward.
What it does
GraphContract is a human-governed planning layer for agent systems. It gives a person and a coding agent a shared visual canvas where they can design, review, revise, and freeze an agent workflow as a structured contract.
A user can start from a blank canvas or a reusable workflow pattern. A coding agent reads the currently accepted graph through WebMCP and proposes a structured revision. GraphContract renders that candidate separately, shows what was added, changed, or removed, and keeps the accepted graph locked until the human decides what happens next.
The human can inspect the proposal, request changes, approve it, or reject it. Once the contract is accepted, GraphContract derives deterministic branch scenarios, lets the user inspect each route on the canvas, freezes the reviewed contract, and exports implementation handoff artifacts.
The canvas supports typed Start, Task, Agent, Tool, Human, Merge, End, and Subgraph structures; normal, conditional, command, fallback, bounded-loop, and dynamic Send ×N routing; human-in-the-loop gates; sensitive-effect policies; deterministic scenarios; and a read-only runtime projection.
How WebMCP powers the collaboration
GraphContract deliberately exposes exactly three browser-native WebMCP tools:
- get_graph reads the accepted contract, its revision identity, validation state, and outstanding human feedback.
- propose_graph_changes submits typed operations against a known revision and produces a review-only candidate.
- get_branch_scenarios reads the deterministic paths derived from the accepted graph.
The small tool surface is intentional. The agent can inspect and propose, but it cannot approve, reject, freeze, unfreeze, answer human gates, control runtime execution, or download artifacts. Those actions remain visible and human-owned in the interface.
This is where WebMCP adds real value. A graph has stable identities, topology, validation rules, revisions, and authority boundaries. Asking an agent to infer those from screenshots or cursor coordinates would be fragile. WebMCP lets the agent work with the graph as structured data while the website remains the source of truth and the place where consequential decisions are made.
How I built it
The application is built with React, TypeScript, React Flow, Zustand, and Zod. React Flow powers the canvas, Zustand manages the local workspace and proposal lifecycle, and Zod enforces schema and migration boundaries. The public application is deployed on Netlify with a custom domain.
I also created a portable GraphContract skill published from the website. A browser-capable coding agent can discover the skill, learn the inspect → propose → review → revise → freeze → handoff lifecycle, and then use the three WebMCP tools consistently.
Codex helped throughout the project: researching real agent patterns, shaping the domain model, implementing the canvas and proposal workflow, debugging browser behavior, and building the test library. I used Vitest and Testing Library for domain and component contracts, plus Playwright journeys that exercise the real page-registered WebMCP tools in a cold browser.
Challenges I faced
The hardest part was not drawing nodes. It was keeping the experience truthful under human–agent collaboration.
I needed one accepted graph and a separate proposal candidate; atomic validation without silently repairing agent input; deterministic scenarios that remain bounded around loops and dynamic parallelism; and runtime observations that never become editable design truth. I also had to keep the interface understandable while representing nested subgraphs, human gates, Merge reducers, Send ×N workers, and multiple routing modes.
Accomplishments I am proud of
- A complete human–agent planning lifecycle instead of a single tool-call demo.
- Structured proposals that never mutate accepted state before human approval.
- Clear visual diffs with request-changes, approval, and rejection flows.
- First-class human approval gates, sensitive effects, conditional routing, fallback paths, bounded loops, nested structures, Send ×N, and Merge.
- Deterministic scenario review and downloadable graph, scenario, and Python path-test handoffs.
- A reusable agent skill and a deliberately narrow WebMCP authority boundary.
What I learned
The best human–agent interfaces do not simply maximize agent authority. They make authority legible. WebMCP is especially powerful when it exposes the smallest structured surface an agent needs while leaving validation, review, and consequential actions visible to the person.
I also learned that a visual graph can be more than documentation. With stable identities, typed edges, revision checks, scenarios, and explicit approval state, it can become a negotiated contract between human intent and agent implementation.
What's next
Next I want to generate framework-specific implementations from frozen contracts, add repository-linked contract diffs in CI, accept trusted runtime events so live execution can be highlighted against the frozen graph, and expand the library with more source-backed agent patterns.
Built With
- ai
- netlify
- react
- typescript
- vitest