{"id":34656190,"url":"https://github.com/marcoroth/activeagent","last_synced_at":"2025-12-24T18:05:31.346Z","repository":{"id":307241675,"uuid":"883185317","full_name":"marcoroth/activeagent","owner":"marcoroth","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-28T23:45:53.000Z","size":1622,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T07:29:11.917Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcoroth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"marcoroth"}},"created_at":"2024-11-04T14:22:08.000Z","updated_at":"2025-07-26T10:16:32.000Z","dependencies_parsed_at":"2025-07-30T07:59:42.051Z","dependency_job_id":"8ea2857f-a2b0-4182-8d49-778fee6952f1","html_url":"https://github.com/marcoroth/activeagent","commit_stats":null,"previous_names":["marcoroth/activeagent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marcoroth/activeagent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Factiveagent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Factiveagent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Factiveagent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Factiveagent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcoroth","download_url":"https://codeload.github.com/marcoroth/activeagent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Factiveagent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28005979,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T18:02:46.240Z","updated_at":"2025-12-24T18:05:31.341Z","avatar_url":"https://github.com/marcoroth.png","language":"Ruby","funding_links":["https://github.com/sponsors/marcoroth"],"categories":[],"sub_categories":[],"readme":"# Active Agent\nGenerative AI powered Rails apps\n\n## What is Active Agent?\nActive Agent is a framework for interacting with generative AI services. ActiveAgent provides a simple and flexible service adapter interface to support various AI providers.\n\n## How does Active Agent work?\nActive Agent provides an interface to define Agents that can load context take prompts then generate content or perform actions. Agents can receive text, image, audio prompts to generate content in the form of text, image, and audio.\n\n### Define Agents\nAgents are the core of Active Agent. An agent takes instructions and can perform actions augment responses by providing data used for generation. Agents are defined by a simple Ruby class that inherits from `ActiveAgent::base` located in the `app/agents` directory.\n\n\n\n```ruby\n# app/agents/inventory_agent.rb\nclass InventoryAgent \u003c ActiveAgent::Base\n  generate_with :openai, model: :gpt4o, temperature: 0.5, max_tokens: 100, instructions: :inventory_operations\n\n  # Define the agent's default instructions to use the inventory_operations action\n  default instructions: :inventory_operations\n\n  def inventory_operations\n    @organization = Organization.find(params[:account_id])\n    message(:inventory_operation, role: :system)\n  end\nend\n```\n\n### Action Prompts\nSimilarly to ActionController and ActionMailer, Active Agent uses Action Prompt both for rendering `instructions` prompt views as well as rendering action views. Action Prompt `instructions` in the form of a system message.\n\n```ruby\n# app/views/agents/inventory_operations.text.erb\n  INSTRUCTIONS: You are an inventory manager for \u003c%= @organization.name %\u003e. You can search for inventory or reconcile inventory using \u003c%= assigned_actions %\u003e\n```\n\n### What are Actions?\nActions are just Ruby methods so they can do anything app can do already. Actions are commonly used retrieve data or interact with external services. The Actions are called when the agent generates an agent message with \n\n### How do Agents call Actions?\nSimilar to how Rails needs to define routes to requests to controller actions, Active Agent needs to map the agent action.\n\n# config/operations.rb\n```ruby\nRails.application.agents.actions do\n  operation :inventory do\n    action :search_inventory do\n      description \"Retrieves an inventory item based on either the name, code, or nearest neighbor embedding.\"\n\n      parameter :name, type: \"string\", description: \"The name of the inventory item to retrieve.\"\n      parameter :code, type: \"string\", description: \"The code of the inventory item to retrieve.\"\n      parameter :embedding, type: \"array\", description: \"The embedding vector to find the nearest inventory item.\", items: { type: \"number\" }\n    end\n  end\nend\n```\n\n```ruby\n\n#### Actions have consequences (results)\n\nThe results are in the form of a tool message, providing additional information as context to augment the context prior to content generation.\n\n#### Set the Agent's service configuration and options to use\nBy default the agent uses the generation service provider set in the Rails application configuration. \n\n```ruby\nclass Application \u003c Rails::Application\n  config.active_agent.generation_provider = :openai\nend\n```\n\n#### Generation service provider configurations are defined in the `config/generation.yml` file\n```yaml\nopenai:\n  access_token: \u003c%= Rails.application.credentials.openai_access_token %\u003e\n```\n# Options\n\n\n### How can agents be used?\nAgents can be used to perform actions \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcoroth%2Factiveagent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcoroth%2Factiveagent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcoroth%2Factiveagent/lists"}