Agents and agent coordination in Ruby.

LittleGhost is a Ruby library for defining and coordinating AI agents. Call one from your application, or compose graphs and swarms when the work needs a team.

$ bundle add little_ghostRuby 3.3+
Docs → For coding agents →

Your first agent

customer_support_agent.rb ghost recording
require "little_ghost"
class CustomerSupportAgent < LittleGhost::Agent
model "openrouter:openai/gpt-5.6-luna"
system_prompt "Answer customer questions clearly and concisely."
end
run = CustomerSupportAgent.ask("Can you help with my order?")
puts run.response
under the hood
customer question I'm preparing a clear answer!CustomerSupportAgent clear answer
terminal
$ ruby customer_support_agent.rb
Hi! Tell me what happened, and I'll help you find the next step.

Grow your agent team

book_club_launch_graph.rb ghost recording
class BookClubLaunchGraph < LittleGhost::Graph
# Agent classes live elsewhere in the application.
node :plan, PlannerAgent
node :research, ResearchAgent
node :logistics, LogisticsAgent
node :write, WriterAgent
start :plan
edge :plan, :research
edge :plan, :logistics
edge :research, :write
edge :logistics, :write
finish :write
end
run = BookClubLaunchGraph.ask("Launch a neighborhood book club")
puts run.response
under the hood
book club idea I'm splitting up the work!plan I'm choosing a book!research I'm planning the meetup!logistics I'm writing the plan!write launch plan
terminal
$ bundle exec ruby app.rb
Meet at the library next Thursday. Start with Why's Poignant Guide to Ruby, and invite neighbors through one shared signup page.

Batteries included

Tools

Ruby classes connect agents to application capabilities through declared inputs and ordinary method calls.

Agent coordination

Use Ruby-directed workflows and graphs, model-directed subagents and swarms, or compose both.

Configurable sandboxes

Use the native backend for deny-by-default Seatbelt on macOS or Bubblewrap on Linux, then declare the files, processes, environment, and network access each child needs.

Provider support

Use OpenRouter, OpenAI-compatible APIs, Anthropic, Gemini, Vertex AI, or Bedrock behind the same interface.

Streaming & outputs

Stream text, tool activity, usage, and completion through one event shape—or return schema-backed structured results.

Sessions & supervision

Preserve conversations, set deadlines, cancel work, instrument execution, and inspect detailed run results.