Class: Roast::Cogs::Agent::Config

Inherits:
Roast::Cog::Config show all
Defined in:
lib/roast/cogs/agent/config.rb

Constant Summary collapse

VALID_PROVIDERS =

: Array

[:claude, :pi].freeze

Instance Attribute Summary

Attributes inherited from Roast::Cog::Config

#values

Instance Method Summary collapse

Methods inherited from Roast::Cog::Config

#[], #[]=, #abort_on_failure!, #abort_on_failure?, #async!, #async?, field, #initialize, #merge, #no_abort_on_failure!, #no_async!, #use_current_working_directory!, #valid_working_directory, #validate!, #working_directory

Constructor Details

This class inherits a constructor from Roast::Cog::Config

Instance Method Details

#append_system_prompt(prompt) ⇒ Object

Configure the cog with a prompt component that will be appended to the agent’s system prompt every time the agent is invoked

Use this to add custom instructions while preserving the provider’s default system prompt.

This can also be combined with with ‘replace_system_prompt`.

#### See Also

  • ‘no_append_system_prompt!`

  • ‘replace_system_prompt`

: (String) -> void



183
184
185
# File 'lib/roast/cogs/agent/config.rb', line 183

def append_system_prompt(prompt)
  @values[:append_system_prompt] = prompt
end

#apply_permissions!Object Also known as: no_skip_permissions!

Configure the cog to apply the default set of system and user permissions when running the agent

How these permissions are defined and configured is specific to the agent provider being used.

The cog’s default behaviour is to run __with__ permissions applied.

#### Alias Methods

  • ‘apply_permissions!`

  • ‘no_skip_permissions!`

#### Inverse Methods

  • ‘no_apply_permissions!`

  • ‘skip_permissions!`

: () -> void



228
229
230
# File 'lib/roast/cogs/agent/config.rb', line 228

def apply_permissions!
  @values[:apply_permissions] = true
end

#apply_permissions?Boolean

Check if the cog is configured to apply permissions when running the agent

#### See Also

  • ‘apply_permissions!`

  • ‘no_apply_permissions!`

  • ‘skip_permissions!`

  • ‘no_skip_permissions!`

: () -> bool

Returns:

  • (Boolean)


258
259
260
# File 'lib/roast/cogs/agent/config.rb', line 258

def apply_permissions?
  @values.fetch(:apply_permissions, true)
end

#command(command) ⇒ Object

Configure the cog to use a specific base command when invoking the agent

The command format is provider-specific.

#### See Also

  • ‘use_default_command!`

: (String | Array) -> void



68
69
70
# File 'lib/roast/cogs/agent/config.rb', line 68

def command(command)
  @values[:command] = command
end

#display!Object

Configure the cog to display all agent output

This enables ‘show_prompt!`, `show_progress!`, `show_response!`, and `show_stats!`.

#### See Also

  • ‘no_display!`

  • ‘quiet!`

  • ‘show_prompt!`

  • ‘show_progress!`

  • ‘show_response!`

  • ‘show_stats!`

: () -> void



432
433
434
435
436
437
# File 'lib/roast/cogs/agent/config.rb', line 432

def display!
  show_prompt!
  show_progress!
  show_response!
  show_stats!
end

#display?Boolean

Check if the cog is configured to display any output while running

#### See Also

  • ‘show_prompt?`

  • ‘show_progress?`

  • ‘show_response?`

  • ‘show_stats?`

: () -> bool

Returns:

  • (Boolean)


472
473
474
# File 'lib/roast/cogs/agent/config.rb', line 472

def display?
  show_prompt? || show_progress? || show_response? || show_stats?
end

#dump_raw_agent_messages_to(filename) ⇒ Object

Configure the cog to dump raw messages received from the agent process to a file

This is intended for development and debugging purposes to inspect the raw message stream from the agent provider.

: (String) -> void



482
483
484
# File 'lib/roast/cogs/agent/config.rb', line 482

def dump_raw_agent_messages_to(filename)
  @values[:dump_raw_agent_messages_to] = filename
end

#model(model) ⇒ Object

Configure the cog to use a specific model when invoking the agent

The model name format is provider-specific.

#### See Also

  • ‘use_default_model!`

: (String) -> void



105
106
107
# File 'lib/roast/cogs/agent/config.rb', line 105

def model(model)
  @values[:model] = model
end

#no_append_system_prompt!Object

Configure the cog __not__ to append anything to the agent’s system prompt when the agent is invoked

This is the default behaviour.

#### See Also

  • ‘append_system_prompt`

: () -> void



195
196
197
# File 'lib/roast/cogs/agent/config.rb', line 195

def no_append_system_prompt!
  @values[:append_system_prompt] = ""
end

#no_apply_permissions!Object Also known as: skip_permissions!

Configure the cog to run the agent with __no__ permissions applied

The cog’s default behaviour is to run __with__ permissions.

#### Alias Methods

  • ‘no_apply_permissions!`

  • ‘skip_permissions!`

#### Inverse Methods

  • ‘apply_permissions!`

  • ‘no_skip_permissions!`

: () -> void



245
246
247
# File 'lib/roast/cogs/agent/config.rb', line 245

def no_apply_permissions!
  @values[:apply_permissions] = false
end

#no_display!Object Also known as: quiet!

Configure the cog to __hide__ all agent output

This enables ‘no_show_prompt!`, `no_show_progress!`, `no_show_response!`, `no_show_stats!`.

#### Alias Methods

  • ‘no_display!`

  • ‘quiet!`

#### See Also

  • ‘display!`

  • ‘quiet!`

  • ‘no_show_prompt!`

  • ‘no_show_progress!`

  • ‘no_show_response!`

  • ‘no_show_stats!`

: () -> void



456
457
458
459
460
461
# File 'lib/roast/cogs/agent/config.rb', line 456

def no_display!
  no_show_prompt!
  no_show_progress!
  no_show_response!
  no_show_stats!
end

#no_replace_system_prompt!Object

Configure the cog __not__ to replace the agent’s default system prompt

This is the default behaviour.

#### See Also

  • ‘replace_system_prompt`

: () -> void



154
155
156
# File 'lib/roast/cogs/agent/config.rb', line 154

def no_replace_system_prompt!
  @values[:replace_system_prompt] = ""
end

#no_show_progress!Object

Configure the cog __not__ to display the agent’s in-progress messages when running

This will hide thinking blocks and other intermediate output from the agent.

#### See Also

  • ‘show_progress!`

  • ‘show_progress?`

  • ‘no_display!`

  • ‘quiet!`

: () -> void



328
329
330
# File 'lib/roast/cogs/agent/config.rb', line 328

def no_show_progress!
  @values[:show_progress] = false
end

#no_show_prompt!Object

Configure the cog __not__ to display the prompt when running the agent

This is the default behaviour.

#### See Also

  • ‘show_prompt!`

  • ‘show_prompt?`

  • ‘no_display!`

  • ‘quiet!`

: () -> void



287
288
289
# File 'lib/roast/cogs/agent/config.rb', line 287

def no_show_prompt!
  @values[:show_prompt] = false
end

#no_show_response!Object

Configure the cog __not__ to display the agent’s final response

#### See Also

  • ‘show_response!`

  • ‘show_response?`

  • ‘no_display!`

  • ‘quiet!`

: () -> void



366
367
368
# File 'lib/roast/cogs/agent/config.rb', line 366

def no_show_response!
  @values[:show_response] = false
end

#no_show_stats!Object

Configure the cog __not__ to display statistics about the agent’s operation

#### See Also

  • ‘show_stats!`

  • ‘show_stats?`

  • ‘no_display!`

  • ‘quiet!`

: () -> void



404
405
406
# File 'lib/roast/cogs/agent/config.rb', line 404

def no_show_stats!
  @values[:show_stats] = false
end

#provider(provider) ⇒ Object

Configure the cog to use a specified provider when invoking an agent

The provider is the source of the agent tool itself. If no provider is specified, Anthropic Claude Code (‘:claude`) will be used as the default provider.

A provider must be properly installed on your system in order for Roast to be able to use it.

#### See Also

  • ‘use_default_provider!`

: (Symbol) -> void



21
22
23
# File 'lib/roast/cogs/agent/config.rb', line 21

def provider(provider)
  @values[:provider] = provider
end

#replace_system_prompt(prompt) ⇒ Object

Configure the cog with a custom system prompt that will completely replace the agent’s default system prompt every time the agent is invoked

#### See Also

  • ‘no_replace_system_prompt!`

  • ‘append_system_prompt`

: (String) -> void



142
143
144
# File 'lib/roast/cogs/agent/config.rb', line 142

def replace_system_prompt(prompt)
  @values[:replace_system_prompt] = prompt
end

#show_progress!Object

Configure the cog to display the agent’s in-progress messages when running

This includes thinking blocks and other intermediate output from the agent. Enabled by default.

#### See Also

  • ‘no_show_progress!`

  • ‘show_progress?`

  • ‘display!`

: () -> void



313
314
315
# File 'lib/roast/cogs/agent/config.rb', line 313

def show_progress!
  @values[:show_progress] = true
end

#show_progress?Boolean

Check if the cog is configured to display the agent’s in-progress messages when running

#### See Also

  • ‘show_progress!`

  • ‘no_show_progress!`

: () -> bool

Returns:

  • (Boolean)


339
340
341
# File 'lib/roast/cogs/agent/config.rb', line 339

def show_progress?
  @values.fetch(:show_progress, true)
end

#show_prompt!Object

Configure the cog to display the prompt when running the agent

Disabled by default.

#### See Also

  • ‘no_show_prompt!`

  • ‘show_prompt?`

  • ‘display!`

: () -> void



272
273
274
# File 'lib/roast/cogs/agent/config.rb', line 272

def show_prompt!
  @values[:show_prompt] = true
end

#show_prompt?Boolean

Check if the cog is configured to display the prompt when running the agent

#### See Also

  • ‘show_prompt!`

  • ‘no_show_prompt!`

: () -> bool

Returns:

  • (Boolean)


298
299
300
# File 'lib/roast/cogs/agent/config.rb', line 298

def show_prompt?
  @values.fetch(:show_prompt, false)
end

#show_response!Object

Configure the cog to display the agent’s final response

Enabled by default.

#### See Also

  • ‘no_show_response!`

  • ‘show_response?`

  • ‘display!`

: () -> void



353
354
355
# File 'lib/roast/cogs/agent/config.rb', line 353

def show_response!
  @values[:show_response] = true
end

#show_response?Boolean

Check if the cog is configured to display the agent’s final response

#### See Also

  • ‘show_response!`

  • ‘no_show_response!`

: () -> bool

Returns:

  • (Boolean)


377
378
379
# File 'lib/roast/cogs/agent/config.rb', line 377

def show_response?
  @values.fetch(:show_response, true)
end

#show_stats!Object

Configure the cog to display statistics about the agent’s operation

Enabled by default.

#### See Also

  • ‘no_show_stats!`

  • ‘show_stats?`

  • ‘display!`

: () -> void



391
392
393
# File 'lib/roast/cogs/agent/config.rb', line 391

def show_stats!
  @values[:show_stats] = true
end

#show_stats?Boolean

Check if the cog is configured to display statistics about the agent’s operation

#### See Also

  • ‘show_stats!`

  • ‘no_show_stats!`

: () -> bool

Returns:

  • (Boolean)


415
416
417
# File 'lib/roast/cogs/agent/config.rb', line 415

def show_stats?
  @values.fetch(:show_stats, true)
end

#use_default_command!Object

Configure the cog to use the provider’s default command when invoking the agent

Note: the default command will be different for different providers.

#### See Also

  • ‘command`

: () -> void



80
81
82
# File 'lib/roast/cogs/agent/config.rb', line 80

def use_default_command!
  @values[:command] = nil
end

#use_default_model!Object

Configure the cog to use the provider’s default model when invoking the agent

Note: the default model will be different for different providers.

#### See Also

  • ‘model`

: () -> void



117
118
119
# File 'lib/roast/cogs/agent/config.rb', line 117

def use_default_model!
  @values[:model] = nil
end

#use_default_provider!Object

Configure the cog to use the default provider when invoking an agent

The default provider used by Roast is Anthropic Claude Code (‘:claude`).

The provider must be properly installed on your system in order for Roast to be able to use it.

#### See Also

  • ‘provider`

: () -> void



35
36
37
# File 'lib/roast/cogs/agent/config.rb', line 35

def use_default_provider!
  @values[:provider] = nil
end

#valid_append_system_promptObject

Get the validated, configured prompt that will be appended to the agent’s system prompt when the agent is invoked

Returns ‘nil` if __no__ prompt should be appended.

#### See Also

  • ‘append_system_prompt`

  • ‘no_append_system_prompt!`

: () -> String?



209
210
211
# File 'lib/roast/cogs/agent/config.rb', line 209

def valid_append_system_prompt
  @values[:append_system_prompt].presence
end

#valid_commandObject

Get the validated, configured value of the command the cog is configured to use when running the agent

Returns ‘nil` if the provider should use its own default command, however that is configured.

#### See Also

  • ‘command`

  • ‘use_default_command!`

: () -> (String | Array)?



93
94
95
# File 'lib/roast/cogs/agent/config.rb', line 93

def valid_command
  @values[:command].presence
end

#valid_dump_raw_agent_messages_to_pathObject

Get the validated, configured path to which raw agent messages should be dumped

Returns ‘nil` if no path has been configured.

This is intended for development and debugging purposes to inspect the raw message stream from the agent provider.

#### See Also

  • ‘dump_raw_agent_messages_to`

: () -> Pathname?



497
498
499
# File 'lib/roast/cogs/agent/config.rb', line 497

def valid_dump_raw_agent_messages_to_path
  Pathname.new(@values[:dump_raw_agent_messages_to]) if @values[:dump_raw_agent_messages_to]
end

#valid_modelObject

Get the validated, configured value of the model the cog is configured to use when running the agent

Returns ‘nil` if the provider should use its own default model, however that is configured.

#### See Also

  • ‘model`

  • ‘use_default_model!`

: () -> String?



130
131
132
# File 'lib/roast/cogs/agent/config.rb', line 130

def valid_model
  @values[:model].presence
end

#valid_provider!Object

Get the validated provider name that the cog is configured to use when invoking an agent

Note: this method will return the name of a valid provider or raise an ‘InvalidConfigError`. It will __not__, however, validate that the agent is properly installed on your system. If the agent is not properly installed, you will likely experience a failure when Roast attempts to run your workflow.

#### See Also

  • ‘provider`

  • ‘use_default_provider!`

: () -> Symbol



51
52
53
54
55
56
57
58
# File 'lib/roast/cogs/agent/config.rb', line 51

def valid_provider!
  provider = @values[:provider] || VALID_PROVIDERS.first
  unless VALID_PROVIDERS.include?(provider)
    raise InvalidConfigError, "'#{provider}' is not a valid provider. Available providers include: #{VALID_PROVIDERS.join(", ")}"
  end

  provider
end

#valid_replace_system_promptObject

Get the validated, configured replacement system prompt

Returns ‘nil` if the default system prompt should __not__ be replaced.

#### See Also

  • ‘replace_system_prompt`

  • ‘no_replace_system_prompt!`

: () -> String?



167
168
169
# File 'lib/roast/cogs/agent/config.rb', line 167

def valid_replace_system_prompt
  @values[:replace_system_prompt].presence
end