Workflows in Polymuse
Install the desktop app, run the supplied project, then add a function of your own. The sample uses Python for statistics and TypeScript for reporting.
Run the sample
- Download Polymuse for Windows x64 and open the app. Choose Create sample project on the welcome screen and select a folder.
- Open Services and locate or install Graftcode Gateway. Start the Python and TypeScript modules if needed. When both are running, their methods appear in the function library.
- Open
transaction-analysisfrom Workflows and select Run. The default data should produce one unusual value and a LOW score of 8.3. Explore the calculation.
Build with Muse
Muse is the assistant built into the app. Describe what you want in plain words and it writes the functions, tests each one, wires them into a workflow and runs it. You can watch every step and take over at any point.
- Open Muse from the welcome screen (Describe what you want) or press Ctrl+Shift+A in a project.
- The first time, choose Set up Muse. Pick a provider preset (OpenRouter, DeepSeek, Groq or Ollama) or Custom for any OpenAI-compatible endpoint, enter the model name and your API key, then select Save and test. The model must support tool calling.
- Describe the result you want, for example
convert these temperatures to Fahrenheit and show a table
. Muse creates a project if none is open. - When it finishes, the workflow is open on the canvas. Change an input and press Run, or select Review on the changes card to see every line it wrote. Undo turn restores all of it.
- Auto-edit
- Muse writes files on its own. Deleting files and running commands still ask first. This is the default.
- Ask before edits
- Every file change waits for Allow or Deny.
- Your key
- Stored encrypted with the operating system's secure storage and used only by the app's main process. Requests go straight from your machine to the provider you chose.
Build a workflow app
Ask for an app and Muse builds all of it in one go: the functions, the workflow that connects them and a screen to use it on. The screen has a form for the values you type, a Run button and the results, drawn as tables, charts or interactive plots.
- Describe the app and what it should show, for example
a loan calculator: I enter amount, rate and years, show the monthly payment and a chart of the balance over time
. - Watch the plan, the functions and the blocks appear. Muse tests every function, runs the whole workflow, then opens the app.
- Change a value and press Run. Some apps re-run on their own when an input changes.
- Select Edit workflow to see the blocks behind the app, or the full-window button to hide the rest of the IDE. Ask Muse for changes in plain words (
add a field for extra payments
) and it updates the same app.
Any workflow can be used this way: select App in the canvas toolbar, or choose Open workflow as an app from the command palette (Ctrl+K). Input blocks become the form and output blocks become the results. The app is saved inside the workflow file, so it opens the same way next time.
Build a full-stack web app
For a real web app, with pages, an API and a database, describe it or paste a spec. Muse builds it in apps/<name>/ inside your project and runs it. The front end is React and TypeScript, the API is Express and the data is stored in SQLite. Everything runs on one port and reloads as the code changes.
- Describe the app, for example
a habit tracker: habits with a name and a daily check-off, a page that shows this week as a grid, and a streak count
. A longer spec works too: Muse follows it. - Muse plans the tables, API routes and pages, then creates the app and installs its packages. It asks before installing anything beyond the starter.
- It builds the back end and calls every route to check the answers. Then it builds the pages and loads them in a hidden browser, where it fills in forms and clicks buttons and reads the result. It fixes any errors it finds before telling you the app is done.
- The app opens in a Preview tab. Use it there, select Browser to open it in your own browser, or Log to read the server output. Ask for changes in plain words and the preview reloads.
Use your workflows as the back end
An app can call the workflows in its project instead of keeping its logic in the server code. Its back end is then the blocks on your canvas, in any mix of languages, and you can open and change it there. Ask Muse for it (make a web app that scores payments with my transaction-analysis workflow
) or call a workflow yourself:
import { runWorkflow } from "./workflows.js";
api.post("/score", async (req, res) => {
const run = await runWorkflow("transaction-analysis", { values: req.body.amounts });
res.json({ risk: run.outputs.risk_out });
});- Inputs are keyed by input block id and outputs by output block id. To get a ready-made call for the open workflow, choose Copy this workflow's API call in the command palette.
- The page can also call a workflow directly with
POST /api/workflows/<name>and a body of{ "inputs": { … } };GET /api/workflowslists every workflow's inputs and outputs. A wrong input name gets a 400 that lists the right ones, and a failed run gets a 422 that names the block that failed. - Every call shows up in the Run trace, labelled
[API name]. - These routes work only while Polymuse runs the app, because Polymuse runs the workflows. It hands the app a private address and token, so other programs on your computer can't trigger runs.
Without Muse
- Choose New full-stack app from the command palette (Ctrl+K) and give it a name. Polymuse writes a small working starter and opens its page and Preview.
- Select Run in the Preview. The first time, Polymuse runs
npm install; then it startsnpm run dev. - Edit the code. Changes to the server restart it, and changes to the page reload the Preview. Next time, start the app from the palette with Run app: <name>.
| File | What goes there |
|---|---|
server/api.ts | API routes, served under /api. Return JSON; send errors with a status and a message. |
server/db.ts | Tables, created on start. The database is a single file in data/. |
server/workflows.ts | runWorkflow(name, inputs): calls the project's workflows (while Polymuse runs the app). |
src/App.tsx | The page. Split it into components under src/ as it grows. |
src/api.ts | Typed helpers the page uses to call the API. |
It's an ordinary Node project, so it doesn't need Polymuse to run. In its folder, npm run dev starts it, and npm run build followed by npm start runs the production build. It needs Node 22 or newer. Only the workflow routes need Polymuse.
Build without Muse
Muse is optional. Everything it does, you can do yourself with the same tools, and you can switch between the two at any point.
- Create a module. Choose New module in Services (or Ctrl+Shift+N), pick a language and a name. Polymuse writes a template: one class whose public static methods become functions.
- Write a function. Open the module file from the explorer and add a method. Give every parameter a type so the canvas knows what to ask for. Lists and objects travel as JSON text: declare them as strings and parse them inside the method.
- Save. Polymuse rebuilds the module and restarts its Gateway. A green status in Services means its functions are in the library. If it fails, open Gateway output for the error.
- Make a workflow. Choose New workflow, drag functions from the library onto the canvas, add Input blocks for your values and an Output block to show the result.
- Connect and run. Drag from an output port to a parameter, set any fixed values in the inspector, then press Run (Ctrl+Enter). Select a node to see what it received and returned.
Return a list of labelled objects, such as [{"month": "Jan", "sales": 120}], and the Output block draws a chart or a table you can switch between. A Python function that returns a Plotly figure's fig.to_json() draws an interactive plot. The next sections walk through each step on the sample project.
Expose a Python function
In the sample project, open modules/python-analytics/analytics.py. Add the following method inside the existing Analytics class. Its parameter annotation gives the Gateway a numeric input to expose.
@staticmethod
def double(value: float) -> float:
return value * 2Save the file. Watch the Python module restart in Services, then find double in the function library. Add it to the canvas, set its input to 21 in the inspector and run the node. Its output should be 42.
Connect inputs
Drag an output port onto a downstream input. The wire makes the second node wait for the first node’s result. If several sources could supply the parameter, the engine uses this order.
- Connected output
- A wire supplies the upstream value, even when a literal is saved on the receiving node.
- Literal value
- With the wire removed, the inspector value takes effect. The sample uses a literal threshold of 2 for outlier detection.
- Parameter default
- When neither a wire nor a literal supplies the input, the engine uses the function default if one exists. A missing required value fails the node.
Debug a run
The run trace records execution in order. Select the first failed node and compare its resolved inputs with its function signature before changing downstream nodes.
- The run never starts
- Open Problems and check the graph for cycles, dangling connections or conflicting input edges. Fix the structural error and run again.
- A node is blocked
- Follow its incoming wires to the failed dependency. Independent branches can still finish, which can leave the overall run marked Partial.
- A function is missing
- Check its module in Services. Open Gateway output to inspect build or startup errors. Once the module is serving, check the function library again.
Project files
A desktop project is a folder. Open the folder containing polymuse.json to return to its modules and saved graphs.
polymuse.json
modules/
python-analytics/analytics.py
typescript-transforms/src/transformations.ts
workflows/
transaction-analysis.polymuse.json
statistics-pipeline.polymuse.jsonThe manifest records each module’s language and entry point. The workflow JSON records its node references, wires, literal values and canvas layout. Edit a module to change a calculation. Edit a workflow to change which calculations run together.
Runtime requirements
A project can contain modules in all seven supported languages. Each gets its own Gateway, so you can restart a module and read its logs independently. Expand a language for its template and toolchain requirements.
PythonPython interpreter
Add typed static methods to the module. The template includes the project metadata used for discovery.
TypeScriptNode.js
Polymuse compiles your source with esbuild and writes the declaration file the Gateway uses to discover exports.
JavaScriptNode.js
Export the module class. The desktop build generates its companion declarations for the Gateway.
JavaJDK with javac and jar
The build preserves parameter names and packages the classes in a versioned JAR.
C#.NET SDK
The template builds a .NET assembly. The SDK supplies the compiler for the build step.
PHPThread-safe PHP on Windows
The template pairs a namespaced class with Composer autoload metadata.
RubyRuby interpreter
Define class methods in the generated Ruby module and start its Gateway from the Services view.