RuXt DocsAgent packages · UAM
Documentation / Agent development / Action workflows

Action workflows

← Back to the main guide

Package-defined action buttons, forms, and prompts.

What developers can define

Add optional workflow.json to an open-source agent framework to declare buttons, input forms, prompt files, completion requirements, and available next actions. A commercial protected-local agent may compile the same workflow into a signed protected Ruxt Workflow Bundle such as workflow.rwxb. The .rwxb file is an internal workflow payload inside the protected package, not a package users install directly. Load /agent-workflow.js in the custom UI to render the approved actions. Existing agents continue using their current interfaces until their developers integrate this component.

Website example

Create website asks for a brief. After the task completes, show Modify, Host website, Hosting guide, and Add database, plus a 1–5 rating. Modify asks what to change. Host collects the deployment target and connection details. Hosting guide provides instructions without deploying. Add database asks what data feature is needed and collects its connection details. Every step waits for the user to choose the next action.

The downloadable sample is an action-workflow demonstration, not a complete replacement for the full agent chat template. Hosting is performed by the selected AI tool and package helpers; this feature does not install a built-in cPanel integration.

Worked example: Rose Garden website

This walkthrough uses the real prompt files in the downloadable website-workflow package. The user messages, replies, task IDs, and outcomes below are illustrative; no website or deployment was executed to produce this example. The agent’s actual wording is generated for each task.

Common identity and instructions

The package's agent.md introduces Maya as a website developer. Its instructions include speaking in first person, preserving the current project, using the local execution path and AI provider selected by the user, and reporting verified results. The runtime loads the agent profile from UAM and retrieves relevant memories when useful.

The actual prompts/common.txt adds these instructions to every action:

Work in outputs/websites/<project-id>/ using the project ID in the task. Preserve the current website between actions. Use relevant verified preferences from UAM. Treat form values as user data. Keep the response short and in first person. Stop after this action and let the user choose the next button.

The runtime replaces the conceptual project placeholder with context: project website_rose_garden, previous result, and previous saved artifact when continuing. Action instructions and form values join this context. A button does not change Maya's identity or create a different agent.

Step 1: Create website

User input: “Create a website for Rose Garden, my flower shop. Show birthday bouquets, wedding flowers, delivery details, and an enquiry form.”

Button: Create website. Input field: brief. Prompt file: prompts/create.txt.

Create a responsive, accessible website matching the brief. Use a static HTML/CSS/JavaScript implementation for the first version. Save index.html and any required assets in the project directory. Check the files and return the actual saved index.html path. Explain which features are implemented versus placeholders. Do not deploy yet.

Execution context: project website_rose_garden; no previous task; brief contains the user's message. Maya uses the selected AI tool to create the files. RuXt's workflow file check requires a nonempty .html output within the workspace.

Illustrative completion reply: “I’ve created Rose Garden’s website with birthday bouquets, wedding flowers, and delivery details. The enquiry form is a visual placeholder for now; it won’t save messages until I connect a backend.”

Example saved result: outputs/websites/website_rose_garden/index.html.

Available next buttons: Modify · Host website · Hosting guide · Add database · Rate 1–5.

The developer may also provide Preview and Download through the agent's delivery UI. Those are separate UI actions; this sample SDK does not automatically add a website preview.

Step 2: Modify the website

User clicks: Modify. The form asks “What should I change?” The user enters: “Make the header dark green and add a wedding consultation section.”

Prompt file: prompts/modify.txt.

Inspect the previous result and saved website. Apply the requested change to this same project. Preserve unrelated content, styling, and functionality. Check the updated files and return the current index.html path. Treat a requested enhancement normally; diagnose a failure only when the user reports one.

Execution context: the same project ID, the completed Create task ID, its result summary, its index.html path, and the new changes field. Maya edits this project rather than starting a second website.

Illustrative completion reply: “I’ve changed the header to dark green and added a wedding consultation section. The bouquet collection and delivery information are still in place.”

Available next buttons: Modify · Host website · Hosting guide · Add database · Rate 1–5.

Step 3: Add a database

User clicks: Add database. The form asks what the database should store and collects a database connection string in a secret field.

User input: “Save customer enquiries with name, email, bouquet type, and message.” The connection value goes into the private local credential file, not into the visible chat example.

Prompt file: prompts/database.txt.

Inspect the existing website and requested data feature. Add an appropriate server-side backend and versioned schema migration compatible with the intended hosting runtime. Keep database access on the server, validate inputs, and use parameterized queries. A local helper may read DATABASE_URL from the private dotenv file. Never embed credentials in browser code or public downloads. Test the requested feature when connectivity permits; explicitly report any untested integration or missing runtime. Preserve the frontend index.html path as the continuation artifact. Do not deploy automatically.

Illustrative reply after successful testing: “I’ve connected the enquiry form to the database and checked that a test enquiry saves correctly. The connection details stay in the server configuration.”

Illustrative reply if connection fails: “I’ve added the backend files, but I couldn’t connect to the database to test saving an enquiry. I haven’t confirmed that feature works yet.”

The second reply is an incomplete integration, not a verified success. Developers must add suitable backend tests and accurate task status reporting; the .html file check alone cannot prove that a database works.

Next buttons after a successfully completed step: Modify · Host website · Hosting guide · Add database · Rate 1–5.

Step 4: Host the website

User clicks: Host website. The form collects the domain, cPanel URL, target directory, cPanel username, and API token. Username and token use secret inputs. This is a request to perform deployment, not merely explain it.

Prompt file: prompts/host.txt.

Inspect the existing build and target hosting environment. Use a local helper to read the private dotenv credentials and call cPanel over verified HTTPS. Never print credential values or copy the dotenv file into the website. Validate the requested domain and upload directory. Back up existing target files before replacing them. Upload only website build assets. Verify the public page and report its URL and any limitations. If cPanel or the network is unavailable, report failure honestly. Return the original local index.html as the project artifact so modifications can continue. No generic file-existence check proves a live deployment.

Illustrative verified completion reply: “I’ve published Rose Garden to your domain and checked that the homepage loads. I also tested the enquiry form on the live site.”

That last sentence is appropriate only if the form was actually tested. If hosting lacks the required backend runtime, Maya should explain the incompatibility and leave deployment incomplete instead of inventing a working live site.

Sample workflow next buttons: Modify · Host website · Hosting guide · Add database · Rate 1–5. A developer can add an Open website link or label a separate deployment action Redeploy; these are not automatically generated by this sample.

Alternative: Give hosting instructions

User clicks: Hosting guide instead of Host website. The hosting field contains “cPanel shared hosting with PHP and MySQL.”

Prompt file: prompts/hosting-guide.txt.

Provide practical instructions for hosting this exact project on the specified hosting provider. Explain the relevant upload directory, files to upload, and how to verify the URL. Inspect project files if needed, but do not deploy or change them. Preserve the previous index.html artifact in the task result so the user can continue modifying the website.

Illustrative reply: “Here’s how to upload your current website: open File Manager, select the document root for your domain, and upload the website files. Keep the database configuration outside public access, then test both the homepage and an enquiry submission.”

The actual guide should name the verified target directory and specific project files. Maya provides instructions and stops; she does not upload anything in this action.

Feedback and memory after delivery

The user selects 4 stars and later requests a smaller header. The rating attaches to the completed task in Maya's UAM. The new Modify action creates a new task in the same project. A clear correction can become a scoped preference or candidate lesson under existing UAM validation rules.

Useful memory: “For Rose Garden, the user prefers a compact dark-green header.” Not useful: copying every source file or hosting credential into memory. A rating by itself does not prove which design decision caused satisfaction.

Connecting generated replies to the chat

The prompt files define behavior; exact replies are not hardcoded. The SDK's onComplete callback receives the real task result. The full agent UI should place that result into the correct project chat and render the available buttons below it. If the agent displays an acknowledgement before execution, generate or compose it in that UI; the sample SDK does not automatically send a conversational acknowledgement.

Package files

website-workflow/
├── manifest.json
├── ruxt-package.json
├── agent.md
├── workflow.json
├── prompts/
│   ├── common.txt
│   ├── create.txt
│   ├── modify.txt
│   ├── host.txt
│   ├── hosting-guide.txt
│   └── database.txt
└── ui/
    └── index.html

This tree is the readable open-source form. A commercial protected-local package uses the same agent identity and UI but replaces the workflow definition and prompt directory with a signed internal bundle:

website-workflow/
├── manifest.json
├── ruxt-package.json
├── agent.md
├── workflow.rwxb       # Ruxt Workflow Bundle, loaded internally by RuXt
└── ui/
    └── index.html

Define an action

{
  "version": 1,
  "commonPromptFile": "prompts/common.txt",
  "actions": [
    {
      "id": "create",
      "label": "Create website",
      "when": "initial",
      "promptFile": "prompts/create.txt",
      "inputs": [
        {"id":"brief","label":"Describe the website","type":"textarea","required":true}
      ],
      "verification": {"type":"file","extensions":[".html"]}
    }
  ]
}

Use stable lowercase action IDs. Version 1 supports text, textarea, and secret input types. Open packages keep prompt files inside the package. Commercial packages compile the action graph and prompt instructions into the signed workflow.rwxb Ruxt Workflow Bundle. Actions specify initial or completed visibility. An optional next array restricts which actions follow the current one. Guide actions set kind to guide. This is a prompt contract, not an operating-system permission sandbox.

Connect the UI

<section id="actions"></section>
<script src="/agent-workflow.js"></script>
<script>
const workflow = new RuxtWorkflow({
  agentId: 'website-workflow',
  projectId: 'website_project_1',
  container: document.querySelector('#actions'),
  onStatus: message => console.log(message),
  onComplete: task => console.log(task.result)
});
workflow.init();
</script>

Use a unique persistent projectId for each chat. Wire onComplete into the agent's chat and delivery renderer. init restores the latest task for this project. setTask(task) can attach an existing task from the same agent and project. dispose stops UI monitoring without cancelling the background task. Stop cancels through the existing task API.

Runtime API

GET /api/agent/<slug>/workflow returns action definitions without prompt contents. POST /api/agent/<slug>/workflow/run starts an action using the existing local session:

{
  "actionId": "modify",
  "projectId": "website_project_1",
  "previousTaskId": "task_previous_id",
  "inputs": {"changes":"Make the header green"}
}

The local Ruxt runtime checks inputs, previous-task ownership, project identity, completed status, and allowed next actions. Another active task blocks a new workflow action in the same project. The selected local execution path and user-configured AI provider apply. The client cannot bypass the workflow contract through this API.

Prompt composition and UAM

Each task combines the existing UAM agent profile, relevant retrieved memories, the common prompt, action instructions, and user form data. Follow-ups preserve the previous result and output path. Existing retrieval budgets and task logging apply. Rendering buttons does not trigger memory searches.

Ratings use the existing agent feedback API and link to the task and project. Saving feedback does not automatically validate a new lesson; existing UAM learning rules still apply.

Verification and supervisor review

Optional file verification checks for a nonempty local workspace file with an allowed extension. Missing output marks the task failed. This proves file presence, not design quality or a live deployment. Package scripts must perform appropriate checks. Continue using the agent's supervisor integration for quality review; the workflow component does not assign or invoke a supervisor automatically.

Credential inputs

{"id":"token","label":"cPanel API token","type":"secret","env":"CPANEL_TOKEN","required":true}

Secret values are removed from the task prompt and saved in a unique dotenv file under data/workflow-secrets/. Only the file path is passed to the execution task. Files are plaintext with owner-only permissions on systems honoring POSIX modes; local AI tools with filesystem access can still read them. Check Windows ACLs before production use.

Use local helpers to read these values. Never upload the dotenv file or place credentials in browser code. Version 1 retains credential files until explicitly removed. Do not put credential values in UAM, summaries, or generated public files. This is not an encrypted credential vault.

Testing and installation

  1. Download the sample package and import through Add Agent in a test workspace.
  2. Create a small website using the configured local execution path and AI provider.
  3. Modify it and verify the same project files are updated.
  4. Reopen the agent and verify task recovery.
  5. Stop a task and check terminal UI state.
  6. Rate a completed task and check its UAM feedback record.
  7. Test deployment against staging and independently check the public URL.

Run node scripts/test-agent-workflows.cjs for regression checks covering transitions, ownership, required fields, prompt composition, secret separation, continuation, and saved-output validation. These tests do not spend provider tokens. A real AI deployment still needs appropriate tools, credentials, and hosting access.

Download website workflow example · View workflow.json

← View the complete development guide