composable_agents 3.3.0 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f49d4d1885ee0ce3abc08d156910295fa39b602450f68588259473acd62d30a
4
- data.tar.gz: 715281f951f66e05ca81b6a237b03c690ca319d9f6ee093471db560fd03ce441
3
+ metadata.gz: dafd767c4fb148d355237988c5b0e3d8a43a31710f234041e12bf12f1c3b4f44
4
+ data.tar.gz: ef63857b75133852cc606daeab198d82d6fb67079fb051cdd2805e151e601ddd
5
5
  SHA512:
6
- metadata.gz: ac0d9cbbfd7a3e6c6155e7f3276264b7c86c1ed6f68ebab6742665b25d44d14c99d544e07ff2ca22dcf59d68af6dd8064a1612c727fc39aa4318ad2de1a28c8d
7
- data.tar.gz: 7bdb521e572cfc1e75f108a4d2d46aaadd7ba409e7e2cebddef4e0062b6db2e83cb0ade32429e7b7d21651061ac56786201142952c7a339cf57c23870132ae2a
6
+ metadata.gz: 06ffc0718f7f653c7d75fe694ab2f38e4da7b48ef556f13bec3d7632cca3d929afcaeb3199ad9d9fd193cdce5ec8787095fc7a2efc2307e8745cd543c20a24a8
7
+ data.tar.gz: 0e6d0c71a145d87c70230e65181cd5bb8f4c615c64c6fee7fe3ae5580792eeaf3f17da66919b8cfbd3896506aad3f89bc60ae6e78d11b987a087cffb02bb7658
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [v3.4.0](https://github.com/Muriel-Salvan/composable_agents/compare/v3.3.1...v3.4.0) (2026-11-03 13:46:46)
2
+
3
+ ### Features
4
+
5
+ * [feat: add optional artifact support to retriable artifacts](https://github.com/Muriel-Salvan/composable_agents/commit/df88d8b5e4f6ef377dfab34fb0e7a3feeccb1b15)
6
+
7
+ # [v3.3.1](https://github.com/Muriel-Salvan/composable_agents/compare/v3.3.0...v3.3.1) (2026-11-02 20:20:46)
8
+
9
+ ### Patches
10
+
11
+ * [refactor: remove redundant instance variable initialization in retriable mixins](https://github.com/Muriel-Salvan/composable_agents/commit/de7fbde82ed2b9540831eeca976f44662a748af9)
12
+
1
13
  # [v3.3.0](https://github.com/Muriel-Salvan/composable_agents/compare/v3.2.0...v3.3.0) (2026-11-02 17:21:04)
2
14
 
3
15
  ## Global changes
data/README.md CHANGED
@@ -495,6 +495,18 @@ When a proc returns a policy, the agent waits `wait_secs` seconds, applies the `
495
495
  #### `ComposableAgents::Mixins::RetriableArtifacts`
496
496
 
497
497
  - **Description:** Automatically retries the run when output artifacts declared in contracts are missing or in error on prompt-driven agents. Requires both the ArtifactContract and Retriable mixins to be prepended, and must be prepended on an agent descending from PromptDrivenAgent.
498
+
499
+ - **Optional artifacts:** Artifacts can be marked as `optional: true` in their contract. When an optional artifact is missing, the run will not retry — it will complete successfully. This is useful for artifacts that are nice-to-have but not required for the agent to function.
500
+
501
+ Example contract with optional artifact:
502
+ ```ruby
503
+ output_artifacts_contracts: {
504
+ result: 'Final result', # required artifact
505
+ logs: { description: 'Execution logs', optional: true } # optional artifact
506
+ }
507
+ ```
508
+
509
+ - **Configuration:** Configurable via `artifacts_errors_max_retries` (default: 3); raises `ArtifactsErrorsMaxRetriesExceededError` when the limit is exceeded.
498
510
  - **Public methods:**
499
511
  - `#initialize(*args, artifacts_errors_max_retries: 3, **kwargs)` — Registers a retry policy that re-executes the run with a prompt asking for missing artifacts when output artifacts are missing or in error. The artifacts_errors_max_retries parameter (default: 3) sets the maximum number of retries before raising ArtifactsErrorsMaxRetriesExceededError.
500
512
  - **Usage example:**
@@ -23,7 +23,6 @@
23
23
  # @param kwargs [Hash] Keyword arguments passed to the parent initializer
24
24
  def initialize(*args, artifacts_errors_max_retries: 3, **kwargs)
25
25
  super(*args, **kwargs)
26
- @retriable_artifacts_user_instructions = nil
27
26
  max_retries = artifacts_errors_max_retries
28
27
  artifacts_errors_retries = 0
29
28
  last_artifact_keys = nil
@@ -63,8 +62,13 @@
63
62
  # as given by the {OutputArtifactsError} raised by the run (or empty if none).
64
63
  # @return [Hash{Symbol => Hash{Symbol => Object}}] Missing artifacts, per artifact name.
65
64
  def missing_artifacts(output_artifacts_errors)
65
+ output_artifacts = saved_output_artifacts
66
66
  normalized_output_artifacts_contracts
67
- .reject { |artifact_name, _artifact_description| @output_artifacts.key?(artifact_name) }
67
+ .reject do |artifact_name, artifact_contract|
68
+ output_artifacts.key?(artifact_name) || (
69
+ artifact_contract[:optional] && !output_artifacts_errors[artifact_name]
70
+ )
71
+ end
68
72
  .to_h do |artifact_name, artifact_description|
69
73
  [
70
74
  artifact_name,
@@ -27,7 +27,6 @@ module ComposableAgents
27
27
  **kwargs
28
28
  )
29
29
  super(*args, **kwargs)
30
- @retriable_cline_user_instructions = nil
31
30
  max_retries = cline_errors_max_retries
32
31
  initial_delay = cline_errors_retry_initial_delay_secs
33
32
  backoff_factor = cline_errors_retry_backoff_factor
@@ -74,7 +74,6 @@ module ComposableAgents
74
74
  @input_artifacts = input_artifacts
75
75
  @system_prompt = render_system_prompt(render_instructions(@system_instructions))
76
76
  logger.debug "System prompt: #{@system_prompt}"
77
- # TODO: Merge converse and prompt directly here. No need for this extra complexity now that Retriable has been moved out.
78
77
  converse(user_instructions, input_artifacts: @input_artifacts, author: 'User')
79
78
  # Raise an exception if some output artifacts have errors.
80
79
  output_artifacts_errors = output_artifacts_errors_to_raise
@@ -153,6 +152,13 @@ module ComposableAgents
153
152
  "but the following error occurred: #{error}"
154
153
  end
155
154
 
155
+ # Return the currently saved output artifacts
156
+ #
157
+ # @return [Hash{Symbol => Object}] The currently saved output artifacts
158
+ def saved_output_artifacts
159
+ @output_artifacts
160
+ end
161
+
156
162
  private
157
163
 
158
164
  # Get the output artifacts errors that should raise an {OutputArtifactsError} at the end of a run.
@@ -2,5 +2,5 @@ module ComposableAgents
2
2
  # @!group Public API
3
3
 
4
4
  # Gem version
5
- VERSION = '3.3.0'
5
+ VERSION = '3.4.0'
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.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan