Module: AgentHarness::Providers::Adapter
- Included in:
- Base
- Defined in:
- lib/agent_harness/providers/adapter.rb
Overview
Interface that all providers must implement
This module defines the contract that provider implementations must follow. Include this module in provider classes to ensure they implement the required interface.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#capabilities ⇒ Hash
Provider capabilities.
-
#dangerous_mode_flags ⇒ Array<String>
Get dangerous mode flags.
-
#error_patterns ⇒ Hash<Symbol, Array<Regexp>>
Error patterns for classification.
-
#fetch_mcp_servers ⇒ Array<Hash>
Fetch configured MCP servers.
-
#health_status ⇒ Hash
Health check.
-
#send_message(prompt:, **options) ⇒ Response
Send a message/prompt to the provider.
-
#session_flags(session_id) ⇒ Array<String>
Get session flags for continuation.
-
#supports_dangerous_mode? ⇒ Boolean
Check if provider supports dangerous mode.
-
#supports_mcp? ⇒ Boolean
Check if provider supports MCP.
-
#supports_sessions? ⇒ Boolean
Check if provider supports session continuation.
-
#validate_config ⇒ Hash
Validate provider configuration.
Class Method Details
.included(base) ⇒ Object
19 20 21 |
# File 'lib/agent_harness/providers/adapter.rb', line 19 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#capabilities ⇒ Hash
Provider capabilities
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/agent_harness/providers/adapter.rb', line 86 def capabilities { streaming: false, file_upload: false, vision: false, tool_use: false, json_mode: false, mcp: false, dangerous_mode: false } end |
#dangerous_mode_flags ⇒ Array<String>
Get dangerous mode flags
129 130 131 |
# File 'lib/agent_harness/providers/adapter.rb', line 129 def dangerous_mode_flags [] end |
#error_patterns ⇒ Hash<Symbol, Array<Regexp>>
Error patterns for classification
101 102 103 |
# File 'lib/agent_harness/providers/adapter.rb', line 101 def error_patterns {} end |
#fetch_mcp_servers ⇒ Array<Hash>
Fetch configured MCP servers
115 116 117 |
# File 'lib/agent_harness/providers/adapter.rb', line 115 def fetch_mcp_servers [] end |
#health_status ⇒ Hash
Health check
158 159 160 |
# File 'lib/agent_harness/providers/adapter.rb', line 158 def health_status {healthy: true, message: "OK"} end |
#send_message(prompt:, **options) ⇒ Response
Send a message/prompt to the provider
79 80 81 |
# File 'lib/agent_harness/providers/adapter.rb', line 79 def (prompt:, **) raise NotImplementedError, "#{self.class} must implement #send_message" end |
#session_flags(session_id) ⇒ Array<String>
Get session flags for continuation
144 145 146 |
# File 'lib/agent_harness/providers/adapter.rb', line 144 def session_flags(session_id) [] end |
#supports_dangerous_mode? ⇒ Boolean
Check if provider supports dangerous mode
122 123 124 |
# File 'lib/agent_harness/providers/adapter.rb', line 122 def supports_dangerous_mode? capabilities[:dangerous_mode] end |
#supports_mcp? ⇒ Boolean
Check if provider supports MCP
108 109 110 |
# File 'lib/agent_harness/providers/adapter.rb', line 108 def supports_mcp? capabilities[:mcp] end |
#supports_sessions? ⇒ Boolean
Check if provider supports session continuation
136 137 138 |
# File 'lib/agent_harness/providers/adapter.rb', line 136 def supports_sessions? false end |
#validate_config ⇒ Hash
Validate provider configuration
151 152 153 |
# File 'lib/agent_harness/providers/adapter.rb', line 151 def validate_config {valid: true, errors: []} end |