0.0
There's a lot of open issues
An elegant, Ruby-like SDK for building autonomous AI agents with Google Antigravity.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 2.6
>= 1.5
~> 1.2
~> 3.0
 Project Readme

The Antigravity Ruby SDK is an unofficial, community project. It is not an official Google product.

๐Ÿ’Ž Antigravity Ruby SDK

Ruby Antigravity Logo

Antigravity Ruby SDK Multiturn TUI Demo

Gem Version GitHub

An elegant, expressive Ruby SDK for building autonomous AI agents with Google Antigravity.

Gem: antigravity-sdk on RubyGems Source: palladius/antigravity-ruby-sdk on GitHub

Inspired by RubyLLM and the Ruby philosophy of developer happiness: configure agents, stream responses, load skills from GitHub, analyze workspaces, and attach safety guards -- all with minimal boilerplate.

agent = Antigravity::Agent.new(
  skills: ["./skills/code-quality-review"],
  workspace: "."
)

agent.ask("Review this codebase for best practices") { |chunk| print chunk.content }

โšก Zero-Install Quickstart with rv

No gem install needed โ€” run directly with rv:

# Simple chat
rv run ruby examples/04_simple_llm_chat.rb

# Workspace analysis (indexes your project, asks about it)
rv run ruby examples/05_workspace_analysis.rb ~/git/my-app

# Code quality review with skills
rv run ruby examples/06_skill_security_audit.rb .

# Load SRE skills from GitHub and draft a post-mortem
rv run ruby examples/07_skill_sre_postmortem.rb .

Or with just:

just rv-chat                    # Simple LLM chat
just rv-workspace               # Workspace analysis
just rv-skill-audit             # Code review with local + inline skills
just rv-skill-sre-postmortem    # SRE post-mortem from GitHub skills

๐Ÿ“š Agent Skills

Skills are reusable instruction sets (SKILL.md files) that teach agents new capabilities. Load them from local folders, GitHub repos, or define them inline:

agent = Antigravity::Agent.new(
  # Mix local and remote skills in the constructor
  skills: [
    "./skills/code-quality-review",                           # Local
    "https://github.com/gemini-cli-extensions/sre",           # GitHub (auto-clones all 16 skills!)
  ]
)

# Add a specific skill from a GitHub repo
agent.add_skill("https://github.com/gemini-cli-extensions/sre", skill_name: "skills/postmortem-generator")

# Define a skill inline (no file needed)
agent.add_inline_skill(
  name: "emoji-formatter",
  description: "Formats output with emoji severity markers",
  instructions: "Use: CRITICAL: ๐Ÿšจ, HIGH: ๐Ÿ”ด, MEDIUM: ๐ŸŸก, LOW: ๐Ÿ”ต, PASSED: โœ…"
)

# Discover skills in a folder
Agent.list_skills("~/git/skillume/sre-extension/")
# => ["/path/to/anomaly-detection", "/path/to/cloud-logging", ...]

Here, for example, we are using an inline skill for custom severity emojis (severity-emoji) alongside a local code quality audit skill (code-quality-review):

Code Quality & Security Audit Skill Demo


๐Ÿ“‚ Workspace Analysis

Point an agent at a directory โ€” it indexes the files and uses built-in tools (list_dir, view_file, grep_search) to explore:

agent = Antigravity::Agent.new(workspace: "~/git/my-project")
agent.connect!
agent.ask("What tech stack does this project use?") { |c| print c.content }
agent.close!

๐Ÿชต Automagic Logging

Dual-output logging out of the box:

  • log/antigravity.jsonl โ€” structured telemetry (request/response sizes, tool calls)
  • log/antigravity.log โ€” compact human-readable one-liners
  • Auto-attaches Rails.logger in Rails apps
agent = Antigravity::Agent.new  # Logging just works!
# => ๐Ÿชต Logging to log/antigravity.jsonl

๐Ÿ›ก๏ธ Guards & Sidecars

agent = Antigravity::Agent.new do |a|
  a.system_instruction = "You are a helpful Ruby assistant."
  a.attach_sidecar(Antigravity::Sidecar::AuditLogger.new("log/audit.jsonl"))
  a.before_tool_call(&Antigravity::Guards::FileProtection.new)
  a.after_tool_call(&Antigravity::Guards::SecretMasker.new)
end

๐Ÿ”’ Declarative Policy DSL

Control what your agent can and can't do with a beautiful, Rails-like DSL:

agent = Antigravity::Agent.new(policy: :default)   # Use a preset
agent = Antigravity::Agent.new(policy: :cautious)   # Locked down for prod
agent = Antigravity::Agent.new(policy: :turbo)      # Wide open for dev
agent = Antigravity::Agent.new(policy: :auto)       # Picks from RAILS_ENV!

Or define a custom policy:

policy = Antigravity::Policy.define do
  deny_all
  allow :view_file
  allow :grep_search
  allow :run_command, when: cmd('echo', 'git status', 'bundle exec rspec')
  allow :write_to_file
  deny  :write_to_file, when: path('.env', '*.key', '*.pem')
  deny  :run_command,   when: cmd('rm', 'git reset --hard')
end

agent = Antigravity::Agent.new(policy: policy)

โš ๏ธ Order does NOT matter!

The DSL is declarative โ€” like SQL, not like a script. Rules are resolved by precedence, not by insertion order. These two policies behave identically:

# Order A                           # Order B
Policy.define do                    Policy.define do
  allow :run_command                  deny :run_command, when: cmd('rm')
  deny :run_command,                  allow :run_command
    when: cmd('rm')                 end
end

Precedence (highest wins):

  1. Tool specificity: deny :run_command beats deny_all
  2. Condition specificity: deny :run_command, when: cmd('rm') beats deny :run_command
  3. Restrictiveness: deny beats confirm beats allow

๐Ÿ“‹ Presets

Preset Shell Writes rm git reset --hard Best for
๐Ÿ”’ :cautious Safe only (echo, pwd) Confirm โŒ Deny โŒ Deny Production
โš–๏ธ :default Allow Allow โš ๏ธ Confirm โš ๏ธ Confirm Day-to-day dev
๐Ÿš€ :turbo Allow Allow Allow โš ๏ธ Confirm Rapid prototyping
๐Ÿงช :test Allow Allow โš ๏ธ Confirm โŒ Deny CI / test suites
๐Ÿ”ฎ :auto โ€” โ€” โ€” โ€” Reads RAILS_ENV

๐Ÿ“‚ Sandbox directories

scratch/ and out/ are always writable, even in :cautious / production. Use them as throwaway output dirs:

# In production โ€” this works!
agent.hooks.run_pre_tool(:write_to_file, path: 'scratch/debug.log', content: '...')
# => { allowed: true }

# But this is blocked:
agent.hooks.run_pre_tool(:write_to_file, path: 'app.rb', content: '...')
# => { allowed: false, reason: "Denied by policy" }

๐Ÿ”ฎ Auto-mapping from RAILS_ENV

policy: :auto reads ANTIGRAVITY_ENV โ†’ RAILS_ENV โ†’ RACK_ENV:

Environment Preset
development / dev ๐Ÿš€ :turbo
test ๐Ÿงช :test
staging โš–๏ธ :default
production / prod ๐Ÿ”’ :cautious
(unset) โš–๏ธ :default

See lib/antigravity/policy.rb and lib/antigravity/policy/constants.rb for the full implementation.


๐Ÿ“Š Feature Parity with Python SDK

Full matrix: docs/FEATURE_PARITY.md | Epic: GHI #20

Feature Status Notes
Agent lifecycle (connect!, close!, block) โœ… + auto-connect on first ask
Streaming responses โœ… Token-by-token via block
Custom tools (declarative + dynamic) โœ… Tool DSL + Tool::Dynamic
Agent Skills (local + GitHub + inline) โœ… Ruby-only: GitHub auto-clone, inline skills
Workspace analysis โœ… Built-in file tools
Guards (FileProtection, SecretMasker) โœ… Ruby-only feature
Sidecars (AuditLogger, VulnScanner) โœ… Ruby-only feature
Hooks (pre/post prompt, tool) โœ… + generic event system
Logging (JSONL + .log) โœ… Auto-attach
Declarative Policies โœ… #21 โ€” DSL, 5 presets, sandbox dirs
MCP Servers (Stdio + HTTP) โŒ Planned P0
Multimodal Input (Image, Audio, Doc) โŒ Planned P1
Structured Output (JSON Schema) โŒ Planned P1
Stateful ToolContext โŒ Planned P1
Session Persistence (save/resume) โŒ Planned P1
Multi-Agent / Subagents โŒ Planned P2
Triggers (background tasks) โŒ Planned P2
Vertex AI backend โŒ Planned P1
Response Cancellation โŒ Planned P1
Budget Limits โŒ Planned P1
OpenTelemetry โŒ Planned P2
LiteRT / Ollama backends โŒ Planned P3

Overall: ~40% parity | 10 Ruby-only features | Convergence plan

๐Ÿงช Development

just test           # 76 unit specs (fast, no harness needed)
just integration    # Integration tests (requires GEMINI_API_KEY)
just rv-examples    # Run all rv examples

๐Ÿค– Telegram Integration

Chat with your Antigravity agent on Telegram โ€” text and voice messages with automatic transcription!

  1. Create a bot with @BotFather
  2. Add these to your .env:
TELEGRAM_BOT_TOKEN=your-token-from-botfather
TELEGRAM_CHAT_ID=your-chat-id        # Optional: enables startup greeting
TELEGRAM_SKILLS=./skills/my-skill    # Optional: comma-separated skill paths/URLs
  1. Run:
just rv-skill-telegram

Commands: /start /skills /stop โ€” supports voice messages with ๐Ÿ‡ฎ๐Ÿ‡น๐Ÿ‡ฌ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ธ language detection.

See .env.dist for all available options.

Telegram integration

Telegram voice transcription

๐Ÿ“ฆ Publishing to gem.coop

This gem can be published to the co-op RubyGems alternative gem.coop.

To push a release, obtain an API key from gem.coop and pass it to the push/release commands:

# Push a specific gem file
GEM_HOST_API_KEY=your_api_key_here gem push antigravity-sdk-VERSION.gem --host https://gem.coop/@palladius

# Or use rake release to tag and push automatically
GEM_HOST_API_KEY=your_api_key_here RUBYGEMS_HOST=https://gem.coop/@palladius rake release

๐Ÿ”— Related Projects

Project Language Link
Antigravity Python SDK (official) Python google-antigravity/antigravity-sdk-python
Antigravity Java SDK (unofficial) Java glaforge/antigravity-java-sdk
Antigravity Ruby SDK (this repo) Ruby palladius/antigravity-ruby-sdk
antigravity-sdk gem RubyGems rubygems.org/gems/antigravity-sdk
antigravity-sdk gem (co-op) gem.coop gem.coop/@palladius/antigravity-sdk

๐Ÿ“„ License

Apache 2.0 - see LICENSE for details.

The Antigravity Ruby SDK is an unofficial, community project. It is not an official Google product.