Class: RubyLLM::Agents::ExecutionsController Private

Inherits:
ApplicationController
  • Object
show all
Includes:
Filterable, Paginatable, Sortable
Defined in:
app/controllers/ruby_llm/agents/executions_controller.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.

Controller for browsing and searching execution records

Provides paginated listing, filtering, and detail views for all agent executions. Supports both HTML and Turbo Stream responses for seamless filtering without full page reloads.

Turbo Stream support is optional — works in API-only apps or apps without turbo-rails installed.

Constant Summary collapse

CSV_COLUMNS =

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.

%w[id agent_type status model_id total_tokens total_cost
duration_ms created_at error_class error_message].freeze

Constants included from Sortable

Sortable::DEFAULT_SORT_COLUMN, Sortable::DEFAULT_SORT_DIRECTION, Sortable::SORTABLE_COLUMNS, Sortable::SORT_DIRECTIONS

Constants included from Filterable

Filterable::VALID_STATUSES

Instance Method Summary collapse

Instance Method Details

#exportvoid

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.

This method returns an undefined value.

Exports filtered executions as CSV

Streams CSV data with redacted error messages to protect sensitive information. Respects all current filter parameters.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'app/controllers/ruby_llm/agents/executions_controller.rb', line 75

def export
  filename = "executions-#{Date.current.iso8601}.csv"

  headers["Content-Type"] = "text/csv"
  headers["Content-Disposition"] = "attachment; filename=\"#{filename}\""

  response.status = 200

  self.response_body = Enumerator.new do |yielder|
    yielder << CSV.generate_line(CSV_COLUMNS)

    filtered_executions.find_each(batch_size: 1000) do |execution|
      yielder << generate_csv_row(execution)
    end
  end
end

#indexvoid

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.

This method returns an undefined value.

Lists all executions with filtering and pagination



28
29
30
31
32
33
34
35
36
# File 'app/controllers/ruby_llm/agents/executions_controller.rb', line 28

def index
  load_filter_options
  load_executions_with_stats

  respond_to do |format|
    format.html
    format.turbo_stream if turbo_stream_available?
  end
end

#searchvoid

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.

This method returns an undefined value.

Handles filter search requests via Turbo Stream

Returns the same data as index but optimized for AJAX/Turbo requests, replacing only the executions list partial.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/controllers/ruby_llm/agents/executions_controller.rb', line 51

def search
  load_filter_options
  load_executions_with_stats

  respond_to do |format|
    format.html { render :index }
    if turbo_stream_available?
      format.turbo_stream do
        render turbo_stream: turbo_stream.replace(
          "executions_list",
          partial: "ruby_llm/agents/executions/list",
          locals: {executions: @executions, pagination: @pagination, filter_stats: @filter_stats}
        )
      end
    end
  end
end

#showvoid

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.

This method returns an undefined value.

Shows a single execution’s details



41
42
43
# File 'app/controllers/ruby_llm/agents/executions_controller.rb', line 41

def show
  @execution = tenant_scoped_executions.includes(:detail, :child_executions).find(params[:id])
end