swarmauri_agent_image_skill 0.1.0__tar.gz

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.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2025] [Jacob Stewart @ Swarmauri]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,4 @@
1
+ Swarmauri SDK
2
+
3
+ This package is part of the Swarmauri SDK and is distributed under the
4
+ Apache License, Version 2.0. See LICENSE for the license terms.
@@ -0,0 +1,352 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_agent_image_skill
3
+ Version: 0.1.0
4
+ Summary: Select packaged image generation and signing skills and run their tools.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ License-File: NOTICE
8
+ Keywords: swarmauri,agents,skill activation,image generation,structured signing results
9
+ Author: Jacob Stewart
10
+ Author-email: jacob@swarmauri.com
11
+ Requires-Python: >=3.10,<3.15
12
+ Classifier: Development Status :: 1 - Planning
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Requires-Dist: swarmauri_agent_image_tool (>=0.1,<0.2)
19
+ Requires-Dist: swarmauri_base (>=0.11.0,<0.12)
20
+ Requires-Dist: swarmauri_core (>=0.11.0,<0.12)
21
+ Requires-Dist: swarmauri_skill_image_generation (>=0.1,<0.2)
22
+ Requires-Dist: swarmauri_skill_image_signing (>=0.1,<0.2)
23
+ Project-URL: Repository, https://github.com/swarmauri/swarmauri-sdk
24
+ Description-Content-Type: text/markdown
25
+
26
+ # swarmauri_agent_image_skill
27
+
28
+ <!-- readme-standards:begin branding -->
29
+ <p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
30
+ <p align="center"><strong>swarmauri_agent_image_skill</strong></p>
31
+ <p align="center">Select packaged image generation and signing skills and run their tools.</p>
32
+ <p align="center">
33
+ <a href="https://pypi.org/project/swarmauri_agent_image_skill/"><img alt="pypi: swarmauri_agent_image_skill unpublished" src="https://img.shields.io/static/v1?label=pypi&amp;message=swarmauri_agent_image_skill%20unpublished&amp;labelColor=292421&amp;color=805500"></a>
34
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/pyproject.toml"><img alt="Source version: 0.1.0" src="https://img.shields.io/static/v1?label=Source%20version&amp;message=0.1.0&amp;labelColor=292421&amp;color=994525"></a>
35
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/pyproject.toml"><img alt="Python: &gt;=3.10,&lt;3.15" src="https://img.shields.io/static/v1?label=Python&amp;message=%3E%3D3.10%2C%3C3.15&amp;labelColor=292421&amp;color=994525"></a>
36
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/pyproject.toml"><img alt="Layer: plugins" src="https://img.shields.io/static/v1?label=Layer&amp;message=plugins&amp;labelColor=292421&amp;color=994525"></a>
37
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&amp;message=active&amp;labelColor=292421&amp;color=24654A"></a>
38
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&amp;message=Apache-2.0&amp;labelColor=292421&amp;color=994525"></a>
39
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&amp;message=attribution&amp;labelColor=292421&amp;color=994525"></a>
40
+ </p>
41
+ <p align="center">
42
+ <a href="https://pypi.org/project/swarmauri_agent_image_skill/"><img alt="pypi downloads: swarmauri_agent_image_skill: unpublished" src="https://img.shields.io/static/v1?label=pypi%20downloads&amp;message=swarmauri_agent_image_skill%3A%20unpublished&amp;labelColor=292421&amp;color=805500"></a>
43
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/README.md"><img alt="README hits: swarmauri_agent_image_skill" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/60-plugins/swarmauri_agent_image_skill/README.md.svg?label=README%20hits&amp;labelColor=292421&amp;color=08704E"></a>
44
+ </p>
45
+ <p align="center">
46
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&amp;message=CI%20gate&amp;labelColor=292421&amp;color=67437E"></a>
47
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&amp;message=example%20source&amp;labelColor=292421&amp;color=67437E"></a>
48
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&amp;message=not%20certified&amp;labelColor=292421&amp;color=805500"></a>
49
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&amp;message=repository%20policy&amp;labelColor=292421&amp;color=67437E"></a>
50
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&amp;message=source%20and%20CI&amp;labelColor=292421&amp;color=67437E"></a>
51
+ </p>
52
+ <p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
53
+ <!-- readme-standards:end branding -->
54
+
55
+ ---
56
+
57
+ ## Overview
58
+
59
+ ### Summary
60
+
61
+ Select packaged image generation and signing skills and run their tools.
62
+
63
+ ### Why This Package
64
+
65
+ This package provides skill activation, image generation, structured signing results for applications using the Swarmauri SDK.
66
+
67
+ ### When to Use
68
+
69
+ Use this component when an application needs the image workflow described in the usage examples.
70
+
71
+ ### Features
72
+
73
+ - Skill activation.
74
+ - Image generation.
75
+ - Structured signing results.
76
+
77
+ ### Non-Goals
78
+
79
+ Provider accounts, storage credentials, and signing identities are configured by the application.
80
+
81
+ ---
82
+
83
+ ## Getting Started
84
+
85
+ ### Prerequisites
86
+
87
+ The package supports Python 3.10 through 3.14. Install any application-specific provider or adapter used in your workflow.
88
+
89
+ ### Installation
90
+
91
+ #### Install with uv
92
+
93
+ <!-- readme-standards:begin installation.uv -->
94
+ `swarmauri_agent_image_skill` is not declared published. From the source checkout:
95
+
96
+ ```bash
97
+ uv pip install .
98
+ ```
99
+ <!-- readme-standards:end installation.uv -->
100
+
101
+ From a Swarmauri SDK checkout, run `uv sync --directory pkgs --package swarmauri_agent_image_skill`.
102
+
103
+ #### Install with pip
104
+
105
+ <!-- readme-standards:begin installation.pip -->
106
+ `swarmauri_agent_image_skill` is not declared published. From the source checkout:
107
+
108
+ ```bash
109
+ python -m pip install .
110
+ ```
111
+ <!-- readme-standards:end installation.pip -->
112
+
113
+ From the wheelhouse containing the SDK dependency builds, run `python -m pip install --find-links dist swarmauri_agent_image_skill`.
114
+
115
+ #### Install with Poetry
116
+
117
+ <!-- readme-standards:begin installation.poetry -->
118
+ `swarmauri_agent_image_skill` is not declared published. From a separate Poetry project, replace the path with your checkout:
119
+
120
+ ```bash
121
+ poetry add /path/to/swarmauri_agent_image_skill
122
+ ```
123
+ <!-- readme-standards:end installation.poetry -->
124
+
125
+ ### Quick Start
126
+
127
+ #### Example
128
+
129
+ <!-- readme-standards:begin example.quick-start -->
130
+ Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/docs/readme/quick_start.py).
131
+
132
+ ```python
133
+ from swarmauri_agent_image_skill import ImageSkillAgent
134
+
135
+
136
+ def run(model, toolkit):
137
+ agent = ImageSkillAgent(llm=model, toolkit=toolkit)
138
+ return agent.exec(
139
+ "Generate an image of a blue ceramic mug and sign it.",
140
+ skill_names=["image-generation", "image-signing"],
141
+ )
142
+ ```
143
+ <!-- readme-standards:end example.quick-start -->
144
+
145
+ #### Expected Result
146
+
147
+ The example shows the package’s configuration and workflow entry point.
148
+
149
+ ---
150
+
151
+ ## Usage
152
+
153
+ ### Common Workflows
154
+
155
+ Pass an IToolStepModel instance and an ImageToolkit configured as shown in the toolkit guide. The example explicitly selects two skills. Omit skill_names to select skills from request terms. Set the toolkit policy to always for guaranteed signing. Verify the exported files using the SignImageTool guide.
156
+
157
+ <!-- readme-standards:begin example.usage -->
158
+ Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/docs/readme/usage.py).
159
+
160
+ ```python
161
+ from pathlib import Path
162
+
163
+ from swarmauri_agent_image_skill import ImageSkillAgent
164
+
165
+
166
+ def export(model, toolkit, destination: Path):
167
+ agent = ImageSkillAgent(llm=model, toolkit=toolkit)
168
+ result = agent.exec(
169
+ "Generate an image of a blue ceramic mug and sign it.",
170
+ skill_names=["image-generation", "image-signing"],
171
+ )
172
+ if not result.signing_results:
173
+ raise RuntimeError("No image signature was returned")
174
+ signature = result.signing_results[0]
175
+ artifact_id = signature["artifact_id"]
176
+ destination.write_bytes(toolkit.read_image(artifact_id))
177
+ destination.with_suffix(".jws.json").write_bytes(
178
+ toolkit.read_signature(artifact_id, signature["signature_id"])
179
+ )
180
+ return result
181
+ ```
182
+ <!-- readme-standards:end example.usage -->
183
+
184
+ **Expected output.** With `Path("mug.png")`, a successful run writes `mug.png` and `mug.jws.json`. The returned `ImageAgentResult` includes the generated image and its signature reference.
185
+
186
+ | Field | Example value |
187
+ |---|---|
188
+ | `status` | `completed` |
189
+ | `images[0]["signing_status"]` | `signed` |
190
+ | `signing_results[0]["status"]` | `signed` |
191
+
192
+ ### Configuration
193
+
194
+ Use the public constructor or loader shown above. The caller supplies application-specific collaborators when constructing a component.
195
+
196
+ ### Error Handling
197
+
198
+ Check the structured tool or agent outcome before using image references or reporting that signing succeeded.
199
+
200
+ ### Best Practices
201
+
202
+ Use a distinct storage scope per authorized session and retrieve images through the toolkit after publication.
203
+
204
+ ---
205
+
206
+ ## Package Boundary
207
+
208
+ ### What It Owns
209
+
210
+ Select packaged image generation and signing skills and run their tools.
211
+
212
+ ### Public API and Import Surfaces
213
+
214
+ Import `ImageSkillAgent` from `swarmauri_agent_image_skill`.
215
+
216
+ ### Entry Points
217
+
218
+ <!-- readme-standards:begin entry-points -->
219
+ - `swarmauri.agents` → `ImageSkillAgent` → `swarmauri_agent_image_skill:ImageSkillAgent`
220
+ <!-- readme-standards:end entry-points -->
221
+
222
+ ### Injected Dependencies
223
+
224
+ Inject the collaborators required by your application through the public constructor.
225
+
226
+ ### Protocol Consumers
227
+
228
+ Swarmauri applications can use this component through the corresponding SDK resource family.
229
+
230
+ ### Extensions
231
+
232
+ Supply compatible SDK components through the inputs shown in the examples.
233
+
234
+ ---
235
+
236
+ ## Operations and Readiness
237
+
238
+ ### Operational Requirements
239
+
240
+ Set up the application collaborators listed above before running the workflow. Use a test provider and isolated scope for local verification.
241
+
242
+ ### Health and Observability
243
+
244
+ Check tool outcomes, provider health, and storage availability in the application.
245
+
246
+ ### Security and Resource Limits
247
+
248
+ Set provider and storage limits at the application boundary. Keep signing keys in the configured key provider.
249
+
250
+ ### Compatibility
251
+
252
+ Python 3.10 through 3.14. Check the Python support of any provider adapter installed alongside this package.
253
+
254
+ ---
255
+
256
+ ## Verification
257
+
258
+ ### Tests
259
+
260
+ Run the package’s pytest suite from the SDK workspace.
261
+
262
+ ### Certification Status
263
+
264
+ The package is in planning status. Its tests are available in the repository.
265
+
266
+ ### Evidence
267
+
268
+ The package tests and maintained example sources are available alongside its manifest.
269
+
270
+ ---
271
+
272
+ ## FAQ
273
+
274
+ ### Why
275
+
276
+ Select packaged image generation and signing skills and run their tools.
277
+
278
+ ### How
279
+
280
+ Use the installation instructions and the workflow examples in this guide.
281
+
282
+ ### When
283
+
284
+ Use it when your image workflow needs skill activation, image generation, structured signing results.
285
+
286
+ ---
287
+
288
+ ## Documentation and Related Packages
289
+
290
+ ### More Documentation
291
+
292
+ See the maintained example sources under `docs/readme`.
293
+
294
+ ### Related Packages
295
+
296
+ See the SDK package index for the image tools, toolkit, agents, and packaged skills.
297
+
298
+ ### Project Links
299
+
300
+ <!-- readme-standards:begin project-links -->
301
+ - [Repository](https://github.com/swarmauri/swarmauri-sdk)
302
+ - [pypi: swarmauri_agent_image_skill](https://pypi.org/project/swarmauri_agent_image_skill/)
303
+ <!-- readme-standards:end project-links -->
304
+
305
+ ---
306
+
307
+ ## Contributing
308
+
309
+ ### How to Contribute
310
+
311
+ Follow the SDK contribution guide and keep workflow examples in sync with the public API.
312
+
313
+ ### Development Setup
314
+
315
+ Use the SDK uv workspace and run the package’s lint and test commands.
316
+
317
+ ### Notes for Maintainers
318
+
319
+ Keep the package import path and registered component name aligned with the manifest.
320
+
321
+ ---
322
+
323
+ ## Governance
324
+
325
+ ### Ownership and Decision Making
326
+
327
+ The Swarmauri SDK maintainers review changes to this package.
328
+
329
+ ### Standards and Policies
330
+
331
+ Follow the SDK contribution and package README policies.
332
+
333
+ ### Lifecycle and Migration
334
+
335
+ This is a new package in planning status.
336
+
337
+ ---
338
+
339
+ ## License and Attribution
340
+
341
+ ### License
342
+
343
+ <!-- readme-standards:begin license -->
344
+ Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/LICENSE).
345
+ <!-- readme-standards:end license -->
346
+
347
+ ### Notices
348
+
349
+ <!-- readme-standards:begin notices -->
350
+ See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/NOTICE) for attribution.
351
+ <!-- readme-standards:end notices -->
352
+
@@ -0,0 +1,326 @@
1
+ # swarmauri_agent_image_skill
2
+
3
+ <!-- readme-standards:begin branding -->
4
+ <p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
5
+ <p align="center"><strong>swarmauri_agent_image_skill</strong></p>
6
+ <p align="center">Select packaged image generation and signing skills and run their tools.</p>
7
+ <p align="center">
8
+ <a href="https://pypi.org/project/swarmauri_agent_image_skill/"><img alt="pypi: swarmauri_agent_image_skill unpublished" src="https://img.shields.io/static/v1?label=pypi&amp;message=swarmauri_agent_image_skill%20unpublished&amp;labelColor=292421&amp;color=805500"></a>
9
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/pyproject.toml"><img alt="Source version: 0.1.0" src="https://img.shields.io/static/v1?label=Source%20version&amp;message=0.1.0&amp;labelColor=292421&amp;color=994525"></a>
10
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/pyproject.toml"><img alt="Python: &gt;=3.10,&lt;3.15" src="https://img.shields.io/static/v1?label=Python&amp;message=%3E%3D3.10%2C%3C3.15&amp;labelColor=292421&amp;color=994525"></a>
11
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/pyproject.toml"><img alt="Layer: plugins" src="https://img.shields.io/static/v1?label=Layer&amp;message=plugins&amp;labelColor=292421&amp;color=994525"></a>
12
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&amp;message=active&amp;labelColor=292421&amp;color=24654A"></a>
13
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&amp;message=Apache-2.0&amp;labelColor=292421&amp;color=994525"></a>
14
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&amp;message=attribution&amp;labelColor=292421&amp;color=994525"></a>
15
+ </p>
16
+ <p align="center">
17
+ <a href="https://pypi.org/project/swarmauri_agent_image_skill/"><img alt="pypi downloads: swarmauri_agent_image_skill: unpublished" src="https://img.shields.io/static/v1?label=pypi%20downloads&amp;message=swarmauri_agent_image_skill%3A%20unpublished&amp;labelColor=292421&amp;color=805500"></a>
18
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/README.md"><img alt="README hits: swarmauri_agent_image_skill" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/60-plugins/swarmauri_agent_image_skill/README.md.svg?label=README%20hits&amp;labelColor=292421&amp;color=08704E"></a>
19
+ </p>
20
+ <p align="center">
21
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&amp;message=CI%20gate&amp;labelColor=292421&amp;color=67437E"></a>
22
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&amp;message=example%20source&amp;labelColor=292421&amp;color=67437E"></a>
23
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&amp;message=not%20certified&amp;labelColor=292421&amp;color=805500"></a>
24
+ <a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&amp;message=repository%20policy&amp;labelColor=292421&amp;color=67437E"></a>
25
+ <a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&amp;message=source%20and%20CI&amp;labelColor=292421&amp;color=67437E"></a>
26
+ </p>
27
+ <p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
28
+ <!-- readme-standards:end branding -->
29
+
30
+ ---
31
+
32
+ ## Overview
33
+
34
+ ### Summary
35
+
36
+ Select packaged image generation and signing skills and run their tools.
37
+
38
+ ### Why This Package
39
+
40
+ This package provides skill activation, image generation, structured signing results for applications using the Swarmauri SDK.
41
+
42
+ ### When to Use
43
+
44
+ Use this component when an application needs the image workflow described in the usage examples.
45
+
46
+ ### Features
47
+
48
+ - Skill activation.
49
+ - Image generation.
50
+ - Structured signing results.
51
+
52
+ ### Non-Goals
53
+
54
+ Provider accounts, storage credentials, and signing identities are configured by the application.
55
+
56
+ ---
57
+
58
+ ## Getting Started
59
+
60
+ ### Prerequisites
61
+
62
+ The package supports Python 3.10 through 3.14. Install any application-specific provider or adapter used in your workflow.
63
+
64
+ ### Installation
65
+
66
+ #### Install with uv
67
+
68
+ <!-- readme-standards:begin installation.uv -->
69
+ `swarmauri_agent_image_skill` is not declared published. From the source checkout:
70
+
71
+ ```bash
72
+ uv pip install .
73
+ ```
74
+ <!-- readme-standards:end installation.uv -->
75
+
76
+ From a Swarmauri SDK checkout, run `uv sync --directory pkgs --package swarmauri_agent_image_skill`.
77
+
78
+ #### Install with pip
79
+
80
+ <!-- readme-standards:begin installation.pip -->
81
+ `swarmauri_agent_image_skill` is not declared published. From the source checkout:
82
+
83
+ ```bash
84
+ python -m pip install .
85
+ ```
86
+ <!-- readme-standards:end installation.pip -->
87
+
88
+ From the wheelhouse containing the SDK dependency builds, run `python -m pip install --find-links dist swarmauri_agent_image_skill`.
89
+
90
+ #### Install with Poetry
91
+
92
+ <!-- readme-standards:begin installation.poetry -->
93
+ `swarmauri_agent_image_skill` is not declared published. From a separate Poetry project, replace the path with your checkout:
94
+
95
+ ```bash
96
+ poetry add /path/to/swarmauri_agent_image_skill
97
+ ```
98
+ <!-- readme-standards:end installation.poetry -->
99
+
100
+ ### Quick Start
101
+
102
+ #### Example
103
+
104
+ <!-- readme-standards:begin example.quick-start -->
105
+ Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/docs/readme/quick_start.py).
106
+
107
+ ```python
108
+ from swarmauri_agent_image_skill import ImageSkillAgent
109
+
110
+
111
+ def run(model, toolkit):
112
+ agent = ImageSkillAgent(llm=model, toolkit=toolkit)
113
+ return agent.exec(
114
+ "Generate an image of a blue ceramic mug and sign it.",
115
+ skill_names=["image-generation", "image-signing"],
116
+ )
117
+ ```
118
+ <!-- readme-standards:end example.quick-start -->
119
+
120
+ #### Expected Result
121
+
122
+ The example shows the package’s configuration and workflow entry point.
123
+
124
+ ---
125
+
126
+ ## Usage
127
+
128
+ ### Common Workflows
129
+
130
+ Pass an IToolStepModel instance and an ImageToolkit configured as shown in the toolkit guide. The example explicitly selects two skills. Omit skill_names to select skills from request terms. Set the toolkit policy to always for guaranteed signing. Verify the exported files using the SignImageTool guide.
131
+
132
+ <!-- readme-standards:begin example.usage -->
133
+ Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/docs/readme/usage.py).
134
+
135
+ ```python
136
+ from pathlib import Path
137
+
138
+ from swarmauri_agent_image_skill import ImageSkillAgent
139
+
140
+
141
+ def export(model, toolkit, destination: Path):
142
+ agent = ImageSkillAgent(llm=model, toolkit=toolkit)
143
+ result = agent.exec(
144
+ "Generate an image of a blue ceramic mug and sign it.",
145
+ skill_names=["image-generation", "image-signing"],
146
+ )
147
+ if not result.signing_results:
148
+ raise RuntimeError("No image signature was returned")
149
+ signature = result.signing_results[0]
150
+ artifact_id = signature["artifact_id"]
151
+ destination.write_bytes(toolkit.read_image(artifact_id))
152
+ destination.with_suffix(".jws.json").write_bytes(
153
+ toolkit.read_signature(artifact_id, signature["signature_id"])
154
+ )
155
+ return result
156
+ ```
157
+ <!-- readme-standards:end example.usage -->
158
+
159
+ **Expected output.** With `Path("mug.png")`, a successful run writes `mug.png` and `mug.jws.json`. The returned `ImageAgentResult` includes the generated image and its signature reference.
160
+
161
+ | Field | Example value |
162
+ |---|---|
163
+ | `status` | `completed` |
164
+ | `images[0]["signing_status"]` | `signed` |
165
+ | `signing_results[0]["status"]` | `signed` |
166
+
167
+ ### Configuration
168
+
169
+ Use the public constructor or loader shown above. The caller supplies application-specific collaborators when constructing a component.
170
+
171
+ ### Error Handling
172
+
173
+ Check the structured tool or agent outcome before using image references or reporting that signing succeeded.
174
+
175
+ ### Best Practices
176
+
177
+ Use a distinct storage scope per authorized session and retrieve images through the toolkit after publication.
178
+
179
+ ---
180
+
181
+ ## Package Boundary
182
+
183
+ ### What It Owns
184
+
185
+ Select packaged image generation and signing skills and run their tools.
186
+
187
+ ### Public API and Import Surfaces
188
+
189
+ Import `ImageSkillAgent` from `swarmauri_agent_image_skill`.
190
+
191
+ ### Entry Points
192
+
193
+ <!-- readme-standards:begin entry-points -->
194
+ - `swarmauri.agents` → `ImageSkillAgent` → `swarmauri_agent_image_skill:ImageSkillAgent`
195
+ <!-- readme-standards:end entry-points -->
196
+
197
+ ### Injected Dependencies
198
+
199
+ Inject the collaborators required by your application through the public constructor.
200
+
201
+ ### Protocol Consumers
202
+
203
+ Swarmauri applications can use this component through the corresponding SDK resource family.
204
+
205
+ ### Extensions
206
+
207
+ Supply compatible SDK components through the inputs shown in the examples.
208
+
209
+ ---
210
+
211
+ ## Operations and Readiness
212
+
213
+ ### Operational Requirements
214
+
215
+ Set up the application collaborators listed above before running the workflow. Use a test provider and isolated scope for local verification.
216
+
217
+ ### Health and Observability
218
+
219
+ Check tool outcomes, provider health, and storage availability in the application.
220
+
221
+ ### Security and Resource Limits
222
+
223
+ Set provider and storage limits at the application boundary. Keep signing keys in the configured key provider.
224
+
225
+ ### Compatibility
226
+
227
+ Python 3.10 through 3.14. Check the Python support of any provider adapter installed alongside this package.
228
+
229
+ ---
230
+
231
+ ## Verification
232
+
233
+ ### Tests
234
+
235
+ Run the package’s pytest suite from the SDK workspace.
236
+
237
+ ### Certification Status
238
+
239
+ The package is in planning status. Its tests are available in the repository.
240
+
241
+ ### Evidence
242
+
243
+ The package tests and maintained example sources are available alongside its manifest.
244
+
245
+ ---
246
+
247
+ ## FAQ
248
+
249
+ ### Why
250
+
251
+ Select packaged image generation and signing skills and run their tools.
252
+
253
+ ### How
254
+
255
+ Use the installation instructions and the workflow examples in this guide.
256
+
257
+ ### When
258
+
259
+ Use it when your image workflow needs skill activation, image generation, structured signing results.
260
+
261
+ ---
262
+
263
+ ## Documentation and Related Packages
264
+
265
+ ### More Documentation
266
+
267
+ See the maintained example sources under `docs/readme`.
268
+
269
+ ### Related Packages
270
+
271
+ See the SDK package index for the image tools, toolkit, agents, and packaged skills.
272
+
273
+ ### Project Links
274
+
275
+ <!-- readme-standards:begin project-links -->
276
+ - [Repository](https://github.com/swarmauri/swarmauri-sdk)
277
+ - [pypi: swarmauri_agent_image_skill](https://pypi.org/project/swarmauri_agent_image_skill/)
278
+ <!-- readme-standards:end project-links -->
279
+
280
+ ---
281
+
282
+ ## Contributing
283
+
284
+ ### How to Contribute
285
+
286
+ Follow the SDK contribution guide and keep workflow examples in sync with the public API.
287
+
288
+ ### Development Setup
289
+
290
+ Use the SDK uv workspace and run the package’s lint and test commands.
291
+
292
+ ### Notes for Maintainers
293
+
294
+ Keep the package import path and registered component name aligned with the manifest.
295
+
296
+ ---
297
+
298
+ ## Governance
299
+
300
+ ### Ownership and Decision Making
301
+
302
+ The Swarmauri SDK maintainers review changes to this package.
303
+
304
+ ### Standards and Policies
305
+
306
+ Follow the SDK contribution and package README policies.
307
+
308
+ ### Lifecycle and Migration
309
+
310
+ This is a new package in planning status.
311
+
312
+ ---
313
+
314
+ ## License and Attribution
315
+
316
+ ### License
317
+
318
+ <!-- readme-standards:begin license -->
319
+ Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/LICENSE).
320
+ <!-- readme-standards:end license -->
321
+
322
+ ### Notices
323
+
324
+ <!-- readme-standards:begin notices -->
325
+ See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/NOTICE) for attribution.
326
+ <!-- readme-standards:end notices -->
@@ -0,0 +1,101 @@
1
+ [project]
2
+ name = "swarmauri_agent_image_skill"
3
+ version = "0.1.0"
4
+ description = "Select packaged image generation and signing skills and run their tools."
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE", "NOTICE"]
8
+ requires-python = ">=3.10,<3.15"
9
+ authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
10
+ keywords = ["swarmauri","agents","skill activation","image generation","structured signing results"]
11
+ classifiers = [
12
+ "Development Status :: 1 - Planning",
13
+ "Programming Language :: Python :: 3.10",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
18
+ ]
19
+ dependencies = [
20
+ "swarmauri_agent_image_tool>=0.1,<0.2",
21
+ "swarmauri_base>=0.11.0,<0.12",
22
+ "swarmauri_core>=0.11.0,<0.12",
23
+ "swarmauri_skill_image_generation>=0.1,<0.2",
24
+ "swarmauri_skill_image_signing>=0.1,<0.2",
25
+ ]
26
+
27
+ [project.urls]
28
+ Repository = "https://github.com/swarmauri/swarmauri-sdk"
29
+
30
+ [project.entry-points."swarmauri.agents"]
31
+ ImageSkillAgent = "swarmauri_agent_image_skill:ImageSkillAgent"
32
+
33
+ [tool.uv.sources]
34
+ swarmauri_agent_image_tool = { workspace = true }
35
+ swarmauri_base = { workspace = true }
36
+ swarmauri_core = { workspace = true }
37
+ swarmauri_keyprovider_inmemory = { workspace = true }
38
+ swarmauri_skill_image_generation = { workspace = true }
39
+ swarmauri_skill_image_signing = { workspace = true }
40
+ swarmauri_storage_memory = { workspace = true }
41
+ swarmauri_storage_file = { workspace = true }
42
+ swarmauri_standard = { workspace = true }
43
+
44
+ [tool.pytest.ini_options]
45
+ markers = ["unit: Unit tests", "i9n: Integration tests"]
46
+
47
+ [build-system]
48
+ requires = ["poetry-core>=2.2"]
49
+ build-backend = "poetry.core.masonry.api"
50
+
51
+ [dependency-groups]
52
+ dev = ["pytest>=8", "ruff>=0.9.9", "readme-standards==0.1.6; python_version >= '3.11'", "swarmauri_keyprovider_inmemory", "swarmauri_storage_memory", "swarmauri_storage_file", "swarmauri_standard; python_version >= '3.11'"]
53
+
54
+ [tool.readme_standards]
55
+ policy = "package-guide-v1"
56
+ readme = "README.md"
57
+ brand = "swarmauri"
58
+ brand_catalog = "../../../tools/readme/brands.toml"
59
+ repository = "https://github.com/swarmauri/swarmauri-sdk"
60
+ ref = "master"
61
+ package_path = "pkgs/60-plugins/swarmauri_agent_image_skill"
62
+ layer = "plugins"
63
+ lifecycle = "active"
64
+ license_file = "LICENSE"
65
+ notice_file = "NOTICE"
66
+
67
+ [tool.readme_standards.distributions.pypi]
68
+ name = "swarmauri_agent_image_skill"
69
+ published = false
70
+
71
+ [tool.readme_standards.examples.quick_start]
72
+ source = "docs/readme/quick_start.py"
73
+ test = "tests/unit/test_readme_sources.py"
74
+ language = "python"
75
+ expected_exit_code = 0
76
+
77
+ [tool.readme_standards.examples.usage]
78
+ source = "docs/readme/usage.py"
79
+ test = "tests/unit/test_readme_sources.py"
80
+ language = "python"
81
+ expected_exit_code = 0
82
+
83
+ [tool.readme_standards.statuses.readme]
84
+ label = "CI gate"
85
+ url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
86
+
87
+ [tool.readme_standards.statuses.tests]
88
+ label = "example source"
89
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/tests/unit/test_readme_sources.py"
90
+
91
+ [tool.readme_standards.statuses.certification]
92
+ label = "not certified"
93
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/60-plugins/swarmauri_agent_image_skill/README.md#certification-status"
94
+
95
+ [tool.readme_standards.statuses.governance]
96
+ label = "repository policy"
97
+ url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"
98
+
99
+ [tool.readme_standards.statuses.evidence]
100
+ label = "source and CI"
101
+ url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
@@ -0,0 +1,97 @@
1
+ """Select packaged image skills and execute them through the image toolkit."""
2
+
3
+ import asyncio
4
+ import re
5
+ from collections.abc import Sequence
6
+ from typing import Literal
7
+
8
+ from pydantic import Field
9
+ from swarmauri_agent_image_tool import ImageAgentResult, ImageToolAgent
10
+ from swarmauri_base.agents.AgentBase import AgentBase
11
+ from swarmauri_base.ComponentBase import ComponentBase
12
+ from swarmauri_base.skills.SkillBase import SkillBase
13
+ from swarmauri_base.skills.SkillCatalog import SkillCatalog
14
+ from swarmauri_core.messages.IMessage import IMessage
15
+ from swarmauri_skill_image_generation import ImageGenerationSkill
16
+ from swarmauri_skill_image_signing import ImageSigningSkill
17
+
18
+
19
+ @ComponentBase.register_type(AgentBase, "ImageSkillAgent")
20
+ class ImageSkillAgent(ImageToolAgent):
21
+ """Run only the tools declared by the skills selected for a request."""
22
+
23
+ type: Literal["ImageSkillAgent"] = "ImageSkillAgent"
24
+ skills: list[SkillBase] = Field(
25
+ default_factory=lambda: [
26
+ ImageGenerationSkill.from_default(),
27
+ ImageSigningSkill.from_default(),
28
+ ],
29
+ exclude=True,
30
+ )
31
+
32
+ def exec(
33
+ self,
34
+ input_str: str | IMessage | None = "",
35
+ llm_kwargs: dict | None = None,
36
+ *,
37
+ skill_names: Sequence[str] | None = None,
38
+ ) -> ImageAgentResult:
39
+ """Select the image skills and run their declared toolset."""
40
+ if llm_kwargs:
41
+ raise ValueError(
42
+ "Configure tool-step model options on the model instance"
43
+ )
44
+ prompt = self._prompt(input_str)
45
+ catalog = SkillCatalog(
46
+ self.skills,
47
+ factories={
48
+ name: lambda name=name: self.toolkit.get_tool_by_name(name)
49
+ for name in self.toolkit.tools
50
+ },
51
+ )
52
+ if skill_names is None:
53
+ normalized = prompt.casefold()
54
+ skill_names = [
55
+ name
56
+ for name, skill in catalog.skills.items()
57
+ if any(
58
+ re.search(
59
+ r"\b" + re.escape(trigger.strip().casefold()) + r"\b",
60
+ normalized,
61
+ )
62
+ for trigger in skill.metadata.get("triggers", name).split(
63
+ ","
64
+ )
65
+ if trigger.strip()
66
+ )
67
+ ]
68
+ missing = set(skill_names).difference(catalog.skills)
69
+ if missing:
70
+ raise ValueError(
71
+ f"Unknown image skills: {', '.join(sorted(missing))}"
72
+ )
73
+ selected = [
74
+ catalog.activate(name) for name in dict.fromkeys(skill_names)
75
+ ]
76
+ if not selected:
77
+ raise ValueError(
78
+ "No image skill matched. Supply an explicit skill name."
79
+ )
80
+ instructions = "\n\n".join(skill.instructions for skill in selected)
81
+ return self._run(
82
+ f"Image workflow instructions\n{instructions}\n\n"
83
+ f"User request\n{prompt}",
84
+ tool_names=catalog.active,
85
+ )
86
+
87
+ async def aexec(
88
+ self,
89
+ input_str: str | IMessage | None = "",
90
+ llm_kwargs: dict | None = None,
91
+ *,
92
+ skill_names: Sequence[str] | None = None,
93
+ ) -> ImageAgentResult:
94
+ """Run skill selection and execution off the event loop."""
95
+ return await asyncio.to_thread(
96
+ self.exec, input_str, llm_kwargs, skill_names=skill_names
97
+ )
@@ -0,0 +1,5 @@
1
+ """Select packaged image generation and signing skills and run their tools."""
2
+
3
+ from .ImageSkillAgent import ImageSkillAgent
4
+
5
+ __all__ = ["ImageSkillAgent"]