Module: RobotLab
- Defined in:
- lib/robot_lab.rb,
lib/robot_lab.rb,
lib/robot_lab/task.rb,
lib/robot_lab/tool.rb,
lib/robot_lab/error.rb,
lib/robot_lab/robot.rb,
lib/robot_lab/utils.rb,
lib/robot_lab/config.rb,
lib/robot_lab/memory.rb,
lib/robot_lab/waiter.rb,
lib/robot_lab/message.rb,
lib/robot_lab/network.rb,
lib/robot_lab/version.rb,
lib/robot_lab/ask_user.rb,
lib/robot_lab/bus_poller.rb,
lib/robot_lab/mcp/client.rb,
lib/robot_lab/mcp/server.rb,
lib/robot_lab/ractor_job.rb,
lib/robot_lab/run_config.rb,
lib/robot_lab/convergence.rb,
lib/robot_lab/state_proxy.rb,
lib/robot_lab/tool_config.rb,
lib/robot_lab/robot_result.rb,
lib/robot_lab/user_message.rb,
lib/robot_lab/memory_change.rb,
lib/robot_lab/robot_message.rb,
lib/robot_lab/text_analysis.rb,
lib/robot_lab/tool_manifest.rb,
lib/robot_lab/document_store.rb,
lib/robot_lab/ractor_boundary.rb,
lib/robot_lab/streaming/events.rb,
lib/robot_lab/delegation_future.rb,
lib/robot_lab/streaming/context.rb,
lib/robot_lab/history_compressor.rb,
lib/robot_lab/mcp/transports/sse.rb,
lib/robot_lab/ractor_worker_pool.rb,
lib/robot_lab/mcp/transports/base.rb,
lib/robot_lab/ractor_memory_proxy.rb,
lib/robot_lab/robot/bus_messaging.rb,
lib/robot_lab/mcp/server_discovery.rb,
lib/robot_lab/mcp/transports/stdio.rb,
lib/robot_lab/robot/history_search.rb,
lib/robot_lab/robot/mcp_management.rb,
lib/robot_lab/mcp/connection_poller.rb,
lib/robot_lab/mcp/transports/websocket.rb,
lib/robot_lab/ractor_network_scheduler.rb,
lib/robot_lab/rails_integration/engine.rb,
lib/robot_lab/robot/template_rendering.rb,
lib/robot_lab/rails_integration/railtie.rb,
lib/generators/robot_lab/robot_generator.rb,
lib/robot_lab/streaming/sequence_counter.rb,
lib/generators/robot_lab/install_generator.rb,
lib/robot_lab/mcp/transports/streamable_http.rb,
lib/robot_lab/rails_integration/turbo_stream_callbacks.rb
Overview
Define the module first so Zeitwerk can populate it
RobotLab is a Ruby framework for building and orchestrating multi-robot LLM workflows. It provides a modular architecture with adapters for multiple LLM providers (Anthropic, OpenAI, Gemini), MCP (Model Context Protocol) integration, streaming support, and history management.
Defined Under Namespace
Modules: Convergence, Generators, MCP, RactorBoundary, RailsIntegration, Streaming, TextAnalysis, ToolConfig, Utils Classes: AskUser, AwaitTimeout, BusError, BusPoller, Config, ConfigurationError, DelegationFuture, DependencyError, DocumentStore, Error, HistoryCompressor, InferenceError, MCPError, Memory, MemoryChange, Message, Network, RactorBoundaryError, RactorJob, RactorJobError, RactorMemoryProxy, RactorNetworkScheduler, RactorWorkerPool, RedisBackend, Robot, RobotMessage, RobotResult, RobotSpec, RunConfig, StateProxy, Task, TextMessage, Tool, ToolCallMessage, ToolError, ToolLoopError, ToolManifest, ToolMessage, ToolNotFoundError, ToolResultMessage, UserMessage, Waiter
Constant Summary collapse
- VERSION =
"0.0.11"
Class Method Summary collapse
-
.build(name: "robot", template: nil, system_prompt: nil, context: {}, enable_cache: true, bus: nil, skills: nil, config: nil, **options) ⇒ Robot
Factory method to create a new Robot instance.
-
.config ⇒ Config
Returns the Config object (MywayConfig-based).
-
.configure {|Config| ... } ⇒ Config
Yields the Config object for block-style configuration.
-
.create_memory(data: {}, enable_cache: true, **options) ⇒ Memory
Factory method to create a new Memory object.
-
.create_network(name:, concurrency: :auto, config: nil) { ... } ⇒ Network
Factory method to create a new Network of robots.
-
.ractor_pool ⇒ RactorWorkerPool
Returns the shared RactorWorkerPool, lazily initialized.
-
.reload_config! ⇒ Config
Reload configuration from all sources.
-
.shutdown_ractor_pool ⇒ void
Shut down the shared Ractor worker pool, draining in-flight jobs.
Class Method Details
.build(name: "robot", template: nil, system_prompt: nil, context: {}, enable_cache: true, bus: nil, skills: nil, config: nil, **options) ⇒ Robot
Factory method to create a new Robot instance.
156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/robot_lab.rb', line 156 def build(name: "robot", template: nil, system_prompt: nil, context: {}, enable_cache: true, bus: nil, skills: nil, config: nil, **) Robot.new( name: name, template: template, system_prompt: system_prompt, context: context, enable_cache: enable_cache, bus: bus, skills: skills, config: config, ** ) end |
.config ⇒ Config
Returns the Config object (MywayConfig-based).
Configuration is automatically loaded from:
-
Bundled defaults (lib/robot_lab/config/defaults.yml)
-
Environment-specific overrides (development, test, production)
-
XDG config files (~/.config/robot_lab/config.yml)
-
Project config (./config/robot_lab.yml)
-
Environment variables (ROBOT_LAB_*)
99 100 101 |
# File 'lib/robot_lab.rb', line 99 def config @config ||= Config.new.tap(&:after_load) end |
.configure {|Config| ... } ⇒ Config
Yields the Config object for block-style configuration.
113 114 115 |
# File 'lib/robot_lab.rb', line 113 def configure yield config end |
.create_memory(data: {}, enable_cache: true, **options) ⇒ Memory
Factory method to create a new Memory object.
219 220 221 |
# File 'lib/robot_lab.rb', line 219 def create_memory(data: {}, enable_cache: true, **) Memory.new(data: data, enable_cache: enable_cache, **) end |
.create_network(name:, concurrency: :auto, config: nil) { ... } ⇒ Network
Factory method to create a new Network of robots.
198 199 200 |
# File 'lib/robot_lab.rb', line 198 def create_network(name:, concurrency: :auto, config: nil, &block) Network.new(name: name, concurrency: concurrency, config: config, &block) end |
.ractor_pool ⇒ RactorWorkerPool
Returns the shared RactorWorkerPool, lazily initialized.
Pool size is determined by RobotLab.config.ractor_pool_size or defaults to Etc.nprocessors (:auto). The pool lives for the lifetime of the process. Call RobotLab.shutdown_ractor_pool to drain and close it explicitly.
232 233 234 235 236 237 |
# File 'lib/robot_lab.rb', line 232 def ractor_pool @ractor_pool ||= begin size = config.respond_to?(:ractor_pool_size) ? (config.ractor_pool_size || :auto) : :auto RactorWorkerPool.new(size: size) end end |
.reload_config! ⇒ Config
Reload configuration from all sources.
Clears the cached Config instance, forcing it to be reloaded on next access.
124 125 126 127 |
# File 'lib/robot_lab.rb', line 124 def reload_config! @config = nil config end |
.shutdown_ractor_pool ⇒ void
This method returns an undefined value.
Shut down the shared Ractor worker pool, draining in-flight jobs.
242 243 244 245 |
# File 'lib/robot_lab.rb', line 242 def shutdown_ractor_pool @ractor_pool&.shutdown @ractor_pool = nil end |