Paolino iconPaolinoAug 28, 2026

RubyLLM 2.0: The Agentic Loop, Exposed

Strip any agent framework down and you find the same loop: call the model, run the tools it asked for, call the model again, stop when it answers without wanting a tool. # Run the agentic loop automatically chat = RubyLLM.chat(model: "claude-sonnet-4-6").with_tools(Weather).ask("What's the weather in Paris?") # => #<RubyLLM::Message role::assistant, content: "Here's the current...

RubyLLM 2.0: The Agentic Loop, Exposed

Share this story

Send the public story page.

Useful takeaways from this story.

Strip any agent framework down and you find the same loop: call the model, run the tools it asked for, call the model again, stop when it answers without wanting a tool.

# Run the agentic loop automatically chat = RubyLLM.chat(model: "claude-sonnet-4-6").with_tools(Weather).ask("What's the weather in Paris?") # => #<RubyLLM::Message role::assistant, content: "Here's the...

# Run the agentic loop manually chat = RubyLLM.chat(model: "claude-sonnet-4-6").with_tools(Weather).ask_later("What's the weather in Paris?") chat.step until chat.complete?

Building the complete brief

The page is ready to read now. The fuller skim-friendly version will appear here automatically.

The useful part

Strip any agent framework down and you find the same loop: call the model, run the tools it asked for, call the model again, stop when it answers without wanting a tool. # Run the agentic loop automatically chat = RubyLLM.chat(model: "claude-sonnet-4-6").with_tools(Weather).ask("What's the weather in Paris?") # => #<RubyLLM::Message role::assistant, content: "Here's the current... # Run the agentic loop manually chat = RubyLLM.chat(model: "claude-sonnet-4-6").with_tools(Weather).ask_later("What's the weather in Paris?") chat.step until chat.complete?

Details worth keeping

In RubyLLM 1.x that loop lived inside ask, sealed.

Keep reading in the app

Open the app view to save this story, compare related coverage, and continue from the same source.

Open in app