Class: ComposableAgents::Cline::Agent
- Inherits:
-
PromptDrivenAgent
- Object
- Agent
- PromptDrivenAgent
- ComposableAgents::Cline::Agent
- Includes:
- Mixins::ArtifactContract
- Defined in:
- lib/composable_agents/cline/agent.rb
Overview
Agent implementation that uses an ai-agent's AgentRunner.
Instance Attribute Summary
Attributes inherited from PromptDrivenAgent
#constraints, #conversation, #objective, #role, #system_instructions
Attributes inherited from Agent
Public API collapse
-
#full_name ⇒ String
Return the full name of the agent.
-
#initialize(*args, strategy: PromptRenderingStrategy::MarkdownHeavy, provider: 'cline', model: 'anthropic/claude-sonnet-4.6', api_key: ENV.fetch('CLINE_API_KEY', nil), configure_provider: nil, configure_global: nil, skills: [], cli_options: {}, **kwargs) ⇒ Agent
constructor
Initialize a new agent that uses the Cline CLI in a dedicated config.
Methods inherited from PromptDrivenAgent
Methods included from Mixins::Logger
Internal collapse
-
#export_state ⇒ Object
Export the agent state for persistence.
-
#import_state(state) ⇒ Object
Import the agent state from persistence.
Methods included from Mixins::ArtifactContract
Methods inherited from PromptDrivenAgent
#input_artifacts_contracts, #output_artifacts_contracts, #report_error_for_output_artifact, #save_output_artifact
Methods inherited from Agent
Constructor Details
#initialize(*args, strategy: PromptRenderingStrategy::MarkdownHeavy, provider: 'cline', model: 'anthropic/claude-sonnet-4.6', api_key: ENV.fetch('CLINE_API_KEY', nil), configure_provider: nil, configure_global: nil, skills: [], cli_options: {}, **kwargs) ⇒ Agent
Initialize a new agent that uses the Cline CLI in a dedicated config
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/composable_agents/cline/agent.rb', line 28 def initialize( *args, strategy: PromptRenderingStrategy::MarkdownHeavy, provider: 'cline', model: 'anthropic/claude-sonnet-4.6', api_key: ENV.fetch('CLINE_API_KEY', nil), configure_provider: nil, configure_global: nil, skills: [], cli_options: {}, **kwargs ) super(*args, strategy:, **kwargs) @provider = provider @model = model @api_key = api_key ? ::Cline::SecretString.new(api_key.dup) : nil @configure_provider = configure_provider @configure_global = configure_global @skills = skills @cli_options = @context = [] end |
Instance Method Details
#export_state ⇒ Object
Export the agent state for persistence
65 66 67 |
# File 'lib/composable_agents/cline/agent.rb', line 65 def export_state super.merge(deep_transform_keys(context: @context, &:to_s)) end |
#full_name ⇒ String
Return the full name of the agent. This method is intended to be overridden by subclasses to give better full names, tailored to the kind of agent. The full name can be used in logs and traces to better identify the agent.
56 57 58 |
# File 'lib/composable_agents/cline/agent.rb', line 56 def full_name "#{name || 'Unnamed'} (Cline #{@provider}/#{@model})" end |
#import_state(state) ⇒ Object
Import the agent state from persistence
72 73 74 75 |
# File 'lib/composable_agents/cline/agent.rb', line 72 def import_state(state) super @context = deep_transform_keys(state, &:to_sym)[:context] end |