Module: SolidAgent
- Defined in:
- lib/solid_agent/has_tools.rb,
lib/solid_agent.rb,
lib/solid_agent/engine.rb,
lib/solid_agent/records.rb,
lib/solid_agent/version.rb,
lib/solid_agent/has_memory.rb,
lib/solid_agent/reasonable.rb,
lib/solid_agent/tool_cache.rb,
lib/solid_agent/has_context.rb,
lib/solid_agent/has_reasons.rb,
lib/solid_agent/model_naming.rb,
lib/solid_agent/model_pricing.rb,
lib/solid_agent/records/agent.rb,
lib/solid_agent/agent_manifest.rb,
lib/solid_agent/records/ownable.rb,
lib/solid_agent/run_fingerprint.rb,
lib/solid_agent/reasonable/reason.rb,
lib/solid_agent/records/agent_run.rb,
lib/solid_agent/agent_manifest/tool.rb,
lib/solid_agent/streams_tool_updates.rb,
lib/solid_agent/agent_manifest/errors.rb,
lib/solid_agent/records/agent_version.rb,
lib/solid_agent/records/agent_template.rb,
lib/solid_agent/agent_manifest/manifest.rb,
lib/solid_agent/agent_manifest/resource.rb,
lib/solid_agent/agent_manifest/validator.rb,
lib/solid_agent/agent_manifest/picoschema.rb,
lib/solid_agent/agent_manifest/input_schema.rb,
lib/solid_agent/agent_manifest/agent_builder.rb,
lib/solid_agent/agent_manifest/registry/auth.rb,
lib/generators/solid_agent/tool/tool_generator.rb,
lib/solid_agent/agent_manifest/parser_registry.rb,
lib/solid_agent/agent_manifest/registry/client.rb,
lib/generators/solid_agent/agent/agent_generator.rb,
lib/solid_agent/agent_manifest/exporter_registry.rb,
lib/solid_agent/agent_manifest/parsers/base_parser.rb,
lib/generators/solid_agent/context/context_generator.rb,
lib/generators/solid_agent/install/install_generator.rb,
lib/generators/solid_agent/reasons/reasons_generator.rb,
lib/solid_agent/agent_manifest/parsers/crewai_parser.rb,
lib/generators/solid_agent/manifest/manifest_generator.rb,
lib/solid_agent/agent_manifest/exporters/base_exporter.rb,
lib/solid_agent/agent_manifest/parsers/agent_md_parser.rb,
lib/solid_agent/agent_manifest/parsers/dotprompt_parser.rb,
lib/solid_agent/agent_manifest/exporters/crewai_exporter.rb,
lib/solid_agent/agent_manifest/exporters/agent_md_exporter.rb,
lib/solid_agent/agent_manifest/exporters/dotprompt_exporter.rb,
lib/solid_agent/agent_manifest/parsers/github_prompt_parser.rb,
sig/solid_agent.rbs
Overview
StreamsToolUpdates provides real-time UI feedback during tool execution.
When an agent is processing and calls tools (which may take time), this concern broadcasts status updates to the client so users see what's happening rather than a frozen UI. This is especially important for long-running tools like web browsing.
Defined Under Namespace
Modules: AgentManifest, Generators, HasContext, HasMemory, HasReasons, HasTools, ModelNaming, Reasonable, Records, RunFingerprint, StreamsToolUpdates, ToolCache Classes: Engine, Error, LoadError, ModelPricing
Constant Summary collapse
- VERSION =
"0.2.0"
Class Attribute Summary collapse
-
.context_class ⇒ Object
Returns the value of attribute context_class.
-
.execution_job_class ⇒ String
Job class enqueued by asynchronous execution, resolved at call time.
-
.generation_class ⇒ Object
Returns the value of attribute generation_class.
-
.message_class ⇒ Object
Returns the value of attribute message_class.
-
.run_executor ⇒ #call
Executes an agent record and returns its result.
Class Method Summary collapse
-
.agent(source, format: nil, base_class: nil, as: nil) ⇒ Class
Unified agent loading from any source.
-
.agents_from(directory, pattern: "**/*.agent.md", **options) ⇒ Array<Class>
Load multiple agents from a directory.
- .configure {|_self| ... } ⇒ Object
- .execution_job ⇒ Class?
-
.records_installed? ⇒ Boolean
Whether the agent-records models are present and backed by tables.
-
.reset_records_configuration! ⇒ void
Resets every records-layer configuration knob.
Class Attribute Details
.context_class ⇒ Object
Returns the value of attribute context_class.
33 34 35 |
# File 'lib/solid_agent.rb', line 33 def context_class @context_class end |
.execution_job_class ⇒ String
Job class enqueued by asynchronous execution, resolved at call time.
116 117 118 |
# File 'lib/solid_agent/records.rb', line 116 def execution_job_class @execution_job_class || "AgentExecutionJob" end |
.generation_class ⇒ Object
Returns the value of attribute generation_class.
33 34 35 |
# File 'lib/solid_agent.rb', line 33 def generation_class @generation_class end |
.message_class ⇒ Object
Returns the value of attribute message_class.
33 34 35 |
# File 'lib/solid_agent.rb', line 33 def @message_class end |
.run_executor ⇒ #call
Executes an agent record and returns its result.
Running an agent from a persisted configuration means building a class from stored provider/model/instructions and driving it — execution concerns, which belong to activeagent and to the host, not to a persistence gem. So the gem defines the seam and the host fills it.
The callable receives (agent_record, run) and must return a Hash with
:output and optionally :metadata and :usage.
103 104 105 106 107 108 109 |
# File 'lib/solid_agent/records.rb', line 103 def run_executor @run_executor ||= lambda do |agent_record, _run| raise Error, "No SolidAgent.run_executor is configured, so #{agent_record.class} cannot be executed. " \ "Set SolidAgent.run_executor to a callable taking (agent_record, run) and returning " \ "{ output:, metadata:, usage: }." end end |
Class Method Details
.agent(source, format: nil, base_class: nil, as: nil) ⇒ Class
Unified agent loading from any source
56 57 58 59 |
# File 'lib/solid_agent.rb', line 56 def agent(source, format: nil, base_class: nil, as: nil) manifest = AgentManifest.load(source, format: format) AgentManifest.build(manifest, base_class: base_class, class_name: as) end |
.agents_from(directory, pattern: "**/*.agent.md", **options) ⇒ Array<Class>
Load multiple agents from a directory
71 72 73 74 75 |
# File 'lib/solid_agent.rb', line 71 def agents_from(directory, pattern: "**/*.agent.md", **) Dir.glob(File.join(directory, pattern)).map do |path| agent(path, **) end end |
.configure {|_self| ... } ⇒ Object
35 36 37 |
# File 'lib/solid_agent.rb', line 35 def configure yield self if block_given? end |
.execution_job ⇒ Class?
123 |
# File 'lib/solid_agent/records.rb', line 123 def execution_job = execution_job_class.to_s.safe_constantize |
.records_installed? ⇒ Boolean
Whether the agent-records models are present and backed by tables.
Consumers that must degrade gracefully — ActiveAgent's dashboard being the motivating one — check this before touching the models. It answers false both when the constant is missing and when the migration has not run, because a defined model over a missing table fails later and less legibly.
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/solid_agent/records.rb', line 78 def records_installed? model = agent_model return false unless model model.respond_to?(:table_exists?) && model.table_exists? rescue ::StandardError # A connection that is not established yet is not an error worth raising # from a predicate whose whole job is to be safe to call. false end |
.reset_records_configuration! ⇒ void
This method returns an undefined value.
Resets every records-layer configuration knob. Test support.
128 129 130 131 132 |
# File 'lib/solid_agent/records.rb', line 128 def reset_records_configuration! Records::MODELS.each_key { |name| instance_variable_set(:"@#{name}", nil) } @run_executor = nil @execution_job_class = nil end |