Skip to content

CLI Quick Start

The SWEny CLI is how you build, run, and iterate on AI workflows from your terminal. Describe what you want done in plain English, and SWEny generates a full DAG with the right tools wired up at each step.

Terminal window
npm install -g @sweny-ai/core

The binary is called sweny. You can also run it directly with npx:

Terminal window
npx @sweny-ai/core --help

1. Add your API key to .env:

Terminal window
# .env (gitignored)
ANTHROPIC_API_KEY=sk-ant-...

The CLI auto-loads .env at startup — no external dotenv tooling required.

2. Create a workflow from a description:

Terminal window
sweny workflow create "analyze our codebase for common security \
anti-patterns, compile a report, and create tickets for critical findings"

SWEny generates a full workflow with nodes, conditional routing, and structured output schemas. It renders an ASCII DAG and prompts you to save, refine, or discard:

Save to .sweny/workflows/security_audit.yml? [Y/n/refine]

Type a refinement instruction to iterate on the design, or press Y to save.

3. Run it:

Terminal window
sweny workflow run .sweny/workflows/security_audit.yml

4. Refine it later:

Terminal window
sweny workflow edit .sweny/workflows/security_audit.yml \
"add a quality gate that rejects vague findings"

That’s it. No YAML to write by hand, no boilerplate to configure.

SWEny also ships production-ready workflows for SRE triage. No external services needed for a quick test — just an API key and a log file.

1. Create a config file:

Terminal window
sweny new

This runs the interactive picker and writes a starter .sweny.yml. Uncomment the local-only block:

.sweny.yml
observability-provider: file
log-file: ./sample-errors.json
issue-tracker-provider: file
source-control-provider: file
notification-provider: file

2. Run a dry-run triage:

Terminal window
sweny triage --dry-run

SWEny reads .sweny.yml, loads secrets from .env, analyzes your logs, and writes results to .sweny/output/ without creating any real issues or PRs.

When running on an interactive terminal, the CLI renders a live progress display that updates in place as each node executes:

⠹ [2/5] Investigate errors 1m 42s
↳ Calling sentry.list_issues
↳ Calling github.search_code
↳ Analyzing stack traces

The progress block shows a spinner, step counter, node name, and elapsed time. Below it, the last few activity messages stream in as the agent works. When a node finishes, the block is replaced with a completion line:

✓ [1/5] Fetch errors 12s
↳ Found 3 unresolved issues
✓ [2/5] Investigate errors 2m 14s
↳ Root cause identified in webhook handler
⠹ [3/5] Create issues 4s

Non-TTY environments (CI, pipes) get simple periodic status lines instead of animated output.

Pass --stream to emit raw ExecutionEvent objects as newline-delimited JSON to stdout. This is how Studio’s Live Mode connects to a running workflow:

Terminal window
sweny triage --stream | studio-consumer

--stream can be combined with the normal progress display — structured events go to stdout while the spinner renders to stderr.

Settings resolve in this order (highest wins):

CLI flag > environment variable > .sweny.yml > default

Use flags for one-off overrides without editing your config file:

Terminal window
sweny triage --dry-run --time-range 1h --service-filter 'billing-*'

.sweny.yml uses flat kebab-case keys that map 1:1 to CLI flags. You can copy any flag from --help directly into the YAML:

# .sweny.yml -- commit this file. Secrets go in .env.
# Providers
observability-provider: datadog
issue-tracker-provider: github-issues
source-control-provider: github
coding-agent-provider: claude
notification-provider: console
# Investigation
time-range: 24h
severity-focus: errors
service-filter: "*"
investigation-depth: standard
# PR / branch
base-branch: main
pr-labels: agent,triage,needs-review
# Paths
service-map-path: .github/service-map.yml
log-file: ./logs/errors.json
# Cache
cache-dir: .sweny/cache
cache-ttl: 86400

Secrets (API keys, tokens) are never read from the config file — always use environment variables or .env.

Once local-only mode works, swap in real providers. Set the provider in .sweny.yml and add credentials to .env:

.sweny.yml
observability-provider: sentry
sentry-org: my-org
sentry-project: my-project
issue-tracker-provider: linear
linear-team-id: your-team-uuid
.env
SENTRY_AUTH_TOKEN=sntrys_...
LINEAR_API_KEY=lin_api_...
GITHUB_TOKEN=ghp_...

Verify credentials before running a full workflow:

Terminal window
sweny check

See the Commands Reference for all supported providers and their options.