Skip to content

Add active_agent:json_schema generator for stub tool‑schema templates #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

otrub
Copy link
Contributor

@otrub otrub commented Jul 16, 2025

This PR introduces a dedicated generator that scaffolds function‑tool JSON schemas for agent actions, so they are ready for OpenAI tool‑calls without manual boilerplate.

What’s included

  • New generator rails g active_agent:json_schema AgentName action
    -- Creates .json.jbuilder under app/views/_agent/
    -- Skips files that already exist
  • Stub template (view.json.jbuilder.tt)
    -- Produces a minimal, valid schema
  • Runtime dependency on jbuilder added to the gemspec
  • USAGE file updated with examples
  • Generator test JsonSchemaGeneratorTest

- Introduce a generator for creating stub JSON schema templates for agent actions.
- Update gemspec to add `jbuilder` as a required dependency.
- Add test coverage for the new generator.
@otrub otrub marked this pull request as ready for review July 16, 2025 09:11
Copy link
Contributor

@TonsOfFun TonsOfFun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like where you're going with this, but let's try it without making jbuilder a dependency. Another thing I have been toying with is using fastMCP style tool schema definitions in your agent class similar to strong parameters in action controller.

@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
spec.add_dependency "activejob", ">= 7.2", "< 9.0"

spec.add_dependency "rails", ">= 7.2", "< 9.0"
spec.add_development_dependency "jbuilder"
spec.add_dependency "jbuilder"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not everyone uses jbuilder, so I'd prefer keeping it a dev dependency for testing jbuilder without forcing it on everyone as a dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thoughtful feedback! I’ll move jbuilder back to a dev dependency and experiment with a fastMCP-style schema defined directly in the agent class. I’ll update the PR shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants