roast-ai 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +0 -2
- data/Gemfile.lock +8 -8
- data/README.md +26 -14
- data/examples/demo/Gemfile.lock +2 -2
- data/examples/plugin-gem-example/Gemfile.lock +4 -4
- data/examples/simple_agent.rb +1 -1
- data/examples/targets_and_params.rb +12 -0
- data/internal/documentation/comments/doc-comments-external.md +5 -3
- data/internal/documentation/comments/doc-comments.md +2 -1
- data/lib/roast/cog_input_manager.rb +2 -44
- data/lib/roast/cogs/agent/config.rb +103 -4
- data/lib/roast/cogs/agent/providers/claude/claude_invocation.rb +5 -1
- data/lib/roast/cogs/agent/providers/claude/message.rb +4 -2
- data/lib/roast/cogs/agent/providers/pi/messages/tool_call_message.rb +218 -18
- data/lib/roast/cogs/agent/providers/pi/messages/tool_result_message.rb +208 -13
- data/lib/roast/cogs/agent/providers/pi/pi_invocation.rb +2 -0
- data/lib/roast/cogs/agent/stats.rb +15 -0
- data/lib/roast/cogs/agent/usage.rb +7 -0
- data/lib/roast/cogs/agent.rb +57 -4
- data/lib/roast/cogs/chat/config.rb +53 -2
- data/lib/roast/cogs/chat.rb +13 -5
- data/lib/roast/cogs/cmd.rb +35 -0
- data/lib/roast/command_runner.rb +3 -1
- data/lib/roast/config_manager.rb +29 -2
- data/lib/roast/version.rb +1 -1
- data/lib/roast/workflow.rb +10 -7
- data/lib/roast/workflow_param_accessors.rb +53 -0
- data/sorbet/rbi/shims/lib/roast/cog/config.rbi +251 -0
- data/sorbet/rbi/shims/lib/roast/config_context.rbi +13 -1
- data/tutorial/01_your_first_workflow/README.md +3 -2
- data/tutorial/01_your_first_workflow/configured_chat.rb +1 -1
- data/tutorial/02_chaining_cogs/README.md +23 -2
- data/tutorial/02_chaining_cogs/code_review.rb +2 -2
- data/tutorial/02_chaining_cogs/session_resumption.rb +1 -0
- data/tutorial/03_targets_and_params/README.md +10 -1
- data/tutorial/04_configuration_options/README.md +19 -0
- data/tutorial/README.md +1 -1
- metadata +4 -2
|
@@ -106,7 +106,7 @@ block:
|
|
|
106
106
|
config do
|
|
107
107
|
chat do
|
|
108
108
|
model "gpt-4o-mini" # Use OpenAI's fast model
|
|
109
|
-
provider :openai # Use OpenAI (can also be :anthropic, :perplexity or :
|
|
109
|
+
provider :openai # Use OpenAI (can also be :anthropic, :perplexity, :gemini or :bedrock)
|
|
110
110
|
show_prompt! # Display the prompt before sending
|
|
111
111
|
end
|
|
112
112
|
end
|
|
@@ -129,8 +129,9 @@ Common options you can set:
|
|
|
129
129
|
- Anthropic: "claude-haiku-4-5" (default), "claude-sonnet-4-6", "claude-opus-4-7", etc.
|
|
130
130
|
- Perplexity: "sonar" (default), "sonar-pro", "sonar-deep-research", etc.
|
|
131
131
|
- Gemini: "gemini-3.1-flash-lite" (default), "gemini-3-flash-preview", "gemini-3.1-pro-preview", etc.
|
|
132
|
+
- Bedrock: "us.anthropic.claude-haiku-4-5-20251001-v1:0" (default), or any other Bedrock model or inference profile ID your account can use
|
|
132
133
|
- `provider :name` - Which LLM provider
|
|
133
|
-
- `:openai`, `:anthropic`, `:perplexity` or `:
|
|
134
|
+
- `:openai`, `:anthropic`, `:perplexity`, `:gemini` or `:bedrock`
|
|
134
135
|
- `show_prompt!` - Display the prompt being sent
|
|
135
136
|
- `show_response!` - Display the response (on by default)
|
|
136
137
|
- `show_stats!` - Display token usage statistics (on by default)
|
|
@@ -10,7 +10,7 @@ config do
|
|
|
10
10
|
# Configure all chat cogs in this workflow
|
|
11
11
|
chat do
|
|
12
12
|
model "gpt-4o-mini" # Use OpenAI's fast, cost-effective model
|
|
13
|
-
provider :openai # Use OpenAI (alternative: :anthropic, :perplexity or :
|
|
13
|
+
provider :openai # Use OpenAI (alternative: :anthropic, :perplexity, :gemini or :bedrock)
|
|
14
14
|
show_prompt! # Display the prompt before sending it
|
|
15
15
|
show_response! # Display the response (this is the default)
|
|
16
16
|
show_stats! # Display token usage statistics (default)
|
|
@@ -127,8 +127,29 @@ execute do
|
|
|
127
127
|
end
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
The `agent` cog is backed by a locally installed coding agent --
|
|
131
|
-
You'll need to have
|
|
130
|
+
The `agent` cog is backed by a locally installed coding agent -- Pi is the default provider (set `ROAST_DEFAULT_AGENT_PROVIDER` to change it globally, e.g. to `claude`).
|
|
131
|
+
You'll need to have Pi installed and configured correctly for this cog to run.
|
|
132
|
+
Roast also supports Claude code, which must be set explicitly in provider or an environment variable.
|
|
133
|
+
|
|
134
|
+
### Specifying a Model
|
|
135
|
+
|
|
136
|
+
Use a fully-qualified `provider/model` id:
|
|
137
|
+
|
|
138
|
+
```ruby
|
|
139
|
+
config do
|
|
140
|
+
agent do
|
|
141
|
+
model "anthropic/claude-haiku-4-5-20251001"
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Pi requires this qualified form. Claude Code expects a bare model name, so Roast strips the leading
|
|
147
|
+
`anthropic/` prefix automatically when the `:claude` provider is used. Because of this, the same `model`
|
|
148
|
+
string is portable across providers -- you can switch the agent provider without rewriting it.
|
|
149
|
+
|
|
150
|
+
A bare name like `"claude-haiku-4-5-20251001"` (or a shorthand like `"haiku"`) still works when you've set
|
|
151
|
+
`provider :claude`, but it will fail on the default Pi provider, which can't resolve an unqualified model name.
|
|
152
|
+
Prefer the qualified form unless you have a reason not to.
|
|
132
153
|
|
|
133
154
|
### When to Use Agent vs Chat
|
|
134
155
|
|
|
@@ -187,6 +187,15 @@ execute do
|
|
|
187
187
|
end
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
+
Parameter accessors are also available inside cog `config` blocks and the `global` block:
|
|
191
|
+
|
|
192
|
+
```ruby
|
|
193
|
+
config do
|
|
194
|
+
chat { model(arg?(:fast) ? "gpt-5.4-nano" : "gpt-5") }
|
|
195
|
+
global { abort_on_failure! if arg?(:strict) }
|
|
196
|
+
end
|
|
197
|
+
```
|
|
198
|
+
|
|
190
199
|
## Running the Workflows
|
|
191
200
|
|
|
192
201
|
To run the examples in this chapter:
|
|
@@ -220,7 +229,7 @@ bin/roast execute tutorial/03_targets_and_params/multiple_targets.rb \
|
|
|
220
229
|
- Use `arg?(:name)` to check if an argument is present
|
|
221
230
|
- Use `kwarg(:name)` to get a kwarg value (returns nil if missing)
|
|
222
231
|
- Use `kwarg!(:name)` to require a kwarg (errors if missing)
|
|
223
|
-
- All accessors work in any cog's input block
|
|
232
|
+
- All accessors work in any cog's input block, and inside cog `config` / `global` blocks
|
|
224
233
|
|
|
225
234
|
## What's Next?
|
|
226
235
|
|
|
@@ -111,6 +111,25 @@ end
|
|
|
111
111
|
|
|
112
112
|
This is useful when you have multiple similar cogs that need the same configuration.
|
|
113
113
|
|
|
114
|
+
### Configuring Based on Parameters
|
|
115
|
+
|
|
116
|
+
Workflow parameter accessors (`target!`, `targets`, `arg?`, `args`, `kwarg`, `kwarg!`, `kwarg?`, `kwargs`; see Chapter 3)
|
|
117
|
+
are available inside cog `config` blocks and the `global` block, so you can configure cogs based on how the workflow was
|
|
118
|
+
invoked:
|
|
119
|
+
|
|
120
|
+
```ruby
|
|
121
|
+
config do
|
|
122
|
+
chat do
|
|
123
|
+
# Pick a cheaper model when invoked with the `fast` flag: `-- fast`
|
|
124
|
+
model(arg?(:fast) ? "gpt-5.4-nano" : "gpt-5")
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
global do
|
|
128
|
+
abort_on_failure! if arg?(:strict)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
```
|
|
132
|
+
|
|
114
133
|
## Display Options
|
|
115
134
|
|
|
116
135
|
Control what gets printed during workflow execution using display methods in your `config` block:
|
data/tutorial/README.md
CHANGED
|
@@ -15,7 +15,7 @@ run coding agents, process data, and so much more.
|
|
|
15
15
|
- Ruby installed (3.4.2+)
|
|
16
16
|
- Roast gem installed
|
|
17
17
|
- API keys for your AI provider (see [Configuration](https://github.com/Shopify/roast/blob/main/README.md#configuration) for setup)
|
|
18
|
-
- Claude Code CLI installed and configured
|
|
18
|
+
- Pi CLI installed and configured for default agent examples; Claude Code CLI installed and configured for examples that set `provider :claude`
|
|
19
19
|
|
|
20
20
|
## How to Use This Tutorial
|
|
21
21
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roast-ai
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify
|
|
@@ -245,6 +245,7 @@ files:
|
|
|
245
245
|
- lib/roast/version.rb
|
|
246
246
|
- lib/roast/workflow.rb
|
|
247
247
|
- lib/roast/workflow_context.rb
|
|
248
|
+
- lib/roast/workflow_param_accessors.rb
|
|
248
249
|
- lib/roast/workflow_params.rb
|
|
249
250
|
- roast-ai.gemspec
|
|
250
251
|
- shipit.rubygems.yml
|
|
@@ -349,6 +350,7 @@ files:
|
|
|
349
350
|
- sorbet/rbi/gems/vcr@6.3.1.rbi
|
|
350
351
|
- sorbet/rbi/gems/webmock@3.25.1.rbi
|
|
351
352
|
- sorbet/rbi/gems/zeitwerk@2.7.3.rbi
|
|
353
|
+
- sorbet/rbi/shims/lib/roast/cog/config.rbi
|
|
352
354
|
- sorbet/rbi/shims/lib/roast/cog_input_context.rbi
|
|
353
355
|
- sorbet/rbi/shims/lib/roast/config_context.rbi
|
|
354
356
|
- sorbet/rbi/shims/lib/roast/execution_context.rbi
|
|
@@ -406,7 +408,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
406
408
|
- !ruby/object:Gem::Version
|
|
407
409
|
version: '0'
|
|
408
410
|
requirements: []
|
|
409
|
-
rubygems_version: 4.0.
|
|
411
|
+
rubygems_version: 4.0.22
|
|
410
412
|
specification_version: 4
|
|
411
413
|
summary: A framework for executing structured AI workflows in Ruby
|
|
412
414
|
test_files: []
|