Class: SolidAgent::AgentManifest::Manifest

Inherits:
Object
  • Object
show all
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.

Examples:

Creating a manifest

manifest = Manifest.new(
  name: "research-assistant",
  model: "anthropic/claude-sonnet-4-20250514",
  description: "An agent that researches topics"
)

Validating a manifest

manifest.valid?  # => true/false
manifest.errors.full_messages  # => ["Name can't be blank"]

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#authorString?

Returns Author name or organization.

Returns:

  • (String, nil)

    Author name or organization



38
39
40
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 38

def author
  @author
end

#configHash

Returns Model-specific parameters (temperature, max_tokens, etc.).

Returns:

  • (Hash)

    Model-specific parameters (temperature, max_tokens, etc.)



57
58
59
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 57

def config
  @config
end

#descriptionString?

Returns Brief description (max 280 chars).

Returns:

  • (String, nil)

    Brief description (max 280 chars)



35
36
37
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 35

def description
  @description
end

#examplesArray<Hash>

Examples & Tests ===

Returns:

  • (Array<Hash>)

    Example inputs/outputs



93
94
95
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 93

def examples
  @examples
end

#extendsString?

Returns Parent agent to inherit from.

Returns:

  • (String, nil)

    Parent agent to inherit from



50
51
52
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 50

def extends
  @extends
end

#extensionsHash

Framework extensions ===

Returns:

  • (Hash)

    Framework-specific configuration (activeagent:, crewai:, etc.)



82
83
84
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 82

def extensions
  @extensions
end

#input_schemaInputSchema?

Schemas ===

Returns:



61
62
63
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 61

def input_schema
  @input_schema
end

#instructionsString?

Instructions ===

Returns:

  • (String, nil)

    Extracted instructions from template



75
76
77
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 75

def instructions
  @instructions
end

#licenseString?

Returns SPDX license identifier.

Returns:

  • (String, nil)

    SPDX license identifier



41
42
43
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 41

def license
  @license
end

#modelString?

Model configuration ===

Returns:

  • (String, nil)

    Model identifier (provider/model format)



54
55
56
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 54

def model
  @model
end

#nameString

Meta attributes ===

Returns:

  • (String)

    Unique identifier (lowercase, hyphens only)



29
30
31
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 29

def name
  @name
end

#output_schemaHash?

Returns Expected output format and structure.

Returns:

  • (Hash, nil)

    Expected output format and structure



64
65
66
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 64

def output_schema
  @output_schema
end

#repositoryString?

Returns Source repository URL.

Returns:

  • (String, nil)

    Source repository URL



44
45
46
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 44

def repository
  @repository
end

#resourcesArray<Resource>

Returns External data sources.

Returns:

  • (Array<Resource>)

    External data sources



71
72
73
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 71

def resources
  @resources
end

#source_formatSymbol?

Source tracking ===

Returns:

  • (Symbol, nil)

    Original format (:agent_md, :dotprompt, etc.)



86
87
88
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 86

def source_format
  @source_format
end

#source_pathString?

Returns Original file path.

Returns:

  • (String, nil)

    Original file path



89
90
91
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 89

def source_path
  @source_path
end

#tagsArray<String>

Returns Categorization tags.

Returns:

  • (Array<String>)

    Categorization tags



47
48
49
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 47

def tags
  @tags
end

#templateString?

Returns Full template content (with Liquid syntax).

Returns:

  • (String, nil)

    Full template content (with Liquid syntax)



78
79
80
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 78

def template
  @template
end

#testsArray<Hash>

Returns Test cases.

Returns:

  • (Array<Hash>)

    Test cases



96
97
98
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 96

def tests
  @tests
end

#toolsArray<Tool>

Tools & Resources ===

Returns:

  • (Array<Tool>)

    Available tools



68
69
70
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 68

def tools
  @tools
end

#versionString

Returns SemVer version string (default: "1.0.0").

Returns:

  • (String)

    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_configHash

Returns ActiveAgent-specific configuration.

Returns:

  • (Hash)

    ActiveAgent-specific configuration



149
150
151
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 149

def activeagent_config
  extensions[:activeagent] || extensions["activeagent"] || {}
end

#checksumString Also known as: digest

Generate MD5 checksum of manifest content

Returns:

  • (String)

    32-character hex digest



236
237
238
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 236

def checksum
  Digest::MD5.hexdigest(to_h.to_json)
end

#config_checksumString

Generate checksum of model configuration

Returns:

  • (String)

    Hex digest of model + config



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_configHash

Returns CrewAI-specific configuration.

Returns:

  • (Hash)

    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

Returns:

  • (Boolean)


217
218
219
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 217

def extends?
  extends.present?
end

#fingerprintString

Short identifier combining name, version, and checksum prefix

Returns:

  • (String)

    e.g., "research-agent@1.0.0#a1b2c3d4"



277
278
279
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 277

def fingerprint
  "#{name}@#{version}##{checksum[0..7]}"
end

#genkit_configHash

Returns Genkit/Dotprompt-specific configuration.

Returns:

  • (Hash)

    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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


203
204
205
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 203

def has_tools?
  tools.any?
end

#instructions_checksumString?

Generate checksum of instructions only

Returns:

  • (String, nil)

    Hex digest or nil if no instructions



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_configHash

Returns LangChain-specific configuration.

Returns:

  • (Hash)

    LangChain-specific configuration



159
160
161
# File 'lib/solid_agent/agent_manifest/manifest.rb', line 159

def langchain_config
  extensions[:langchain] || extensions["langchain"] || {}
end

#provenanceHash

Generate full provenance record

Returns:

  • (Hash)

    Provenance data for tracing



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_hHash

Convert manifest to a hash representation

Returns:

  • (Hash)

    Hash representation suitable for serialization



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: author,
    license: license,
    repository: repository,
    tags: 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

Returns:

  • (String)

    JSON representation



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

Parameters:

  • tool_name (String, Symbol)

    Name of the tool

Returns:



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