llm.rb
A zero-dependency Ruby runtime for building agentic AI applications, with a single API spanning more than 14 model providers and concurrent tool execution.
llm.rb is a Ruby runtime for building agentic AI applications on CRuby, with zero runtime dependencies by default and a single coherent API spanning more than 14 providers. Its Agent class is the default high-level interface, managing the tool-calling loop with a configurable retry budget and tool-call budget, and keeping the loop from entering an invalid state, for example by pruning orphaned tool calls left behind when a call is interrupted.
Errors from a tool or during an agent's lifecycle are reported back to the model as an in-band error so it can correct course, rather than raising an exception. Streams can be plain IO objects or subclasses with structured callbacks for content, reasoning, tool calls, tool results and compaction, and can observe message transformers that rewrite outgoing messages before they reach the provider. Tools are plain Ruby classes with typed parameters, and the runtime ships a catalog of built-in filesystem, search and shell tools alongside provider-native tools such as web search.
It installs as a gem and is licensed under MIT.