Examples
Runnable Nexo examples — offline primitives needing no model or network, plus live agents, MCP, and workflows that need a tool-calling model. Each links to its source on GitHub.
Each example in the Nexo repo is a small, runnable script. Two kinds:
- Offline — no model, no network, no API key. Run them as-is to see the primitive work.
- Live (
NEXO_LIVE=1) — needs a real tool-calling model (NEXO_MODELtakes anyruby_llm-supported model id; nothing is provider-specific) and sometimes an external service (an MCP server, docker, an API key).
Run everything from the repo root with ruby -Ilib examples/<name>.rb.
Offline (start here)
| Example | Shows |
|---|---|
artifact_from_template.rb |
Staging input files into a run’s sandbox + rendering a named artifact from a trusted ERB template |
approval_workflow.rb |
Durable human-in-the-loop: checkpoint + suspend! + resume |
Live — agents
| Example | Shows | Extra requirements |
|---|---|---|
code_reviewer.rb |
The minimal agent against a local Ollama model, with a skill and token accounting | Ollama running locally |
chat_session.rb |
A continuing, addressable Nexo::Session that remembers prior turns |
— |
container_review.rb |
Agent tools running inside a locked-down OCI container | docker (or Apple container) |
news_summary.rb |
Read-only web fetch scoped by fetch_allow |
— |
news_search.rb |
Host-injected search_backend + fetch |
a search backend you inject |
Live — MCP
| Example | Shows | Extra requirements |
|---|---|---|
mcp_filesystem.rb |
The MCP seam + permission gate with the official filesystem server — no credentials needed; start here for MCP | npx |
inbox_digest.rb |
Gmail through a stdio MCP server + the email_triage skill, read tools only |
a Gmail MCP server + OAuth |
inbox_digest_http.rb |
The same digest over a hosted HTTP MCP server with a host-supplied OAuth bearer token | a hosted Gmail MCP server |
inbox_digest_task.rb |
The digest as a Workflow Task: agent macro + run_agent + a named artifact |
same as inbox_digest.rb |
Live — workflows
| Example | Shows | Extra requirements |
|---|---|---|
approval_agent.rb |
The :approve permission mode bridged to a durable suspend/resume |
— |
Skills used by the examples
The skills/ directory holds the SKILL.md packages the examples reference — email_triage, news_summary, and ruby-code-review. The examples point Nexo.config.skills_path there; in a Rails host the default is app/skills.
| Skill | Used by |
|---|---|
email_triage |
inbox_digest.rb, inbox_digest_http.rb, inbox_digest_task.rb |
news_summary |
news_summary.rb, news_search.rb |
ruby-code-review |
code_reviewer.rb |
Rails walkthrough
A host-side Rails walkthrough covers run_later, live progress, run helpers, and artifact access: