# LittleGhost

Documentation version: Edge

Canonical HTML: https://littleghostai.org/

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.

## Install

```shell
bundle add little_ghost
```

Ruby 3.3 or newer is required.

## Your first agent

```ruby
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
```

## Grow your agent team

```ruby
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
```

## 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.

## Continue

- [Read the documentation](docs/index.md)
- [Start with your first agent](docs/getting_started.md)
- [Browse the public API](docs/api.md)
- [Give your coding agent `https://littleghostai.org/llms.txt`](llms.txt)
