ai-agents 0.13.0 → 0.14.0

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: 66cc6b306e84c6d62c5bf30b34104de9f683a3ec106eb11de12625000b07795d
4
- data.tar.gz: dfe243cb0723ef5ef6c79fbb14342cb78a8b5362ccbb4d42356c2f2386d832a5
3
+ metadata.gz: 602f4d0ec99e5345db8c332857eb3c0c1a117f58de7a6f0d827c0fddd514108d
4
+ data.tar.gz: 21ed531305507bc26a522115d6cc1ef2b47ceaab5d88027304e0829902154e8f
5
5
  SHA512:
6
- metadata.gz: 9db32ad036739a09f198995cf98426c477e5afd4a309dae9f33af11a0baf785808268d5d23539b71fe01c0c3f44ff2e7f1a34fcb3d783d44c171bb7175bed00f
7
- data.tar.gz: a263f704efb3122b60bcd4b245e7d84a04c65ed640eae72befbc7e51c6948e668c01bb4115a2d02351e311bf4933a88a081883947970c522484bed4731cdf0e6
6
+ metadata.gz: b931957957d664c7ecbd6c0f4242a88c9980abdccd2b81561ff34f81d01f3e1dc8a69d464c39359147a2ebb75fe199f53a171bbcc5b9badf48c23dad8fd1f3e1
7
+ data.tar.gz: bdd78a94000377b355d1026e607190fc57e86217de1d2ee9e12d59c628383331deccb62375519bd174b83781e444f0ea0ebad4f63eb47cebbf69cc7db769b0aa
data/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.14.0] - 2026-11-04
11
+
12
+ ### Added
13
+ - Allow RubyLLM 2.1. ai-agents supports `>= 2.0, < 2.2`.
14
+
15
+ ### Changed
16
+ - Store `thinking_provider` and `thinking_model` beside `thinking_signature` in conversation history. RubyLLM 2.1 replays restored reasoning only to the provider and model that produced it. Histories saved before this change do not replay reasoning on RubyLLM 2.1.
17
+ - On RubyLLM 2.0, reasoning restored from history now replays only to the provider that produced it. Before, it went to any provider.
18
+
19
+ ## [0.13.0] - 2026-10-07
20
+
10
21
  ### Changed
11
22
  - Require RubyLLM 2.0 starting with ai-agents 0.13.0. Applications using RubyLLM 1.x can keep ai-agents 0.12.0.
12
23
  - Keep the previous `param :name, desc: "..."` tool declaration syntax working with RubyLLM 2.0.
@@ -89,6 +89,8 @@ module Agents
89
89
  if msg.respond_to?(:thinking) && msg.thinking&.signature
90
90
  message[:thinking] = msg.thinking.text if msg.thinking.text
91
91
  message[:thinking_signature] = msg.thinking.signature
92
+ producer = producing_entry(msg)
93
+ message.merge!(thinking_provider: producer.provider, thinking_model: producer.model) if producer
92
94
  end
93
95
 
94
96
  if tool_calls_present
@@ -100,6 +102,12 @@ module Agents
100
102
  message
101
103
  end
102
104
 
105
+ # RubyLLM replays a thinking signature only to the producer named in the message's usage
106
+ # entries. RubyLLM 2.0 checks the provider, and RubyLLM 2.1 checks the provider and model.
107
+ def producing_entry(msg)
108
+ msg.ruby_llm_usage_entries.reverse.find(&:succeeded?)
109
+ end
110
+
103
111
  def persisted_content(msg)
104
112
  content = message_content?(msg) ? msg.content : ""
105
113
  return content if msg.attachments.empty?
@@ -133,8 +141,8 @@ module Agents
133
141
  }
134
142
  end
135
143
 
136
- private_class_method :extract_user_or_assistant_message, :persisted_content, :extractable_message?,
137
- :message_content?, :assistant_tool_calls?, :extract_tool_message
144
+ private_class_method :extract_user_or_assistant_message, :producing_entry, :persisted_content,
145
+ :extractable_message?, :message_content?, :assistant_tool_calls?, :extract_tool_message
138
146
  end
139
147
  end
140
148
  end
data/lib/agents/runner.rb CHANGED
@@ -319,6 +319,8 @@ module Agents
319
319
  params[:attachments] = attachments if attachments.any?
320
320
  if role == :assistant && msg[:thinking_signature]
321
321
  params[:thinking] = { text: msg[:thinking], signature: msg[:thinking_signature] }
322
+ usage_entries = thinking_usage_entries(msg[:thinking_provider], msg[:thinking_model])
323
+ params[:usage_entries] = usage_entries if usage_entries
322
324
  end
323
325
 
324
326
  # Handle tool-specific parameters (Tool Results)
@@ -351,6 +353,14 @@ module Agents
351
353
  params
352
354
  end
353
355
 
356
+ # Restores the producer that RubyLLM checks before it replays a thinking signature.
357
+ # RubyLLM's Rails persistence restores the same entry from its usage table.
358
+ def thinking_usage_entries(provider, model)
359
+ return unless provider
360
+
361
+ [RubyLLM::Accounting::Usage::Entry.new(operation: :chat, provider: provider, model: model, status: :succeeded)]
362
+ end
363
+
354
364
  # Split stored content into RubyLLM 2 text and attachments.
355
365
  # Multimodal arrays follow the OpenAI content format: [{type: 'text', text: '...'}, {type: 'image_url', ...}]
356
366
  def build_content(content_value)
@@ -33,6 +33,12 @@ module Agents
33
33
  #
34
34
  # This ensures each execution has its own context without any shared mutable state.
35
35
  class ToolWrapper
36
+ # RubyLLM 2.1 reads deferral from the tool class. ai-agents does not support
37
+ # deferred tools, so every wrapped tool is sent to the model up front.
38
+ def self.deferred?
39
+ false
40
+ end
41
+
36
42
  def initialize(tool, context_wrapper)
37
43
  @tool = tool
38
44
  @context_wrapper = context_wrapper
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Agents
4
- VERSION = "0.13.0"
4
+ VERSION = "0.14.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ai-agents
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shivam Mishra
@@ -13,16 +13,22 @@ dependencies:
13
13
  name: ruby_llm
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - "~>"
16
+ - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 2.0.0
18
+ version: '2.0'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '2.2'
19
22
  type: :runtime
20
23
  prerelease: false
21
24
  version_requirements: !ruby/object:Gem::Requirement
22
25
  requirements:
23
- - - "~>"
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '2.0'
29
+ - - "<"
24
30
  - !ruby/object:Gem::Version
25
- version: 2.0.0
31
+ version: '2.2'
26
32
  description: Ruby AI Agents SDK enables creating complex AI workflows with multi-agent
27
33
  orchestration, tool execution, safety guardrails, and provider-agnostic LLM integration.
28
34
  email: