Module: TurnKit

Defined in:
lib/turnkit.rb,
lib/turnkit/id.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/tool_runner.rb,
lib/turnkit/conversation.rb,
lib/turnkit/memory_store.rb,
lib/turnkit/rails/railtie.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/stores/active_record_store.rb,
lib/turnkit/generators/turnkit/install_generator.rb

Defined Under Namespace

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

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientObject

Returns the value of attribute client.



36
37
38
# File 'lib/turnkit.rb', line 36

def client
  @client
end

.conversation_record_classObject

Returns the value of attribute conversation_record_class.



39
40
41
# File 'lib/turnkit.rb', line 39

def conversation_record_class
  @conversation_record_class
end

.cost_limitObject

Returns the value of attribute cost_limit.



38
39
40
# File 'lib/turnkit.rb', line 38

def cost_limit
  @cost_limit
end

.default_modelObject

Returns the value of attribute default_model.



36
37
38
# File 'lib/turnkit.rb', line 36

def default_model
  @default_model
end

.loggerObject

Returns the value of attribute logger.



36
37
38
# File 'lib/turnkit.rb', line 36

def logger
  @logger
end

.max_depthObject

Returns the value of attribute max_depth.



37
38
39
# File 'lib/turnkit.rb', line 37

def max_depth
  @max_depth
end

.max_iterationsObject

Returns the value of attribute max_iterations.



37
38
39
# File 'lib/turnkit.rb', line 37

def max_iterations
  @max_iterations
end

.max_tool_executionsObject

Returns the value of attribute max_tool_executions.



37
38
39
# File 'lib/turnkit.rb', line 37

def max_tool_executions
  @max_tool_executions
end

.message_record_classObject

Returns the value of attribute message_record_class.



40
41
42
# File 'lib/turnkit.rb', line 40

def message_record_class
  @message_record_class
end

.storeObject

Returns the value of attribute store.



36
37
38
# File 'lib/turnkit.rb', line 36

def store
  @store
end

.timeoutObject

Returns the value of attribute timeout.



37
38
39
# File 'lib/turnkit.rb', line 37

def timeout
  @timeout
end

.tool_execution_record_classObject

Returns the value of attribute tool_execution_record_class.



40
41
42
# File 'lib/turnkit.rb', line 40

def tool_execution_record_class
  @tool_execution_record_class
end

.turn_record_classObject

Returns the value of attribute turn_record_class.



39
40
41
# File 'lib/turnkit.rb', line 39

def turn_record_class
  @turn_record_class
end

Class Method Details

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



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

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