ruby_llm-agents 3.7.0 → 3.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce728e318b0681df1f65dc93e4c264f35573e863b86841394ab218994dd3dd29
4
- data.tar.gz: f036ab7df822277740a0f840afd52d3d68c36bbd37843ae16032da7f9406864e
3
+ metadata.gz: 891034cc430fa52a5b9d1b07bd9cf06558414b91396f4a1521ebd0f8618f2a68
4
+ data.tar.gz: fc6775ed017277076bec9c0931cfe4c34d4ef1023815f4898458f40e55b61855
5
5
  SHA512:
6
- metadata.gz: 6e63acc86ac7413983957abc46bbf5ba997230ae06480d6aa2eb77d6f25524e02cc58131112cda0b5eb413452078766d8afec001d98e56e6fb3ae2e8a0602dff
7
- data.tar.gz: d01dba7531c3e503f7b00156a254c8a71ab582d20b194ad22d1f6bc1734cdd38b814e6581855274e08b49bb2c8d33e7655a02c2ed834771d9a990085ce743c84
6
+ metadata.gz: 9de47e331e3f0b48465fa12c9f91f79045dfec64d76f242308184a36c41a67be7d324d9b358c96450cde053dbb8f69fe326a1d3a6078a3ea93136b8c327edc30
7
+ data.tar.gz: d7ba9f35cf90656e7618189141d7291d704dd7199c54ced508d9da1cb72aa417f1988cd15e884cd42f2ae235e3149c2c31ca0d4d3567db9e04132d890a11e517
@@ -60,6 +60,25 @@ module RubyLlmAgents
60
60
  )
61
61
  end
62
62
 
63
+ # Add usage counter columns to tenants (v3.x upgrade)
64
+ def create_add_usage_counters_migration
65
+ unless table_exists?(:ruby_llm_agents_tenants)
66
+ say_status :skip, "tenants table does not exist yet", :yellow
67
+ return
68
+ end
69
+
70
+ if column_exists?(:ruby_llm_agents_tenants, :monthly_cost_spent)
71
+ say_status :skip, "usage counter columns already exist on tenants", :yellow
72
+ return
73
+ end
74
+
75
+ say_status :upgrade, "Adding usage counter columns to tenants", :blue
76
+ migration_template(
77
+ "add_usage_counters_to_tenants_migration.rb.tt",
78
+ File.join(db_migrate_path, "add_usage_counters_to_ruby_llm_agents_tenants.rb")
79
+ )
80
+ end
81
+
63
82
  # Add assistant_prompt column to execution_details (v3.0 -> v3.1 upgrade)
64
83
  def create_add_assistant_prompt_migration
65
84
  if column_exists?(:ruby_llm_agents_execution_details, :assistant_prompt)
@@ -4,6 +4,6 @@ module RubyLLM
4
4
  module Agents
5
5
  # Current version of the RubyLLM::Agents gem
6
6
  # @return [String] Semantic version string
7
- VERSION = "3.7.0"
7
+ VERSION = "3.7.2"
8
8
  end
9
9
  end
@@ -271,6 +271,12 @@ module RubyLLM
271
271
  agent_meta = safe_agent_metadata(context)
272
272
  if agent_meta.any?
273
273
  data[:metadata] = agent_meta.transform_keys(&:to_s)
274
+
275
+ # Extract tracing fields from metadata to dedicated columns
276
+ data[:trace_id] = agent_meta[:trace_id] if agent_meta[:trace_id]
277
+ data[:request_id] = agent_meta[:request_id] if agent_meta[:request_id]
278
+ data[:parent_execution_id] = agent_meta[:parent_execution_id] if agent_meta[:parent_execution_id]
279
+ data[:root_execution_id] = agent_meta[:root_execution_id] if agent_meta[:root_execution_id]
274
280
  end
275
281
 
276
282
  # Track replay source if this is a replayed execution
@@ -283,7 +289,7 @@ module RubyLLM
283
289
  data[:metadata] = (data[:metadata] || {}).merge("replay_source_id" => replay_source_id.to_s)
284
290
  end
285
291
 
286
- # Execution hierarchy (agent-as-tool)
292
+ # Execution hierarchy (agent-as-tool) — context-level values take precedence
287
293
  if context.parent_execution_id.present?
288
294
  data[:parent_execution_id] = context.parent_execution_id
289
295
  data[:root_execution_id] = context.root_execution_id || context.parent_execution_id
@@ -445,6 +451,14 @@ module RubyLLM
445
451
  metadata: merged_metadata
446
452
  }
447
453
 
454
+ # Extract tracing fields from agent metadata to dedicated columns
455
+ if agent_meta.any?
456
+ data[:trace_id] = agent_meta[:trace_id] if agent_meta[:trace_id]
457
+ data[:request_id] = agent_meta[:request_id] if agent_meta[:request_id]
458
+ data[:parent_execution_id] = agent_meta[:parent_execution_id] if agent_meta[:parent_execution_id]
459
+ data[:root_execution_id] = agent_meta[:root_execution_id] if agent_meta[:root_execution_id]
460
+ end
461
+
448
462
  # Add tenant_id only if multi-tenancy is enabled and tenant is set
449
463
  if global_config.multi_tenancy_enabled? && context.tenant_id.present?
450
464
  data[:tenant_id] = context.tenant_id
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm-agents
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - adham90