Skip to content

Skills

Skills are built-in capabilities (web search, spreadsheets, etc.) provided by the gem. Tools are your app code.

ruby
class ResearchAgent < RailsAgents::Agent
  provider :anthropic
  model "claude-sonnet-4-20250514"
  description "Research topics using current web data and internal docs."
  skills :web_search, :web_fetch
  tools "SearchInternalDocs"
end

Built-in skills

SkillWhat it doesAnthropicOpenAI / OpenRouter / Grok
:web_searchSearch the webNative server toolPortable Ruby tool
:web_fetchRead a URLNative server toolPortable Ruby tool
:code_executionRun code on Anthropic serversNativeAnthropic only
:memoryPersistent memoryNativeAnthropic only
:pptxCreate/edit PowerPointAnthropic Agent SkillAnthropic only
:xlsxCreate/edit ExcelAnthropic Agent SkillAnthropic only
:docxCreate/edit WordAnthropic Agent SkillAnthropic only
:pdfGenerate PDFsAnthropic Agent SkillAnthropic only

On Anthropic, skills run on their servers — the gem passes the right API payloads (including document skills and code_execution when needed).

On other providers, :web_search and :web_fetch use portable Ruby implementations so the same DSL works everywhere.

Skill options

ruby
skills :web_search, max_uses: 5, allowed_domains: ["wikipedia.org"]
# or
skills web_search: { max_uses: 5 }, :xlsx

Document skills + file download

Document skills (:pptx, :xlsx, :docx, :pdf) run on Anthropic's servers. Generated files are automatically downloaded via the Files API:

ruby
class ReportBuilder < RailsAgents::Agent
  provider :anthropic
  model "claude-sonnet-4-20250514"
  description "Build a quarterly sales spreadsheet with charts."
  skills :xlsx
end

result = ReportBuilder.run("Create Q1 sales report", save_files_to: "tmp/reports")
result.output                       # => "Created your spreadsheet..."
result.files.first.filename         # => "report.xlsx"
result.files.first.path             # => "tmp/reports/report.xlsx"

:pptx, :xlsx, :docx, and :pdf automatically enable code_execution, attach Anthropic's published skills, and include the required beta headers.

Configure download behavior in the initializer:

ruby
RailsAgents.configure do |config|
  config.anthropic_api_key = ENV["ANTHROPIC_API_KEY"]
  config.anthropic_auto_download_files = true  # default
  config.anthropic_files_directory = Rails.root.join("tmp/rails_agents/files")
end

Custom Anthropic skills

Upload skills via the Anthropic Skills API, then reference by ID:

ruby
skills :web_search, "skill_01AbCdEfGhIjKlMnOpQrStUv"

Next

Released under the MIT License by Tiny Bubble Company.