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
-
#auth_type ⇒ Symbol
Authentication type for this provider.
-
#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
#auth_type ⇒ Symbol
Authentication type for this provider
109 110 111 |
# File 'lib/agent_harness/providers/adapter.rb', line 109 def auth_type :api_key end |
#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
137 138 139 |
# File 'lib/agent_harness/providers/adapter.rb', line 137 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
123 124 125 |
# File 'lib/agent_harness/providers/adapter.rb', line 123 def fetch_mcp_servers [] end |
#health_status ⇒ Hash
Health check
166 167 168 |
# File 'lib/agent_harness/providers/adapter.rb', line 166 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
152 153 154 |
# File 'lib/agent_harness/providers/adapter.rb', line 152 def session_flags(session_id) [] end |
#supports_dangerous_mode? ⇒ Boolean
Check if provider supports dangerous mode
130 131 132 |
# File 'lib/agent_harness/providers/adapter.rb', line 130 def supports_dangerous_mode? capabilities[:dangerous_mode] end |
#supports_mcp? ⇒ Boolean
Check if provider supports MCP
116 117 118 |
# File 'lib/agent_harness/providers/adapter.rb', line 116 def supports_mcp? capabilities[:mcp] end |
#supports_sessions? ⇒ Boolean
Check if provider supports session continuation
144 145 146 |
# File 'lib/agent_harness/providers/adapter.rb', line 144 def supports_sessions? false end |
#validate_config ⇒ Hash
Validate provider configuration
159 160 161 |
# File 'lib/agent_harness/providers/adapter.rb', line 159 def validate_config {valid: true, errors: []} end |