Class: Agentic::DefaultAgentProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/agentic/default_agent_provider.rb

Overview

Default implementation of an agent provider for use in the CLI This provider creates agents based on agent specs in tasks

Instance Method Summary collapse

Constructor Details

#initialize(llm_config = nil) ⇒ DefaultAgentProvider

Initialize with optional LLM configuration

Parameters:

  • llm_config (LlmConfig, nil) (defaults to: nil)

    Configuration for the LLM client



12
13
14
# File 'lib/agentic/default_agent_provider.rb', line 12

def initialize(llm_config = nil)
  @llm_config = llm_config || LlmConfig.new
end

Instance Method Details

#get_agent_for_task(task) ⇒ Agent

Creates and returns an agent for a task

Parameters:

  • task (Task)

    The task that needs an agent

Returns:

  • (Agent)

    The agent created for the task



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/agentic/default_agent_provider.rb', line 19

def get_agent_for_task(task)
  agent_spec = task.agent_spec

  # Create LLM client for this agent
  llm_client = LlmClient.new(@llm_config)

  # Create a new agent using the factory methods
  Agent.build do |a|
    a.name = agent_spec.name
    a.role = agent_spec.name # Use name as role for simplicity
    a.purpose = agent_spec.description
    a.instructions = agent_spec.instructions
    a.llm_client = llm_client
  end
end