composable_agents 3.3.1 → 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: 25ea65199c3a7cbc39d42a1fc130212564879ca21a790a2a153cffdb842aa2c7
4
- data.tar.gz: 68039d5cdcf0b94f31fcddf42900da77b8f5e8ce22c58f8b14aab706f284951b
3
+ metadata.gz: dafd767c4fb148d355237988c5b0e3d8a43a31710f234041e12bf12f1c3b4f44
4
+ data.tar.gz: ef63857b75133852cc606daeab198d82d6fb67079fb051cdd2805e151e601ddd
5
5
  SHA512:
6
- metadata.gz: 9a707773175fb27c18ea2e96185e94da06f92541ceaa09c75cdf015f4f6cb29c41e779579f2b672336c73e4a243fdd46fe190717f018070979624e46c7502676
7
- data.tar.gz: 4799b28d0665823cbca61eab7fd40714869475c9c817a1e8aa3e5e1518540cb41c36bb70a86d1bf4481e6b13378f6f410f5b7d5c594e90c54a2cac5e548e98b0
6
+ metadata.gz: 06ffc0718f7f653c7d75fe694ab2f38e4da7b48ef556f13bec3d7632cca3d929afcaeb3199ad9d9fd193cdce5ec8787095fc7a2efc2307e8745cd543c20a24a8
7
+ data.tar.gz: 0e6d0c71a145d87c70230e65181cd5bb8f4c615c64c6fee7fe3ae5580792eeaf3f17da66919b8cfbd3896506aad3f89bc60ae6e78d11b987a087cffb02bb7658
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
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
+
1
7
  # [v3.3.1](https://github.com/Muriel-Salvan/composable_agents/compare/v3.3.0...v3.3.1) (2026-11-02 20:20:46)
2
8
 
3
9
  ### Patches
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:**
@@ -64,7 +64,11 @@
64
64
  def missing_artifacts(output_artifacts_errors)
65
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,
@@ -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
@@ -2,5 +2,5 @@ module ComposableAgents
2
2
  # @!group Public API
3
3
 
4
4
  # Gem version
5
- VERSION = '3.3.1'
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.1
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan