Skip to content
Fluxify
alpha · expect changes

ai harness · alpha

Agents that build on the same canvas you do.

The AI gateway is a multi-agent harness inside the editor. Describe a route or change; it plans, asks before acting, then produces blocks, edges and settings that pass the same schemas and graph rules as anything you draw by hand.

Honest scope: the harness builds and edits Fluxify resources. There is no LLM block inside running flows today — a route calls a model the way it calls any API, through HTTP Request or a JS block with an npm SDK.

agent architecture

A state graph of narrow agents.

Each agent does one job and hands state to the next. Independent tasks run in parallel; a supervisor reviews every result before the orchestrator moves on.

harness graph StateGraph · @langchain/langgraph apps/ai-gateway/src/harness/graph.ts
  1. 1 Router

    router

    Classifies the request and checks it's buildable. Unbuildable requests end here, with a reason.

    • → discussion · question
    • → planner · multi-part build
    • → taskGenerator · single-target build
    • → end · rejected
  2. 2a Discussion

    discussion

    Answers questions about your project or the platform.

    • → end
  3. 2b Planner

    planner

    Writes a plan and can stop for your decision.

    • → humanInTheLoop · needs approval
    • → taskGenerator · plan ready
  4. 2c Human in the loop

    humanInTheLoop

    Pauses the run. Approve resumes at the task generator, review re-enters at the router, reject ends the run.

    • → end · waits for you
  5. 3 Task generator

    taskGenerator

    Breaks the plan into tasks; can hand a too-big fast-path request back to the planner once.

    • → orchestrator
    • → planner · escalate
  6. 4 Orchestrator

    orchestrator

    Dispatches every ready task at once with LangGraph Send; when nothing is left, hands off to the summarizer.

    • Send ×3 → builders
    • → summarizer · all tasks done
  7. 5 Builders (in parallel)

    blockBuilder · routeConfig · customBlockConfig

    Blocks and edges validated against each block's schema and output handles, cycle-checked; route method, path and schemas; custom-block params.

    • → supervisor
  8. 6 Supervisor

    supervisor

    Checks each builder's result.

    • ↺ orchestrator
  9. 7 Summarizer

    summarizer

    Reports what changed.

    • → end
Durable runs
Runs travel on a NATS JetStream work queue: they survive a gateway restart, replicas share one consumer, and each run is handled once.
Validated output
The block builder checks every block against its schema, enforces output handles and rejects cycles before anything reaches the canvas.
Budgets
A 10-minute wall clock and a 2M-token ceiling per run (both configurable) catch runaway loops. Usage is tracked per agent.

tool calling

Tools that read your project, not the internet.

Agents ground themselves with read-only tools over the docs and the current project. Tool loops are bounded by a per-model iteration limit.

Everything a tool returns is fenced as untrusted data before it enters model context, and anything the model emits that the editor acts on is validated server-side.

  • search_docs Semantic search over the Fluxify docs, embedded locally with all-MiniLM-L6-v2 — no embedding API calls.
  • get_route_details Reads a route's settings and current canvas from the project.
  • find_resource Looks up routes, workflows, integrations, app config keys and custom blocks by name.
  • get_artifact Fetches a draft the harness produced earlier in the run.
  • get_agent_output Reads another agent's result inside the same run.
  • get_custom_block_schemas The parameter contracts of the project's custom blocks.

model routing

Your model, your keys.

Each project picks an AI integration in its settings; the harness resolves the provider and model from it. Keys stay in the server config — nothing is read from the environment or hardcoded.

  • OpenAI native tool calling · JSON mode fallback
  • Anthropic native structured output
  • Google Gemini native structured output
  • Mistral JSON mode fallback
  • OpenAI-compatible any server with an OpenAI API and a base URL

structured outputs

Typed answers, defended in depth.

Agents return zod-validated objects. Constrained decoding is the first line of defence; the parser is the net.

structured output strategy
// harness/models/base.ts — how a typed answer is obtained
// 1. Anthropic / Gemini: provider-native structured output (json_schema)
// 2. OpenAI · OpenRouter · Mistral: response_format = { type: "json_object" }
//    Ollama: format = "json"
// 3. Then, defensively:
//    - read text from content blocks / reasoning fields, never assume a string
//    - unwrap a quoted, escaped JSON payload before parsing
//    - slice the first *balanced* JSON value (string-aware brace counting)
//    - validate with zod; schemas use .nullish() so a model's null passes
//    - re-ask up to 3 times, as a user turn — never end a request on an
//      assistant or system message

in your workflows

Where AI meets the canvas today.

What the harness produces is ordinary Fluxify: routes, workflows and custom blocks that compile like hand-built ones.

01

Build

Ask for a route or a change in the editor's AI panel. The plan is shown for approve / review / reject before anything is written.

02

Discuss

Questions about your project or the platform go to the discussion agent, grounded in the docs index and your resources.

03

Call models from flows

Use HTTP Request or a JS Runner with an npm SDK to call any model API inside a route or workflow — it's just another upstream.