Skip to content

Create Workflows with the AI Studio CLI

Use the CLI bundled with AI Studio Skill to create a workflow definition (.wf), configure nodes and connections, and validate the definition from your project directory. You can review the file in source control before saving it as a draft in AI Agent Studio.

Set up the CLI

Install AI Studio Skill and use the Node.js runtime required by your version of the skill. From the project root, define a shell function for the bundled script and check the installed version. If the skill is installed outside your project, replace the script path with its installed location.

aistudio() { node .agents/skills/aistudio/scripts/aistudio.js "$@"; }
aistudio version
aistudio --help

Use aistudio <command> --help to check the options in your installed version. The example uses a standalone project with a src/workflows/ directory. In an AI Studio app package project, omit --layout legacy, use --app-package and --modulename to resolve ambiguity as needed, and use the file path returned by the create command.

Use AI Studio Skill in a coding assistant

AI Studio Skill gives a coding assistant the instructions and workflow references it needs to turn a request into a .wf file. The assistant calls the bundled CLI from the project root to create, configure, and validate the workflow.

  1. Get the AI Studio Skill from Oracle's repository for your release. In an existing project, place the complete aistudio folder under .agents/skills/ so SKILL.md, references/, and scripts/ stay together. The Oracle starter repository already includes the skill in that location. Oracle's Codex setup guide
  2. Open the project root in Codex. In the Codex CLI or IDE extension, type $ and select aistudio, or use /skills to find it. If it doesn't appear, check for .agents/skills/aistudio/SKILL.md and restart Codex. Codex skill discovery and invocation
  3. Describe the workflow's inputs, processing steps, and expected output. If the project has multiple app packages, name the target package. If that package has multiple modules, name the target module. Specify whether the work is local or includes saving and debugging a draft in a Fusion environment.

Example prompt

Paste this prompt into the Codex CLI or IDE extension to build the supplier status workflow from this guide:

$aistudio Create a local workflow named Supplier Status Example with code
SUPPLIER_STATUS_EXAMPLE in the Procurement family (PRC), product OTHER.
Use a Code node with fictional data for supplier SUP-1001 with status Active.
Connect it to a Return node that outputs "Supplier SUP-1001 is Active."
The workflow has no input parameters. Keep this task local.
Validate the workflow with the bundled CLI and report the .wf path and validation result.

Review the generated workflow file, its node connections, and the validation result. When you're ready to test it in Fusion, follow Save and debug a draft in Fusion.

For another coding assistant, use its skill discovery and invocation conventions. If it accepts file references, point it to .agents/skills/aistudio/SKILL.md and ask it to use the bundled CLI with the project root as its working directory.

Create a supplier status workflow

This workflow returns the status of a fictional supplier. A Code node supplies sample data and a Return node formats the response. It needs no business object, model call, or input parameters.

flowchart LR
    start([Start]) --> sample[Code<br/>Get Sample Supplier]
    sample --> result[Return<br/>Return Supplier Status]

1. Create the workflow file

Use list-workflow-families and list-workflow-products --family PRC to discover valid family and product codes. The example uses the Procurement family (PRC) and the OTHER product. Choose a unique workflow code before saving to a shared environment, where the code identifies the draft.

aistudio do-create-workflow \
  --layout legacy \
  --name "Supplier Status Example" \
  --workflow-code SUPPLIER_STATUS_EXAMPLE \
  --family PRC \
  --product OTHER

wf=src/workflows/supplier_status_example.wf

The CLI creates the Start and End nodes. If the CLI reports that it could not load a default model because the environment is unconfigured, you can continue with this example. Configure an environment when you need to select a model for an LLM node or run the workflow in Fusion.

2. Add the Code and Return nodes

Set the JavaScript source and return type in the Code node metadata. The runtime makes the returned object available at $context.$nodes.GET_SAMPLE_SUPPLIER.$output.result. The Return node references fields from that object in its returnValue input. Keep the JSON arguments in single quotes so the shell preserves the dollar signs in the expressions.

aistudio do-create-node \
  --file "$wf" \
  --type CODE \
  --name "Get Sample Supplier" \
  --code GET_SAMPLE_SUPPLIER \
  --metadata-patch '{"sourceCode":"return { supplierNumber: \"SUP-1001\", status: \"Active\" };","returnType":"object"}'

aistudio do-create-node \
  --file "$wf" \
  --type RETURN \
  --name "Return Supplier Status" \
  --code RETURN_SUPPLIER_STATUS \
  --inputs-patch '{"returnValue":"Supplier {{$context.$nodes.GET_SAMPLE_SUPPLIER.$output.result.supplierNumber}} is {{$context.$nodes.GET_SAMPLE_SUPPLIER.$output.result.status}}."}'

3. Connect and validate the nodes

Use the node codes to define the execution order. Connect Start to the Code node, then connect the Code node to Return. Return completes the workflow with the supplied value.

aistudio do-modify-node-edges \
  --file "$wf" \
  --changes '[
    {"action":"add","from":"START","to":"GET_SAMPLE_SUPPLIER"},
    {"action":"add","from":"GET_SAMPLE_SUPPLIER","to":"RETURN_SUPPLIER_STATUS"}
  ]'

aistudio do-prettify-workflow --file "$wf"
aistudio validate-workflow --file "$wf"

do-prettify-workflow arranges the nodes for the canvas. validate-workflow checks expressions, references, and schemas in the file. Review validation errors by node code, use do-modify-node to correct a node, and validate again. For supported mutation commands, add --dry-run to preview the diff before writing it.

Save and debug a draft in Fusion

Configure env.properties for the target Fusion environment using the setup instructions for your AI Studio Skill version. For an OAuth-configured environment, run aistudio authenticate, then use aistudio whoami to confirm the account. Keep tenant credentials and tokens out of source control.

aistudio do-save-workflow --file "$wf"
aistudio run-workflow \
  --file "$wf" \
  --workflow-status DRAFT \
  --message "Show the sample supplier status"

do-save-workflow creates or updates the remote draft and refreshes the local file with the server's saved definition. If the remote draft is newer, review it before updating it. run-workflow runs the saved draft in the configured environment. The sample uses fixed data, so the message can be any text. The expected workflow response is:

Supplier SUP-1001 is Active.

For a workflow that defines input parameters, pass them with --parameters as a JSON object or with --parameters @parameters.json. Use Testing, Monitoring, and Performance to inspect runtime behavior and build test coverage. When the workflow is ready for users, open it in AI Agent Studio and follow the publishing steps.