Class: LittleGhost::AgentBuilder
- Inherits:
-
AssemblyBuilder
- Object
- AssemblyBuilder
- LittleGhost::AgentBuilder
- Defined in:
- lib/little_ghost/assembly_builder.rb
Overview
Builds an Agent definition from declarations made at runtime. Supported Agent class-DSL calls are recorded and replayed into each immutable snapshot.
Constant Summary collapse
- DECLARATIONS =
%i[ model limits result_schema capture_diagnostics system_template system_prompt tools prompt_local after_initialize before_invocation after_invocation before_model after_model after_model_error before_tool after_tool manage_context detect_tool_loops skills subagent subagents subagent_long_poll_duration agent_as_tool agents_as_tools assembly_as_tool assemblies_as_tools ].freeze
Instance Attribute Summary
Attributes inherited from AssemblyBuilder
Class Method Summary collapse
-
.assembly_kind ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#agent_id(value = nil) ⇒ Object
Reads or assigns the Agent identifier.
-
#initialize(**options) ⇒ AgentBuilder
constructor
Creates a mutable dynamic Agent definition.
-
#method_missing(name, *arguments, **keywords, &block) ⇒ Object
Records supported Agent class-DSL declarations for the next snapshot.
-
#respond_to_missing?(name, include_private = false) ⇒ Boolean
Reports the declarative methods supported by Agent.
Methods inherited from AssemblyBuilder
#as_tool, #ask, #assembly_id, #assembly_kind, #build, #call, #definition, #description, #start_execution, #stream, #stream_ask, #validate!
Constructor Details
#initialize(**options) ⇒ AgentBuilder
Creates a mutable dynamic Agent definition.
251 252 253 254 |
# File 'lib/little_ghost/assembly_builder.rb', line 251 def initialize(**) super @operations = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *arguments, **keywords, &block) ⇒ Object
Records supported Agent class-DSL declarations for the next snapshot.
262 263 264 265 266 267 |
# File 'lib/little_ghost/assembly_builder.rb', line 262 def method_missing(name, *arguments, **keywords, &block) return super unless DECLARATIONS.include?(name) @mutex.synchronize { @operations << [name, arguments, keywords, block] } self end |
Class Method Details
.assembly_kind ⇒ Object
:nodoc:
247 |
# File 'lib/little_ghost/assembly_builder.rb', line 247 def assembly_kind = :agent |
Instance Method Details
#agent_id(value = nil) ⇒ Object
Reads or assigns the Agent identifier.
257 258 259 |
# File 'lib/little_ghost/assembly_builder.rb', line 257 def agent_id(value = nil) value.nil? ? assembly_id : assembly_id(value) end |
#respond_to_missing?(name, include_private = false) ⇒ Boolean
Reports the declarative methods supported by Agent.
270 271 272 |
# File 'lib/little_ghost/assembly_builder.rb', line 270 def respond_to_missing?(name, include_private = false) DECLARATIONS.include?(name) || super end |