Feature Request: Workflow-as-Code support for AI-assisted workflow development
Feature Request: Workflow-as-Code support for AI-assisted workflow development
Background
FastGPT already provides powerful visual workflow orchestration, OpenAPI-based invocation, and detailed runtime diagnostics such as detail=true, flowNodeStatus, flowResponses, and plugin output data.
However, the development loop for complex workflows still depends heavily on manual dashboard operations:
- Design or generate workflow JSON outside FastGPT
- Manually import or update the workflow in the dashboard
- Manually run full workflow tests
- Inspect runtime diagnostics
- Modify the workflow JSON
- Repeat the process
This makes AI-assisted workflow engineering possible, but not yet fully automatable.
Pain Point
For complex workflows, especially those involving code nodes, dataset search, conditional branches, workflow tools, and pluginModule calls, developers need a repeatable loop:
draft import → validation → test run → diagnostics → iteration → publish / rollback
Currently, runtime diagnostics are available during chat execution, but there does not appear to be an official API/CLI contract for headless workflow draft import, validation, test execution, diagnostics export, and publishing.
Proposed Direction
It would be valuable for FastGPT to provide an official Workflow-as-Code API or CLI layer.
Possible capabilities could include:
- Export current workflow configuration
- Import workflow JSON as a draft without affecting production
- Validate workflow JSON before import or publish
- Run a test case against a draft workflow
- Return structured diagnostics such as node status, runtime errors,
flowResponses, plugin output, and updated variables - Publish a validated draft
- Roll back to a previous version
The exact endpoint naming, authentication scope, permission model, and edition support should be decided by FastGPT maintainers.
Why This Matters
This would enable a complete AI-assisted workflow development loop:
- Plan: AI reads requirements and current workflow structure
- Do: AI generates or patches workflow JSON
- Check: FastGPT runs the draft and returns structured diagnostics
- Act: AI fixes the workflow based on runtime evidence and repeats the test
This would improve developer experience for complex FastGPT workflows, reduce manual dashboard operations, and make workflow development more suitable for CI/CD and professional engineering environments.
Security and Permission Considerations
This feature should be designed with explicit permission boundaries. For example:
- Limit workflow import/publish to users with app owner or admin permissions
- Use scoped API tokens for workflow development operations
- Separate draft import from production publish
- Keep dangerous actions such as publishing and rollback auditable
- Consider private deployment and professional developer use cases first
External Experiment
I have been experimenting with an external FastGPT agent skills pack to explore workflow JSON generation, validation, debugging, migration, and runtime log analysis:
https://github.com/watsonctl/fastgpt-agent-skills
The experiment suggests that the missing piece is not workflow generation itself, but an official headless contract for importing, validating, testing, diagnosing, and publishing workflows.
I would be happy to help contribute documentation, minimal workflow JSON examples, or a proposal for the API/CLI contract if the maintainers think this direction is aligned with FastGPT.
Hi, I'm interested in contributing to this feature.
I've reviewed the codebase and the workflow dispatch layer looks well-structured for adding a headless API contract. The WorkflowNodeResponseSink already separates draft-time response recording from SSE emission, which maps naturally onto the import-validate-test-publish lifecycle you described.
Before diving into implementation, I'd like to confirm a few things:
- Is this feature on the roadmap for an upcoming release, or is it exploratory?
- For the "test a draft headlessly" endpoint, would you prefer it reuses the existing workflow dispatch engine (
packages/service/core/workflow/dispatch/index.ts), or is a lighter-weight evaluation path preferred? - Any preference on the API shape — REST with versioning under
/api/v1/workflows/draft/..., or extending existing app endpoints?
Happy to put together an API contract proposal first for review before writing code.
Thanks @Ultronen for the careful read of the dispatch layer — that is exactly the right seam to be looking at.
To your first question: this direction is no longer exploratory on my side — I have already implemented it end-to-end as an external Workflow-as-Code toolchain. The experiment repo referenced in the issue body has since grown into a published skill pack:
https://github.com/watsonctl/fastgpt-agent-skills
The pack covers the full draft → validate → test → diagnose → iterate lifecycle:
fastgpt-workflow-generator— AI-assisted drafting of workflow JSON from requirements, grounded in import-verified canonical examples rather than blind generationfastgpt-workflow-debug— headless, structured diagnostics over real runs:flowNodeStatus,flowResponses, plugin output, updated variablesfastgpt-workflow-migration— workflow export, version migration and cross-instance syncfastgpt-ts-node-host-adapter/fastgpt-python-host-adapter— host adapters that bind the skills to a live FastGPT instance, closing the loop against real runtime behaviorfastgpt-shared— shared assets, including import-verified canonical examples
A note on the implementation shape: because this toolchain lives outside the FastGPT core, the adapters drive the loop through the instance's existing external surface (app APIs + runtime diagnostics) rather than internal dispatch internals — which is consistent with the argument in the issue that "the missing piece is not workflow generation itself, but an official headless contract." Your instinct that WorkflowNodeResponseSink cleanly separates draft-time recording from SSE emission is correct, and it maps naturally onto the diagnostics model the debug skill consumes.
If you or the maintainers decide to pursue an official headless API/CLI layer, I would be glad to contribute the contract-level learnings from this external implementation (including the rough edges we had to work around) and to review your API contract proposal against a toolchain that has already driven this loop end-to-end. Either way, thanks for volunteering to pick this up.
Thanks for the writeup @watsonctl. Came here to build a wheel, turns out you'd already built the car. 😅
Since you've got this working end-to-end already, and the actual blocker is whether maintainers want this in core, I'll step aside instead of sitting on the issue.
Moving over to #7113. Ping me if these two ever collide.