Class: SolidAgent::AgentManifest::Manifest
- Inherits:
-
Object
- Object
- SolidAgent::AgentManifest::Manifest
- Includes:
- ActiveModel::Model, ActiveModel::Validations
- Defined in:
- lib/solid_agent/agent_manifest/manifest.rb
Overview
Manifest represents a unified, portable AI agent definition.
It serves as the canonical internal representation that all parsers produce and all exporters consume, enabling cross-framework compatibility.
Instance Attribute Summary collapse
-
#author ⇒ String?
Author name or organization.
-
#config ⇒ Hash
Model-specific parameters (temperature, max_tokens, etc.).
-
#description ⇒ String?
Brief description (max 280 chars).
-
#examples ⇒ Array<Hash>
Examples & Tests ===.
-
#extends ⇒ String?
Parent agent to inherit from.
-
#extensions ⇒ Hash
Framework extensions ===.
-
#input_schema ⇒ InputSchema?
Schemas ===.
-
#instructions ⇒ String?
Instructions ===.
-
#license ⇒ String?
SPDX license identifier.
-
#model ⇒ String?
Model configuration ===.
-
#name ⇒ String
Meta attributes ===.
-
#output_schema ⇒ Hash?
Expected output format and structure.
-
#repository ⇒ String?
Source repository URL.
-
#resources ⇒ Array<Resource>
External data sources.
-
#source_format ⇒ Symbol?
Source tracking ===.
-
#source_path ⇒ String?
Original file path.
-
#tags ⇒ Array<String>
Categorization tags.
-
#template ⇒ String?
Full template content (with Liquid syntax).
-
#tests ⇒ Array<Hash>
Test cases.
-
#tools ⇒ Array<Tool>
Tools & Resources ===.
-
#version ⇒ String
SemVer version string (default: "1.0.0").
Instance Method Summary collapse
-
#activeagent_config ⇒ Hash
ActiveAgent-specific configuration.
-
#checksum ⇒ String
(also: #digest)
Generate MD5 checksum of manifest content.
-
#config_checksum ⇒ String
Generate checksum of model configuration.
-
#crewai_config ⇒ Hash
CrewAI-specific configuration.
-
#extends? ⇒ Boolean
Check if this manifest extends another agent.
-
#fingerprint ⇒ String
Short identifier combining name, version, and checksum prefix.
-
#genkit_config ⇒ Hash
Genkit/Dotprompt-specific configuration.
-
#has_resources? ⇒ Boolean
Check if this manifest has any resources defined.
-
#has_tools? ⇒ Boolean
Check if this manifest has any tools defined.
-
#initialize(attributes = {}) ⇒ Manifest
constructor
A new instance of Manifest.
-
#instructions_checksum ⇒ String?
Generate checksum of instructions only.
-
#langchain_config ⇒ Hash
LangChain-specific configuration.
-
#provenance ⇒ Hash
Generate full provenance record.
-
#to_h ⇒ Hash
Convert manifest to a hash representation.
-
#to_json(*args) ⇒ String
Convert to JSON string.
-
#tool(tool_name) ⇒ Tool?
Get tool by name.
Constructor Details
#initialize(attributes = {}) ⇒ Manifest
Returns a new instance of Manifest.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 123 def initialize(attributes = {}) # Set defaults before calling super @version = "1.0.0" @tags = [] @tools = [] @resources = [] @extensions = {} @config = {} @examples = [] @tests = [] super(attributes) # Ensure arrays and hashes are properly initialized even if nil was passed @tags ||= [] @tools ||= [] @resources ||= [] @extensions ||= {} @config ||= {} @examples ||= [] @tests ||= [] end |
Instance Attribute Details
#author ⇒ String?
Returns Author name or organization.
38 39 40 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 38 def @author end |
#config ⇒ Hash
Returns Model-specific parameters (temperature, max_tokens, etc.).
57 58 59 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 57 def config @config end |
#description ⇒ String?
Returns Brief description (max 280 chars).
35 36 37 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 35 def description @description end |
#examples ⇒ Array<Hash>
Examples & Tests ===
93 94 95 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 93 def examples @examples end |
#extends ⇒ String?
Returns Parent agent to inherit from.
50 51 52 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 50 def extends @extends end |
#extensions ⇒ Hash
Framework extensions ===
82 83 84 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 82 def extensions @extensions end |
#input_schema ⇒ InputSchema?
Schemas ===
61 62 63 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 61 def input_schema @input_schema end |
#instructions ⇒ String?
Instructions ===
75 76 77 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 75 def instructions @instructions end |
#license ⇒ String?
Returns SPDX license identifier.
41 42 43 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 41 def license @license end |
#model ⇒ String?
Model configuration ===
54 55 56 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 54 def model @model end |
#name ⇒ String
Meta attributes ===
29 30 31 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 29 def name @name end |
#output_schema ⇒ Hash?
Returns Expected output format and structure.
64 65 66 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 64 def output_schema @output_schema end |
#repository ⇒ String?
Returns Source repository URL.
44 45 46 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 44 def repository @repository end |
#resources ⇒ Array<Resource>
Returns External data sources.
71 72 73 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 71 def resources @resources end |
#source_format ⇒ Symbol?
Source tracking ===
86 87 88 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 86 def source_format @source_format end |
#source_path ⇒ String?
Returns Original file path.
89 90 91 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 89 def source_path @source_path end |
#tags ⇒ Array<String>
Returns Categorization tags.
47 48 49 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 47 def @tags end |
#template ⇒ String?
Returns Full template content (with Liquid syntax).
78 79 80 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 78 def template @template end |
#tests ⇒ Array<Hash>
Returns Test cases.
96 97 98 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 96 def tests @tests end |
#tools ⇒ Array<Tool>
Tools & Resources ===
68 69 70 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 68 def tools @tools end |
#version ⇒ String
Returns SemVer version string (default: "1.0.0").
32 33 34 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 32 def version @version end |
Instance Method Details
#activeagent_config ⇒ Hash
Returns ActiveAgent-specific configuration.
149 150 151 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 149 def activeagent_config extensions[:activeagent] || extensions["activeagent"] || {} end |
#checksum ⇒ String Also known as: digest
Generate MD5 checksum of manifest content
236 237 238 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 236 def checksum Digest::MD5.hexdigest(to_h.to_json) end |
#config_checksum ⇒ String
Generate checksum of model configuration
252 253 254 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 252 def config_checksum Digest::MD5.hexdigest({ model: model, config: config }.to_json) end |
#crewai_config ⇒ Hash
Returns CrewAI-specific configuration.
154 155 156 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 154 def crewai_config extensions[:crewai] || extensions["crewai"] || {} end |
#extends? ⇒ Boolean
Check if this manifest extends another agent
217 218 219 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 217 def extends? extends.present? end |
#fingerprint ⇒ String
Short identifier combining name, version, and checksum prefix
277 278 279 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 277 def fingerprint "#{name}@#{version}##{checksum[0..7]}" end |
#genkit_config ⇒ Hash
Returns Genkit/Dotprompt-specific configuration.
164 165 166 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 164 def genkit_config extensions[:genkit] || extensions["genkit"] || {} end |
#has_resources? ⇒ Boolean
Check if this manifest has any resources defined
210 211 212 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 210 def has_resources? resources.any? end |
#has_tools? ⇒ Boolean
Check if this manifest has any tools defined
203 204 205 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 203 def has_tools? tools.any? end |
#instructions_checksum ⇒ String?
Generate checksum of instructions only
244 245 246 247 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 244 def instructions_checksum return nil unless instructions.present? Digest::MD5.hexdigest(instructions) end |
#langchain_config ⇒ Hash
Returns LangChain-specific configuration.
159 160 161 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 159 def langchain_config extensions[:langchain] || extensions["langchain"] || {} end |
#provenance ⇒ Hash
Generate full provenance record
259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 259 def provenance { manifest_checksum: checksum, instructions_checksum: instructions_checksum, config_checksum: config_checksum, name: name, version: version, model: model, source_path: source_path, source_format: source_format, generated_at: Time.now.iso8601, tools_checksums: tools.map { |t| { name: t.name, checksum: Digest::MD5.hexdigest(t.to_h.to_json) } } }.compact end |
#to_h ⇒ Hash
Convert manifest to a hash representation
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 171 def to_h { name: name, version: version, description: description, author: , license: license, repository: repository, tags: .presence, extends: extends, model: model, config: config.presence, input_schema: input_schema&.to_h, output_schema: output_schema, tools: tools.map(&:to_h).presence, resources: resources.map(&:to_h).presence, instructions: instructions, template: template, extensions: extensions.presence }.compact end |
#to_json(*args) ⇒ String
Convert to JSON string
196 197 198 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 196 def to_json(*args) to_h.to_json(*args) end |
#tool(tool_name) ⇒ Tool?
Get tool by name
225 226 227 |
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 225 def tool(tool_name) tools.find { |t| t.name.to_s == tool_name.to_s } end |