Module: TurnKit

Defined in:
lib/turnkit.rb,
lib/turnkit/id.rb,
lib/turnkit/cost.rb,
lib/turnkit/tool.rb,
lib/turnkit/turn.rb,
lib/turnkit/agent.rb,
lib/turnkit/clock.rb,
lib/turnkit/error.rb,
lib/turnkit/skill.rb,
lib/turnkit/store.rb,
lib/turnkit/usage.rb,
lib/turnkit/budget.rb,
lib/turnkit/client.rb,
lib/turnkit/record.rb,
lib/turnkit/result.rb,
lib/turnkit/message.rb,
lib/turnkit/version.rb,
lib/turnkit/tool_call.rb,
lib/turnkit/prompt_data.rb,
lib/turnkit/tool_runner.rb,
lib/turnkit/conversation.rb,
lib/turnkit/memory_store.rb,
lib/turnkit/rails/railtie.rb,
lib/turnkit/system_prompt.rb,
lib/turnkit/prompt_context.rb,
lib/turnkit/sub_agent_tool.rb,
lib/turnkit/tool_execution.rb,
lib/turnkit/adapters/ruby_llm.rb,
lib/turnkit/message_projection.rb,
lib/turnkit/prompt_contribution.rb,
lib/turnkit/stores/active_record_store.rb,
lib/turnkit/generators/turnkit/install_generator.rb

Defined Under Namespace

Modules: Adapters, Clock, Generators, Id, PromptData, Record Classes: ActiveRecordStore, Agent, Budget, Client, ConfigError, Conversation, Cost, Error, LiveContextContribution, MemoryStore, Message, MessageProjection, PromptBuildContext, PromptContribution, Railtie, Result, Skill, Store, StoreError, SubAgentTool, SystemPrompt, Tool, ToolCall, ToolContext, ToolError, ToolExecution, ToolRunner, Turn, Usage

Constant Summary collapse

VERSION =
"0.2.5"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.available_skillsObject

Returns the value of attribute available_skills.



47
48
49
# File 'lib/turnkit.rb', line 47

def available_skills
  @available_skills
end

.clientObject

Returns the value of attribute client.



43
44
45
# File 'lib/turnkit.rb', line 43

def client
  @client
end

.context_contributorsObject

Returns the value of attribute context_contributors.



48
49
50
# File 'lib/turnkit.rb', line 48

def context_contributors
  @context_contributors
end

.conversation_record_classObject

Returns the value of attribute conversation_record_class.



50
51
52
# File 'lib/turnkit.rb', line 50

def conversation_record_class
  @conversation_record_class
end

.cost_calculatorObject

Returns the value of attribute cost_calculator.



46
47
48
# File 'lib/turnkit.rb', line 46

def cost_calculator
  @cost_calculator
end

.cost_limitObject

Returns the value of attribute cost_limit.



45
46
47
# File 'lib/turnkit.rb', line 45

def cost_limit
  @cost_limit
end

.cost_ratesObject

Returns the value of attribute cost_rates.



46
47
48
# File 'lib/turnkit.rb', line 46

def cost_rates
  @cost_rates
end

.default_modelObject

Returns the value of attribute default_model.



43
44
45
# File 'lib/turnkit.rb', line 43

def default_model
  @default_model
end

.loggerObject

Returns the value of attribute logger.



43
44
45
# File 'lib/turnkit.rb', line 43

def logger
  @logger
end

.max_depthObject

Returns the value of attribute max_depth.



44
45
46
# File 'lib/turnkit.rb', line 44

def max_depth
  @max_depth
end

.max_iterationsObject

Returns the value of attribute max_iterations.



44
45
46
# File 'lib/turnkit.rb', line 44

def max_iterations
  @max_iterations
end

.max_tool_executionsObject

Returns the value of attribute max_tool_executions.



44
45
46
# File 'lib/turnkit.rb', line 44

def max_tool_executions
  @max_tool_executions
end

.message_record_classObject

Returns the value of attribute message_record_class.



51
52
53
# File 'lib/turnkit.rb', line 51

def message_record_class
  @message_record_class
end

.model_prompt_contributorsObject

Returns the value of attribute model_prompt_contributors.



49
50
51
# File 'lib/turnkit.rb', line 49

def model_prompt_contributors
  @model_prompt_contributors
end

.prompt_behaviorObject

Returns the value of attribute prompt_behavior.



47
48
49
# File 'lib/turnkit.rb', line 47

def prompt_behavior
  @prompt_behavior
end

.prompt_cacheObject

Returns the value of attribute prompt_cache.



45
46
47
# File 'lib/turnkit.rb', line 45

def prompt_cache
  @prompt_cache
end

.prompt_data_max_charsObject

Returns the value of attribute prompt_data_max_chars.



48
49
50
# File 'lib/turnkit.rb', line 48

def prompt_data_max_chars
  @prompt_data_max_chars
end

.prompt_sectionsObject

Returns the value of attribute prompt_sections.



47
48
49
# File 'lib/turnkit.rb', line 47

def prompt_sections
  @prompt_sections
end

.storeObject

Returns the value of attribute store.



43
44
45
# File 'lib/turnkit.rb', line 43

def store
  @store
end

.system_prompt_contributorsObject

Returns the value of attribute system_prompt_contributors.



49
50
51
# File 'lib/turnkit.rb', line 49

def system_prompt_contributors
  @system_prompt_contributors
end

.timeoutObject

Returns the value of attribute timeout.



44
45
46
# File 'lib/turnkit.rb', line 44

def timeout
  @timeout
end

.tool_execution_record_classObject

Returns the value of attribute tool_execution_record_class.



51
52
53
# File 'lib/turnkit.rb', line 51

def tool_execution_record_class
  @tool_execution_record_class
end

.turn_record_classObject

Returns the value of attribute turn_record_class.



50
51
52
# File 'lib/turnkit.rb', line 50

def turn_record_class
  @turn_record_class
end

Class Method Details

.reconcile_stale!(before: Clock.now - (timeout || 300)) ⇒ Object



70
71
72
73
74
# File 'lib/turnkit.rb', line 70

def self.reconcile_stale!(before: Clock.now - (timeout || 300))
  store.find_stale_turns(before: before).each do |turn|
    store.update_turn(turn.fetch("id"), "status" => "stale", "completed_at" => Clock.now)
  end
end