Class: Phronomy::Agent::AgentInvocationSessionBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/phronomy/agent/agent_invocation_session_builder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Builds FSMSession instances for AgentInvocation objects.

Blocking/provider work returns through explicit Agent-internal events. Entry actions start operations and return synchronously.

Constant Summary collapse

AUTO_STATE_SET =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  idle: true,
  filtering_input: true,
  building_context: true,
  starting_tools: true,
  evaluating_tools: true,
  dispatching_tools: true,
  recording_tool_results: true,
  output_filtering: true
}.freeze
DECLARED_STATES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%i[
  idle filtering_input building_context calling_llm starting_tools
  evaluating_tools waiting_for_tools dispatching_tools
  recording_tool_results suspended output_filtering completed blocked failed
].freeze
WAIT_STATES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%i[suspended].freeze
TOOL_EVENTS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%i[
  tool_authorized
  tool_approval_required
  tool_completed
  tool_failed
  tool_rejected
  tool_cancelled
].freeze

Class Method Summary collapse

Class Method Details

.build(agent:, input:, messages:, config:, approval_policy: nil, approval_listener: nil, mode: :invoke, on_event: nil, runtime: Phronomy::Runtime.instance) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/phronomy/agent/agent_invocation_session_builder.rb', line 40

def self.build(
  agent:,
  input:,
  messages:,
  config:,
  approval_policy: nil,
  approval_listener: nil,
  mode: :invoke,
  on_event: nil,
  runtime: Phronomy::Runtime.instance
)
  invocation = AgentInvocation.new(
    agent: agent,
    input: input,
    messages: messages,
    config: config,
    approval_policy: approval_policy,
    approval_listener: approval_listener,
    event_listener: on_event,
    mode: mode
  )
  build_session(
    agent_invocation: invocation,
    runtime: runtime,
    mode: mode
  )
end

.build_for_resume(agent_invocation:, resume_event:, resume_phase:, runtime: Phronomy::Runtime.instance) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/phronomy/agent/agent_invocation_session_builder.rb', line 68

def self.build_for_resume(
  agent_invocation:,
  resume_event:,
  resume_phase:,
  runtime: Phronomy::Runtime.instance
)
  build_session(
    agent_invocation: agent_invocation,
    runtime: runtime,
    mode: agent_invocation.mode,
    resume_event: resume_event,
    resume_phase: resume_phase
  )
end