Module: PhaseoAgentSdk

Defined in:
lib/phaseo_agent_sdk.rb

Defined Under Namespace

Classes: Agent, AgentDefinition, DevtoolsConfig, GatewayAgentClient, HumanPause, HumanReviewContext, HumanReviewRequest, Message, ModelRequest, ModelResponse, PendingToolCall, RunRecord, RunResult, RunStep, RuntimeContext, StreamResult, Tool, ToolCall, ToolDecision, ToolOutput

Class Method Summary collapse

Class Method Details

.create_agent(definition) ⇒ Object



56
57
58
# File 'lib/phaseo_agent_sdk.rb', line 56

def self.create_agent(definition)
  Agent.new(definition.is_a?(AgentDefinition) ? definition : AgentDefinition.new(**definition))
end

.create_agent_devtools(directory: ".phaseo-devtools", enabled: true) ⇒ Object



64
65
66
# File 'lib/phaseo_agent_sdk.rb', line 64

def self.create_agent_devtools(directory: ".phaseo-devtools", enabled: true)
  DevtoolsConfig.new(enabled: enabled, directory: directory)
end

.create_gateway_agent_client(**options) ⇒ Object



60
61
62
# File 'lib/phaseo_agent_sdk.rb', line 60

def self.create_gateway_agent_client(**options)
  GatewayAgentClient.new(**options)
end

.define_tool(tool) ⇒ Object



52
53
54
# File 'lib/phaseo_agent_sdk.rb', line 52

def self.define_tool(tool)
  tool
end

.finish_reason_is(reason) ⇒ Object



72
# File 'lib/phaseo_agent_sdk.rb', line 72

def self.finish_reason_is(reason)=->(state){"finish_reason:#{reason}" if state[:finish_reason]==reason}

.has_tool_call(name) ⇒ Object



71
# File 'lib/phaseo_agent_sdk.rb', line 71

def self.has_tool_call(name)=->(state){"tool_call:#{name}" if state[:tool_calls].any?{|call|call.name==name}}

.max_cost(limit) ⇒ Object



69
# File 'lib/phaseo_agent_sdk.rb', line 69

def self.max_cost(limit)=->(state){"max_cost:#{limit}" if state[:usage][:cost]>=limit}

.max_duration(milliseconds) ⇒ Object



70
# File 'lib/phaseo_agent_sdk.rb', line 70

def self.max_duration(milliseconds)=->(state){"max_duration:#{milliseconds}" if state[:elapsed_ms]>=milliseconds}

.max_tokens_used(limit) ⇒ Object



68
# File 'lib/phaseo_agent_sdk.rb', line 68

def self.max_tokens_used(limit)=->(state){"max_tokens:#{limit}" if state[:usage][:total_tokens]>=limit}

.step_count_is(limit) ⇒ Object



67
# File 'lib/phaseo_agent_sdk.rb', line 67

def self.step_count_is(limit)=->(state){"step_count:#{limit}" if state[:step_count]>=limit}