fix: Update max_turns config (#12604)

Pass max_turns in the run config than during the initialization.

---------

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
This commit is contained in:
Pranav
2025-10-06 22:51:18 -07:00
committed by GitHub
parent 3a71829b46
commit 829142c808
3 changed files with 3 additions and 3 deletions

View File

@@ -15,7 +15,6 @@ Rails.application.config.after_initialize do
config.openai_api_base = api_base
end
config.default_model = model
config.max_turns = 30
config.debug = false
end
end

View File

@@ -23,7 +23,7 @@ class Captain::Assistant::AgentRunnerService
message_to_process = extract_last_user_message(message_history)
runner = Agents::Runner.with_agents(*agents)
runner = add_callbacks_to_runner(runner) if @callbacks.any?
result = runner.run(message_to_process, context: context)
result = runner.run(message_to_process, context: context, max_turns: 100)
process_agent_result(result)
rescue StandardError => e

View File

@@ -90,7 +90,8 @@ RSpec.describe Captain::Assistant::AgentRunnerService do
expect(mock_runner).to receive(:run).with(
'I need help with my account',
context: expected_context
context: expected_context,
max_turns: 100
)
service.generate_response(message_history: message_history)