composable_agents 3.7.1 → 3.7.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca528fbcd43384651ac041c0b1f2b20fa437209cffb628a6bcd585e8dc3e1e35
4
- data.tar.gz: 0e11d4f796c723f0682af2d92a0b9c1642feb7ac18aa5bc9665e134a248e2405
3
+ metadata.gz: 8d6aad15f3dc67bdafbf24bc9c29d88f702e375db8a367f63a9384caad24ade5
4
+ data.tar.gz: 482e0a1ec8d78fac7380c27c7204a7685fc8d6d16cbd947af9504c0ab9c3f426
5
5
  SHA512:
6
- metadata.gz: b73237c63d9c118f059472397c7b1d9132d96cdaa529fd5ece002a6a1a4df826fb4fb1ba2904202a055478081ae389ec5edc6162353290337071bd8af880d08c
7
- data.tar.gz: 74b7902c87e91a3a6f3ce5377958bddad512d55c1495577f3c5c765c346fe9b2c92158a70d61001b5b454d3c66e9e481e3a116155d24b278fbaa2508a373c2ec
6
+ metadata.gz: '086d957913a56296cfc94ee01e9043eac182fd0c3eafc1c7339d9ee2cef6d35ce9ac469ccbed27334382f247386d7d39a805b2feff9fdbb293a7a89600da7589'
7
+ data.tar.gz: 5d1ba220238e8dc81df436e36f8a6007623cb59e2865c089e23fb4bcd979b01460b15a458630f00f737b77143d18e37bc836a18752d6f101619d304481b4aafb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # [v3.7.3](https://github.com/Muriel-Salvan/composable_agents/compare/v3.7.2...v3.7.3) (2026-12-03 16:56:38)
2
+
3
+ ## Global changes
4
+ ### Patches
5
+
6
+ * [chore(lint): enable rubocop-yard and fix YARD documentation](https://github.com/Muriel-Salvan/composable_agents/commit/b068159166a774cddde63e75692a5420b13c597d)
7
+
8
+ ## Changes for lint
9
+ ### Patches
10
+
11
+ * [chore(lint): enable rubocop-yard and fix YARD documentation](https://github.com/Muriel-Salvan/composable_agents/commit/b068159166a774cddde63e75692a5420b13c597d)
12
+
13
+ # [v3.7.2](https://github.com/Muriel-Salvan/composable_agents/compare/v3.7.1...v3.7.2) (2026-11-12 15:34:25)
14
+
15
+ ## Global changes
16
+ ### Patches
17
+
18
+ * [fix(strategies): expose options through agent accessors](https://github.com/Muriel-Salvan/composable_agents/commit/5a6901d858f6382e63efa49edd4dabf21efd8082)
19
+
20
+ ## Changes for strategies
21
+ ### Patches
22
+
23
+ * [fix(strategies): expose options through agent accessors](https://github.com/Muriel-Salvan/composable_agents/commit/5a6901d858f6382e63efa49edd4dabf21efd8082)
24
+
1
25
  # [v3.7.1](https://github.com/Muriel-Salvan/composable_agents/compare/v3.7.0...v3.7.1) (2026-11-12 13:28:25)
2
26
 
3
27
  ## Global changes
data/README.md CHANGED
@@ -568,7 +568,7 @@ When a proc returns a policy, the agent waits `wait_secs` seconds, applies the `
568
568
  ### Additional notes
569
569
 
570
570
  - **No executables / CLI** — This gem is a library only; there are no scripts in `bin/`.
571
- - **Prompt rendering strategies** (`PromptRenderingStrategy::Markdown`, `PromptRenderingStrategy::MarkdownHeavy`, and `PromptRenderingStrategy::MarkdownHeavyFiles`) are not part of the public API themselves — they are included automatically by the agent's `strategy:` parameter.
571
+ - **Prompt rendering strategies** (`PromptRenderingStrategy::Markdown`, `PromptRenderingStrategy::MarkdownHeavy`, and `PromptRenderingStrategy::MarkdownHeavyFiles`) are not part of the public API themselves — they are included automatically by the agent's `strategy:` parameter. A strategy never defines `initialize`: when it can be customized, it exposes public accessors on the agent, resolved lazily and set at any time after construction (e.g. `PromptRenderingStrategy::MarkdownHeavyFiles#artifacts_directory=`).
572
572
  - **The `AiAgentUserInteraction` mixin** (`ComposableAgents::Mixins::AiAgentUserInteraction`) is an internal bridge that combines `UserInteraction` with `AiAgents::Agent`; it is used by prepending it to an `AiAgents::Agent` subclass.
573
573
  - See the [examples/](https://github.com/Muriel-Salvan/composable_agents/tree/main/examples) directory for complete, runnable scripts demonstrating all the above APIs.
574
574
 
@@ -679,7 +679,7 @@ Three strategies are included, mixed into the agent at initialization via `singl
679
679
 
680
680
  - **`PromptRenderingStrategy::Markdown`** — Clean, minimal Markdown. Simple instructions and artifact references.
681
681
  - **`PromptRenderingStrategy::MarkdownHeavy`** (default for Cline) — Elaborate prompts with execution checklists, structured artifact definition sections, and **JSON-based output parsing**. Agents format their artifacts as JSON blocks tagged with `output_artifact=NAME`, which the strategy parses back into the output hash. Includes type-aware parsing (`:text`, `:markdown`, `:json`).
682
- - **`PromptRenderingStrategy::MarkdownHeavyFiles`** — Same heavy Markdown behavior as `MarkdownHeavy`, but artifacts are persisted as files on disk instead of being in-lined or returned as JSON. Input artifacts are written to files that the assistant is asked to open, and output artifacts are expected as files that are read back from disk. Accepts an `artifacts_directory` constructor parameter (defaults to `#{composable_agents_dir}/artifacts`); its artifacts directories are resolved lazily and created on first use.
682
+ - **`PromptRenderingStrategy::MarkdownHeavyFiles`** — Same heavy Markdown behavior as `MarkdownHeavy`, but artifacts are persisted as files on disk instead of being in-lined or returned as JSON. Input artifacts are written to files that the assistant is asked to open, and output artifacts are expected as files that are read back from disk. It exposes a public `#artifacts_directory` accessor (defaulting to `#{composable_agents_dir}/artifacts`) that can be set on the agent at any time; its artifacts directories are resolved lazily and created on first use. Example: `agent.artifacts_directory = File.join(composable_agents_dir, 'my_artifacts')`.
683
683
 
684
684
  ### LLM backends: ai-agents vs cline-rb 🎯
685
685
 
data/TODO.md CHANGED
@@ -1,3 +1,4 @@
1
+ * Use https://github.com/perplexityai/SPACE to provide a Mixin that would run agents in isolation.
1
2
  * Add a new Breakable/Interruptable mixin for Cline::Agent with proper methods or config to define conditions to interrupt a run (could be based on timeouts, costs, tokens, infinite loops...).
2
3
  * Use a ContextSummarizer agent to shrink the context given in retries.
3
4
  * Add a new mixin for Cline::Agent with proper methods or config to define retries in case of errors, with exponential waits.
@@ -56,6 +56,10 @@ module ComposableAgents
56
56
  # @return [RunInfo, nil] The current run info, or nil if no run has started yet
57
57
  attr_reader :current_run_info
58
58
 
59
+ # @return [String] Base directory where this agent stores its data (runs, artifacts...).
60
+ # Available to this agent's mixins and prompt rendering strategies.
61
+ attr_reader :composable_agents_dir
62
+
59
63
  # Get the logger to be used by this agent, with this agent's log fields (see #log_fields) prefixed to messages.
60
64
  # If the provided logger does not support fields tagging, it is used as-is (fields are ignored).
61
65
  # Memoized.
@@ -24,9 +24,11 @@ module ComposableAgents
24
24
 
25
25
  # Initialize a new agent with a list of ai-agents' Agents to be used with an AgentRunner
26
26
  #
27
+ # @param [Array<Object>] args
27
28
  # @param model [String] Model to be used
28
29
  # @param params [Hash{Symbol => Object}] Additional parameters to give to the ai-agents' agent
29
30
  # @param handoff_agents [Array<Agents::Agent>] The list of additional agents that can be used for handoffs.
31
+ # @param [Hash{Symbol => Object}] kwargs
30
32
  def initialize(
31
33
  *args,
32
34
  model: Agents.configuration.default_model,
@@ -95,7 +97,7 @@ module ComposableAgents
95
97
  instructions: @system_prompt,
96
98
  tools: [
97
99
  Tools::CreateArtifactTool.new(self, logger:),
98
- Tools::GetArtifactTool.new(@input_artifacts, logger:)
100
+ Tools::GetArtifactTool.new(input_artifacts, logger:)
99
101
  ] + agent_tools
100
102
  )
101
103
  ] + @handoff_agents
@@ -21,6 +21,7 @@ module ComposableAgents
21
21
 
22
22
  # Initialize a new agent that uses the Cline CLI in a dedicated config
23
23
  #
24
+ # @param [Array<Object>] args
24
25
  # @param strategy [Module] The prompt rendering strategy
25
26
  # @param provider [String] Provider to be used
26
27
  # @param model [String] Model to be used
@@ -31,6 +32,7 @@ module ComposableAgents
31
32
  # * Param global_settings [Cline::GlobalSettings] Settings that can be tuned for this agent
32
33
  # @param skills [Array<String>] List of skills to allow for this agent
33
34
  # @param cli_options [Hash{Symbol => Object}] Task options to give to Cline CLI (see Cline::Cli.COMMANDS)
35
+ # @param [Hash{Symbol => Object}] kwargs
34
36
  def initialize(
35
37
  *args,
36
38
  strategy: PromptRenderingStrategy::MarkdownHeavy,
@@ -214,7 +216,7 @@ module ComposableAgents
214
216
  find_skill(skill, selected_skills)
215
217
  end
216
218
  # Setup the temporary Cline global config dir
217
- agent_tmp_dir = "#{@composable_agents_dir}/tmp/#{Time.now.utc.strftime('%F-%H-%M-%S')}#{"-#{name.gsub(/[^\w.]/, '_')}" if name}"
219
+ agent_tmp_dir = "#{composable_agents_dir}/tmp/#{Time.now.utc.strftime('%F-%H-%M-%S')}#{"-#{name.gsub(/[^\w.]/, '_')}" if name}"
218
220
  ::Cline.configure do |config|
219
221
  config.debug = logger_debug?
220
222
  config.temp_dir_root = "#{agent_tmp_dir}/cline-rb"
@@ -35,7 +35,7 @@ module ComposableAgents
35
35
  # This is the implementation used by all severity methods, that all call #add in ::Logger.
36
36
  #
37
37
  # @param severity [Integer, nil] Severity of the message
38
- # @param message [String, #call => String, nil] Message string, Proc returning the message for lazy evaluation,
38
+ # @param message [String, #call, nil] Message string, Proc returning the message for lazy evaluation,
39
39
  # or nil if the message is given by the progname or a block
40
40
  # @param progname [String, nil] Program name to be logged if the message is nil
41
41
  # @yield The optional code returning the message to log
@@ -50,7 +50,7 @@ module ComposableAgents
50
50
  # without redefining it here, #log would not use this class' #add override.
51
51
  #
52
52
  # @param severity [Integer, nil] Severity of the message
53
- # @param message [String, #call => String, nil] Message string, Proc returning the message for lazy evaluation,
53
+ # @param message [String, #call, nil] Message string, Proc returning the message for lazy evaluation,
54
54
  # or nil if the message is given by the progname or a block
55
55
  # @param progname [String, nil] Program name to be logged if the message is nil
56
56
  # @yield The optional code returning the message to log
@@ -67,7 +67,7 @@ module ComposableAgents
67
67
  # by passing a block to the wrapped logger's severity method.
68
68
  #
69
69
  # @param severity [Integer, nil] Severity of the message
70
- # @param message [String, #call => String, nil] Message string, Proc returning the message for lazy evaluation,
70
+ # @param message [String, #call, nil] Message string, Proc returning the message for lazy evaluation,
71
71
  # or nil if the message is given by the progname or a block
72
72
  # @param progname [String, nil] Program name to be logged if the message is nil
73
73
  # @yield The optional code returning the message to log
@@ -90,7 +90,7 @@ module ComposableAgents
90
90
  # Resolve the message to be logged.
91
91
  # The block has priority over the message and progname parameters, and Procs are called to get their result.
92
92
  #
93
- # @param message [String, #call => String, nil] Message string or Proc returning the message
93
+ # @param message [String, #call, nil] Message string or Proc returning the message
94
94
  # @param progname [String, nil] Program name to be logged if the message is nil
95
95
  # @yield The optional code returning the message to log
96
96
  # @yieldreturn [String] The message to log
@@ -32,10 +32,12 @@ module ComposableAgents
32
32
 
33
33
  # Constructor
34
34
  #
35
+ # @param [Array<Object>] args
35
36
  # @param input_artifacts_contracts [Hash{Symbol => Object}, nil] Hash of input artifact names and their contracts,
36
37
  # or nil if provided through the input_artifacts_contracts method
37
38
  # @param output_artifacts_contracts [Hash{Symbol => Object}, nil] Hash of output artifact names and their contracts,
38
39
  # or nil if provided through the output_artifacts_contracts method
40
+ # @param [Hash{Symbol => Object}] kwargs
39
41
  def initialize(
40
42
  *args,
41
43
  input_artifacts_contracts: nil,
@@ -65,7 +65,9 @@ module ComposableAgents
65
65
 
66
66
  # Constructor
67
67
  #
68
+ # @param [Array<Object>] args
68
69
  # @param run_id [String, nil] ID identifying this run to reuse previously executed steps, or nil if there is no resumability needed
70
+ # @param [Hash{Symbol => Object}] kwargs
69
71
  def initialize(*args, run_id: nil, **kwargs)
70
72
  super(*args, **kwargs)
71
73
  @run_id = run_id
@@ -208,7 +210,7 @@ module ComposableAgents
208
210
  # @param step_full_name [String] Step full name
209
211
  # @return [String] Corresponding JSON file that stores the step states
210
212
  def saved_step_states_json(step_full_name)
211
- "#{@composable_agents_dir}/runs/#{@run_id}/#{step_full_name.gsub(/[^\w.]/, '_')}.json"
213
+ "#{composable_agents_dir}/runs/#{@run_id}/#{step_full_name.gsub(/[^\w.]/, '_')}.json"
212
214
  end
213
215
 
214
216
  # Get saved step states from a given full step name.
@@ -12,11 +12,13 @@ module ComposableAgents
12
12
  module RetriableCline
13
13
  # Constructor
14
14
  #
15
+ # @param [Array<Object>] args
15
16
  # @param cline_errors_max_retries [Integer] Maximum number of retries for Cline errors
16
17
  # @param cline_errors_retry_initial_delay_secs [Float] Initial delay in seconds before the first retry
17
18
  # @param cline_errors_retry_backoff_factor [Float] Backoff multiplier for each subsequent retry
18
19
  # @param cline_errors_retry_max_delay_secs [Float] Maximum delay in seconds between retries
19
20
  # @param cline_errors_retry_jitter [Float] Amount of random jitter to add to the delay
21
+ # @param [Hash{Symbol => Object}] kwargs
20
22
  def initialize(
21
23
  *args,
22
24
  cline_errors_max_retries: 3,
@@ -10,6 +10,8 @@ module ComposableAgents
10
10
  #
11
11
  # Prompt rendering strategies are useful because different prompt-driven agents would benefit from different
12
12
  # prompt formats or structures (JSON, Markdown, explicit ordered lists, in-lining artifacts' contents without tools...).
13
+ # A strategy is a module that is included in the agent's singleton class when the agent is constructed
14
+ # (see PromptRenderingStrategy).
13
15
  # This agent automatically records non-rendered conversation (prompts + outputs) in a `conversation` store, part of its state.
14
16
  class PromptDrivenAgent < Agent
15
17
  # @!group Public API
@@ -37,12 +39,16 @@ module ComposableAgents
37
39
  # Initialize a new PromptDrivenAgent with the information needed for prompts and the selected prompt rendering strategy.
38
40
  # If no name is provided, it will default to 'Executor'.
39
41
  #
42
+ # @param [Array<Object>] args
40
43
  # @param role [String, nil] Agent's role, or nil for the agent's default
41
44
  # @param objective [String, nil] Agent's objective, or nil for the agent's default
42
45
  # @param system_instructions [Object, nil] Original instructions for the agent, or nil if no system instructions are needed.
43
46
  # The kind of instructions that can be given are defined by the Instructions's constructor (see Instructions#initialize).
44
47
  # @param constraints [String, nil] Constraints to be respected, or nil for the agent's default
45
- # @param strategy [Module] The prompt rendering strategy
48
+ # @param strategy [Module] The prompt rendering strategy.
49
+ # Strategies must not define their own constructor: a strategy that can be customized exposes public accessors
50
+ # to be set on the agent (see PromptRenderingStrategy::MarkdownHeavyFiles#artifacts_directory=).
51
+ # @param [Hash{Symbol => Object}] kwargs
46
52
  def initialize(
47
53
  *args,
48
54
  role: nil,
@@ -161,6 +167,10 @@ module ComposableAgents
161
167
 
162
168
  private
163
169
 
170
+ # @return [Hash{Symbol => Object}, nil] The input artifacts of the current run, or nil if no run has started yet.
171
+ # Available to this agent's prompt rendering strategies.
172
+ attr_reader :input_artifacts
173
+
164
174
  # Get the output artifacts errors that should raise an {OutputArtifactsError} at the end of a run.
165
175
  # By default, all the errors that were reported during the run should raise.
166
176
  # This is a hook that other mixins can override to restrict the errors that should raise.
@@ -1,5 +1,15 @@
1
1
  module ComposableAgents
2
- # Collection of prompt rendering strategies that can be used with PromptDrivenAgent's agents
2
+ # Collection of prompt rendering strategies that can be used with PromptDrivenAgent's agents.
3
+ # A strategy is a module that is included in the agent's singleton class when the agent is constructed
4
+ # (see PromptDrivenAgent#initialize).
5
+ # Strategies must follow these rules:
6
+ # - They must not define an #initialize method: strategies don't have any constructor parameter.
7
+ # - A strategy that can be customized publishes public accessors on the agent, whose defaults are resolved lazily
8
+ # from the agent's public API, so that they can be set at any time on a constructed agent
9
+ # (see MarkdownHeavyFiles#artifacts_directory).
10
+ # - They use the agent's accessors (e.g. #name, #role, #objective, #constraints, #input_artifacts,
11
+ # #composable_agents_dir) — including its private ones, as strategies are part of the agent — and never access
12
+ # its instance variables.
3
13
  module PromptRenderingStrategy
4
14
  # Render prompt as Markdown documents
5
15
  module Markdown
@@ -30,44 +40,44 @@ module ComposableAgents
30
40
  end
31
41
 
32
42
  # Render the system prompt.
33
- # The following instance variables are accessible to render the prompt:
34
- # - `@input_artifacts`
35
- # - `@role`
36
- # - `@objective`
37
- # - `@constraints`
43
+ # The following accessors are available to render the prompt:
44
+ # - `#input_artifacts`
45
+ # - `#role`
46
+ # - `#objective`
47
+ # - `#constraints`
38
48
  #
39
49
  # @param rendered_instructions [String, nil] The rendered system instructions, or nil if none
40
50
  # @return [String] The rendered system prompt
41
51
  def render_system_prompt(rendered_instructions)
42
52
  sections = []
43
- sections << <<~EO_SECTION if @role && !@role.empty?
53
+ sections << <<~EO_SECTION if role && !role.empty?
44
54
  # Role
45
55
 
46
- #{Utils::Markdown.align_markdown_headers(@role, level: 2).strip}
56
+ #{Utils::Markdown.align_markdown_headers(role, level: 2).strip}
47
57
  EO_SECTION
48
- sections << <<~EO_SECTION if @objective && !@objective.empty?
58
+ sections << <<~EO_SECTION if objective && !objective.empty?
49
59
  # Objective
50
60
 
51
- #{Utils::Markdown.align_markdown_headers(@objective, level: 2).strip}
61
+ #{Utils::Markdown.align_markdown_headers(objective, level: 2).strip}
52
62
  EO_SECTION
53
63
  sections << <<~EO_SECTION if rendered_instructions && !rendered_instructions.empty?
54
64
  # Instructions
55
65
 
56
66
  #{Utils::Markdown.align_markdown_headers(rendered_instructions, level: 2).strip}
57
67
  EO_SECTION
58
- sections << <<~EO_SECTION if @constraints && !@constraints.empty?
68
+ sections << <<~EO_SECTION if constraints && !constraints.empty?
59
69
  # Constraints
60
70
 
61
- #{Utils::Markdown.align_markdown_headers(@constraints, level: 2).strip}
71
+ #{Utils::Markdown.align_markdown_headers(constraints, level: 2).strip}
62
72
  EO_SECTION
63
73
  sections.map(&:strip).join("\n\n")
64
74
  end
65
75
 
66
76
  # Render the user prompt
67
- # The following instance variables are accessible to render the prompt:
68
- # - `@role`
69
- # - `@objective`
70
- # - `@constraints`
77
+ # The following accessors are available to render the prompt:
78
+ # - `#role`
79
+ # - `#objective`
80
+ # - `#constraints`
71
81
  #
72
82
  # @param rendered_instructions [String, nil] The rendered instructions, or nil if none
73
83
  # @param input_artifacts [Hash{Symbol => Object}] The input artifacts content for which we render this prompt, per artifact name
@@ -47,11 +47,11 @@ module ComposableAgents
47
47
  end
48
48
 
49
49
  # Render the system prompt
50
- # The following instance variables are accessible to render the prompt:
51
- # - `@input_artifacts`
52
- # - `@role`
53
- # - `@objective`
54
- # - `@constraints`
50
+ # The following accessors are available to render the prompt:
51
+ # - `#input_artifacts`
52
+ # - `#role`
53
+ # - `#objective`
54
+ # - `#constraints`
55
55
  #
56
56
  # @param rendered_instructions [String, nil] The rendered system instructions, or nil if none
57
57
  # @return [String] The rendered system prompt
@@ -65,10 +65,10 @@ module ComposableAgents
65
65
  end
66
66
 
67
67
  # Render the user prompt
68
- # The following instance variables are accessible to render the prompt:
69
- # - `@role`
70
- # - `@objective`
71
- # - `@constraints`
68
+ # The following accessors are available to render the prompt:
69
+ # - `#role`
70
+ # - `#objective`
71
+ # - `#constraints`
72
72
  #
73
73
  # @param rendered_instructions [String, nil] The rendered instructions, or nil if none
74
74
  # @param input_artifacts [Hash{Symbol => Object}] The input artifacts content for which we render this prompt, per artifact name
@@ -17,29 +17,44 @@ module ComposableAgents
17
17
  # This can be used to refer to the artifact names properly in the user or system instructions.
18
18
  # Artifacts are persisted in a directory that defaults to `#{composable_agents_dir}/artifacts`, where input and
19
19
  # output artifacts are persisted in its `input` and `output` sub-directories respectively.
20
- # Those directories are resolved lazily and created on disk the first time they are needed, so that no state
21
- # needs to be initialized by this module's constructor.
22
- # They can be customized using the `artifacts_directory` constructor parameter, when this strategy is
23
- # included in a class.
20
+ # Those directories are resolved lazily and created on disk the first time they are needed, so that this strategy
21
+ # needs no state initialization and no constructor parameter.
22
+ # The directory can be customized at any time on an agent using this strategy by setting its
23
+ # #artifacts_directory accessor.
24
24
  module MarkdownHeavyFiles
25
- # @!group Internal
26
-
27
25
  include MarkdownHeavy
28
26
 
29
- # Constructor
27
+ # @!group Public API
28
+
29
+ # Get the directory where artifacts are persisted.
30
+ # Defaults to `#{composable_agents_dir}/artifacts`.
31
+ # Input and output artifacts are persisted in its `input` and `output` sub-directories respectively.
32
+ # Those directories are resolved lazily and created on disk the first time they are needed.
33
+ #
34
+ # @return [String] The directory where artifacts are persisted
35
+ def artifacts_directory
36
+ @artifacts_directory || "#{composable_agents_dir}/artifacts"
37
+ end
38
+
39
+ # Set the directory where artifacts are persisted (see #artifacts_directory).
40
+ # Already resolved input and output artifacts directories are reset, so that they follow the new directory
41
+ # the next time they are needed.
30
42
  #
31
- # @param artifacts_directory [String, nil] Directory where artifacts are persisted, or nil to default to
43
+ # @param directory [String, nil] The directory where artifacts are persisted, or nil to default to
32
44
  # `#{composable_agents_dir}/artifacts`
33
- def initialize(*args, artifacts_directory: nil, **kwargs)
34
- @artifacts_directory = artifacts_directory
35
- super(*args, **kwargs)
45
+ def artifacts_directory=(directory)
46
+ @artifacts_directory = directory
47
+ @input_artifacts_directory = nil
48
+ @output_artifacts_directory = nil
36
49
  end
37
50
 
51
+ # @!group Internal
52
+
38
53
  # Render the user prompt
39
- # The following instance variables are accessible to render the prompt:
40
- # - `@role`
41
- # - `@objective`
42
- # - `@constraints`
54
+ # The following accessors are available to render the prompt:
55
+ # - `#role`
56
+ # - `#objective`
57
+ # - `#constraints`
43
58
  #
44
59
  # @param rendered_instructions [String, nil] The rendered instructions, or nil if none
45
60
  # @param input_artifacts [Hash{Symbol => Object}] The input artifacts content for which we render this prompt, per artifact name
@@ -132,15 +147,6 @@ module ComposableAgents
132
147
 
133
148
  private
134
149
 
135
- # Get the directory where artifacts are persisted.
136
- # Defaults to `#{composable_agents_dir}/artifacts`.
137
- # Memoized. This directory is not created on disk until it is actually needed.
138
- #
139
- # @return [String] The directory where artifacts are persisted
140
- def artifacts_directory
141
- @artifacts_directory ||= "#{@composable_agents_dir}/artifacts"
142
- end
143
-
144
150
  # Get the directory where input artifacts are persisted.
145
151
  # Created on disk the first time it is needed.
146
152
  # Memoized.
@@ -8,10 +8,12 @@ module ComposableAgents
8
8
 
9
9
  # Initialize a new RubyAgent with a processing proc
10
10
  #
11
- # @param processor [#call(Hash{Symbol => Object}) => Hash{Symbol => Object}] The agent logic.
11
+ # @param processor [#call(Hash{Symbol => Object})] The agent logic.
12
12
  # This proc will receive the input artifacts hash and must return a hash of output artifacts.
13
13
  # - Param input_artifacts [Hash\\{Symbol => Object}] Input artifacts provided to the agent
14
14
  # - Return [Hash\\{Symbol => Object}] Output artifacts produced by the agent
15
+ # @param [Array<Object>] args
16
+ # @param [Hash{Symbol => Object}] kwargs
15
17
  def initialize(processor, *args, **kwargs)
16
18
  super(*args, **kwargs)
17
19
  @processor = processor
@@ -2,5 +2,5 @@ module ComposableAgents
2
2
  # @!group Public API
3
3
 
4
4
  # Gem version
5
- VERSION = '3.7.1'
5
+ VERSION = '3.7.3'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: composable_agents
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.1
4
+ version: 3.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan