From 2b58b19fdd60f569e6c48dcea14a2051a2aed01b Mon Sep 17 00:00:00 2001 From: MiguelPF Date: Fri, 6 Feb 2026 12:30:04 +0100 Subject: [PATCH 1/2] fix: use application/json Content-Type for agent generate requests The response method was incorrectly setting Content-Type to text/plain while sending a JSON body. This caused the mastra server to not parse the body correctly, resulting in 'Argument messages is required' errors. This bug was present since the first commit but only became visible when the mastra server started strictly validating Content-Type headers. --- lib/ai/clients/mastra.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ai/clients/mastra.rb b/lib/ai/clients/mastra.rb index 78668d6..c19b62d 100644 --- a/lib/ai/clients/mastra.rb +++ b/lib/ai/clients/mastra.rb @@ -287,7 +287,7 @@ def http_post(url, body: nil, stream: false, &blk) end def response(url:, messages:, options:) request = Net::HTTP::Post.new(url) - request['Content-Type'] = 'text/plain;charset=UTF-8' + request['Content-Type'] = 'application/json' request['Origin'] = Ai.config.origin request['Authorization'] = "Bearer #{Ai.config.api_key}" if Ai.config.api_key.present? From 6599ed3a7f2b4e6346e31e67a9983b0cfa342ec2 Mon Sep 17 00:00:00 2001 From: MiguelPF Date: Fri, 6 Feb 2026 12:41:32 +0100 Subject: [PATCH 2/2] Bump version to 0.5.3 --- Gemfile.lock | 2 +- lib/ai/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cc01d33..cf80fab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ai (0.5.2) + ai (0.5.3) actionpack (>= 7.1.3) activesupport (>= 7.1.3) json_schemer (~> 2.4.0) diff --git a/lib/ai/version.rb b/lib/ai/version.rb index dd7e3ec..0c104e9 100644 --- a/lib/ai/version.rb +++ b/lib/ai/version.rb @@ -2,5 +2,5 @@ # frozen_string_literal: true module Ai - VERSION = '0.5.2' + VERSION = '0.5.3' end