Structured AI workflows made easy
A Ruby-based domain-specific language for creating structured AI workflows. Build complex AI-powered automation with simple, declarative Ruby syntax.
Roast lets you orchestrate AI workflows by combining "cogs" - building blocks that interact with LLMs, run code, execute commands, and process data. Write workflows that:
# analyze_codebase.rb
execute do
# Get recent changes
cmd(:recent_changes) { "git diff --name-only HEAD~5..HEAD" }
# AI agent analyzes the code
agent(:review) do
files = cmd!(:recent_changes).lines
<<~PROMPT
Review these recently changed files for potential issues:
#{files.join("\n")}
Focus on security, performance, and maintainability.
PROMPT
end
# Summarize for stakeholders
chat(:summary) do
"Summarize this for non-technical stakeholders:\n\n#{agent!(:review).response}"
end
endRun with:
bin/roast execute analyze_codebase.rbchat - Send prompts to cloud-based LLMs (OpenAI, Anthropic, Perplexity & Gemini)agent - Run local coding agents with filesystem access (Pi CLI, Claude Code CLI, etc.)ruby - Execute custom Ruby code within workflowscmd - Run shell commands and capture outputmap - Process collections in serial or parallelrepeat - Iterate until conditions are metcall - Invoke reusable workflow scopesgem install roast-aiOr add to your Gemfile:
gem 'roast-ai'Roast provider settings are configured in workflow config blocks. To change the default chat provider without editing each workflow, set the ROAST_DEFAULT_CHAT_PROVIDER environment variable (e.g. export ROAST_DEFAULT_CHAT_PROVIDER=anthropic). To change the default agent provider, set ROAST_DEFAULT_AGENT_PROVIDER. A provider set in a workflow's config always takes precedence over these variables, and an invalid value raises an error.
The chat cog supports OpenAI, Anthropic, Perplexity, and Gemini. It defaults to :openai (override globally with ROAST_DEFAULT_CHAT_PROVIDER). Each provider reads its API key from a provider-specific environment variable:
| Provider | API key env var | Base URL env var |
|---|---|---|
:openai |
OPENAI_API_KEY |
OPENAI_API_BASE |
:anthropic |
ANTHROPIC_API_KEY |
ANTHROPIC_API_BASE |
:perplexity |
PERPLEXITY_API_KEY |
— |
:gemini |
GEMINI_API_KEY |
GEMINI_API_BASE |
You can configure the provider directly in a workflow:
config do
chat do
provider :anthropic
model "claude-haiku-4-5"
end
endThe agent cog runs local agent CLIs. It defaults to :pi (override globally with ROAST_DEFAULT_AGENT_PROVIDER) and currently supports:
:claude - Claude Code CLI:pi - Pi CLISelect a provider in the workflow config:
config do
agent do
provider :pi
end
endAgent providers must be installed and authenticated according to their own CLI requirements.
Roast currently supports four LLM providers for the chat cog: OpenAI, Anthropic, Perplexity and Gemini.
OPENAI_API_KEY, ANTHROPIC_API_KEY, PERPLEXITY_API_KEY and/or GEMINI_API_KEY in your environment.OPENAI_API_BASE, ANTHROPIC_API_BASE and/or GEMINI_API_BASE to override the default endpoint. Perplexity does not support base URL override.The default model is set per-provider and can only be overridden inside a config block. See the tutorial for examples.
The agent cog is powered by the Pi CLI by default, which handles its own authentication.
The best way to learn Roast is through the interactive tutorial:
The tutorial covers:
The public interfaces of Roast are extensively documented in class and method comments on the relevant classes.
cog-input-context.rbicog/output.rbagent/input.rbagent/output.rbcall.rbchat.rbchat.rbcmd.rb:159 (scroll down)cmd.rb:214 (scroll down)map.rb:116 (scroll down)repeat.rbruby.rbruby.rb:63 (scroll down)We welcome contributions! Please see our Contributing Guide for details.
No open issues yet, or sync has not completed.