Skip to main content
6 min read

stackgen ai

stackgen ai

Use stackgen ai to manage Aiden resources and Knowledge Hubs from the CLI. You can apply kinded YAML manifests, get or delete resources, list kinds, run workflows, trigger webhooks, inspect session artifacts, and manage Knowledge Hub documents.

Usage​

stackgen ai [command]

Available commands​

CommandDescription
applyCreate or update Aiden resources from kinded YAML
deleteDelete an Aiden resource by kind/name or from a manifest file
getGet an Aiden resource by kind/name or from a manifest file
knowledgeUpload documents to an Aiden Knowledge Hub and check ingestion status
listList Aiden resources of a kind. Alias: ls
runRun an Aiden workflow as workflow/<name> with --input key=value pairs
sessionInspect Aiden sessions and download artifacts
webhookTrigger an Aiden webhook by ID and optionally wait for the run
workflowRun Aiden workflows and optionally wait for completion

Flags​

FlagDescription
-h, --helpHelp for ai.

Global flags​

See Global flags for --project, --workspace, --output, --interactive, --log, --stackgen-home, and other options.

Kinded YAML apply​

Click to view

Apply kinded YAML manifests (apiVersion + kind) to Aiden.

Supported kinds: Agent, Workflow, Runbook, Skill, Policy. Documents are applied Policy first, then Agent / Runbook / Skill, then Workflow. Use Kubernetes-style --- separators to pack multiple resources in one file. Optional --values renders manifests and *File includes with Go text/template.

stackgen ai apply [flags]
FlagDescription
--approveApprove Workflow or Runbook versions after upsert
--dry-runValidate and normalize without calling Aiden APIs
-f, --filename stringArrayManifest file or directory (repeatable)
-R, --recursiveRecurse into directories passed to -f
--values stringYAML values file for Go text/template rendering
-h, --helpHelp for apply

Examples

stackgen ai apply -f workflow.yaml
stackgen ai apply -f ./manifests/ --recursive --approve
stackgen ai apply -f agent.yaml -f runbook.yaml --dry-run
stackgen ai apply --values values.yaml -f common.yaml -f observe-uber-triage.yaml --dry-run

Get, list, and delete​

Click to view

get​

stackgen ai get [kind/name] [flags]
FlagDescription
-f, --filename stringManifest file (uses kind + metadata.name)
-o, --output stringOutput format: yaml or json (default yaml)
-h, --helpHelp for get
stackgen ai get workflow/observe-rabbitmq-backlog-rca
stackgen ai get -f workflow.yaml -o yaml

list​

stackgen ai list <kind> [flags]

Aliases: list, ls

stackgen ai list workflow
stackgen ai list agent

delete​

stackgen ai delete [kind/name] [flags]
FlagDescription
-f, --filename stringManifest file (uses kind + metadata.name)
-h, --helpHelp for delete
stackgen ai delete workflow/observe-rabbitmq-backlog-rca
stackgen ai delete -f agent.yaml

Run workflows​

Click to view

stackgen ai run​

stackgen ai run workflow/<name> [flags]
FlagDescription
--input stringArrayWorkflow input as key=value (repeatable)
-h, --helpHelp for run
stackgen ai run workflow/observe-rabbitmq-backlog-rca --input queue=orders --input vhost=/

stackgen ai workflow run​

Start a named Aiden workflow and print run_id, trace_id, and session_id. Use --wait to poll until the execution completes or fails.

stackgen ai workflow run <name> [flags]
FlagDescription
--input stringWorkflow input message (required). Use @<path> to read the message from a file (max 1 MiB). Use @@… to send a literal message that starts with @
--metadata stringArraySource metadata as key=value (repeatable)
--poll durationPoll interval when --wait is set (default 5s)
--session-id stringOptional existing session ID for shared context
--timeout durationMax time to wait when --wait is set (default 30m0s)
--version int32Optional preferred workflow version
--waitWait until the workflow execution completes or fails
-h, --helpHelp for run
stackgen ai workflow run observe-rabbitmq-backlog-rca --input '{"queue":"orders"}'
stackgen ai workflow run observe-rabbitmq-backlog-rca --input hi --wait --timeout 30m
stackgen ai workflow run observe-rabbitmq-backlog-rca --input hi --metadata alert_id=a1 --version 2
stackgen ai workflow run observe-rabbitmq-backlog-rca --input @./alert.spine.input.json

After a successful wait, list or download artifacts with session artifacts.

stackgen ai webhook trigger​

Trigger a named Aiden webhook by ID. StackGen login (JWT) is required, and so is the webhook token. Prefer an env var so the secret is not stored in shell history.

--wait polls until dispatch yields a session and the matching execution completes or fails. --wait is supported for agent and workflow targets only (not app-forward targets). If --data and --data-file are omitted, the trigger body is {}.

stackgen ai webhook trigger <webhook-id> [flags]
FlagDescription
--token stringWebhook token (required). Prefer --token "$WEBHOOK_TOKEN"
--data stringRaw trigger payload
--data-file stringRead trigger payload from a file (mutually exclusive with --data)
--waitWait until the resulting execution completes or fails
--poll durationPoll interval when --wait is set (default 5s)
--timeout durationMax time to wait when --wait is set (default 30m0s)
-h, --helpHelp for trigger
stackgen ai webhook trigger <webhook-id> --token "$WEBHOOK_TOKEN"
stackgen ai webhook trigger <webhook-id> --token "$WEBHOOK_TOKEN" --data '{"alert":"disk"}'
stackgen ai webhook trigger <webhook-id> --token "$WEBHOOK_TOKEN" --data-file ./payload.json --wait --timeout 30m

After a successful wait, list or download artifacts with session artifacts.

Session artifacts​

Click to view
stackgen ai session artifacts [command]

list​

stackgen ai session artifacts list <session-id> [flags]
stackgen ai session artifacts list <session-id>
stackgen ai session artifacts list <session-id> -o json

download​

stackgen ai session artifacts download <session-id> <artifact-id-or-name> [flags]

The second argument accepts either the artifact id or the filename shown by list. Ids are matched first, then full filenames case-insensitively. When several artifacts share the same filename, the most recently created one is downloaded.

FlagDescription
--destination stringDirectory to write the artifact into (default .)
-h, --helpHelp for download
stackgen ai session artifacts download <session-id> <artifact-id>
stackgen ai session artifacts download <session-id> rca-report.md --destination ./out

Subcommands​

knowledge​

Upload documents to an Aiden Knowledge Hub, list documents, check ingestion status, delete documents, and list Knowledge Hubs.