ask-rails 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2abe315f91db647a828734bbb14a557ba8feac60a35e99185f83545704e721cc
4
- data.tar.gz: be8595aaa795abec9f74d8bee89e44cdfbb0da792b11e944eb7294529e7bede1
3
+ metadata.gz: 8c73b254e032db5c313a0eeca47499a4b30152fcf725ed410e575b0ea0a9460f
4
+ data.tar.gz: bfe5f9b1769e4ea4b864b7dee0c6ca3d1a6587186ccac7820a71f65999f8e0f5
5
5
  SHA512:
6
- metadata.gz: ccc55bc26de71c3382af0dc38ab825e1886ddfcfaf030715bf4dc3ff5c0016fe50dcaa3eb0c0f7dd630cbfeb3f35880cc0d4a28c9f1291ab4822872aa9501336
7
- data.tar.gz: 0bab3d0dab2a293485984deb1acf767c14e63cc9cc8995fab0f2a0e70e276d6e847a2573d41cd535632033f1d151dfbe6cb3118a9c0763ac5c08eacf0593bef7
6
+ metadata.gz: 9c02cc27c98ea141900339703160ecfad56ed70979292a654b8b1f6c7e6562f02307abc7c02a88e319cc3f8e78b66677cfa37bee8a9fc84430f07ef3b3188ba4
7
+ data.tar.gz: d8f235e67a77dba643184f1f81d71f40c70be04725d24e26f6a4778b41bb6cf658f7e1a73067b9ebd88bb1552e25862dce57fe21b52653cfceb7d1db066fc32a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [0.9.0] — 2026-07-30
2
+
3
+ ### Fixed
4
+
5
+ - **Agent generator + templates now follow the ask-agent directory convention.**
6
+ `rails generate ask:agent support_bot` creates `app/agents/support_bot/agent.rb`
7
+ + `instructions.md` + `tools/` (the discovery layout), not a flat
8
+ `app/agents/support_bot.rb`. Templates no longer reference the removed
9
+ `system_prompt`/`tool` Definition DSL — they use `model`, `provider`,
10
+ `max_turns`, and `tools` (plural), with instructions auto-loaded from
11
+ the sibling `instructions.md`.
12
+
1
13
  ## [0.8.0] — 2026-07-31
2
14
 
3
15
  ### Added
data/README.md CHANGED
@@ -41,16 +41,28 @@ Scaffolds a new agent:
41
41
  rails generate ask:agent support_bot
42
42
  ```
43
43
 
44
- Creates `app/agents/support_bot.rb`:
44
+ Creates the agent directory convention used by ask-agent discovery:
45
+
46
+ ```
47
+ app/agents/support_bot/
48
+ ├── agent.rb # class Agents::SupportBot < ApplicationAgent
49
+ ├── instructions.md # auto-loaded as the system prompt
50
+ └── tools/ # per-agent tools (referenced with `tools :tool_name`)
51
+ ```
45
52
 
46
53
  ```ruby
54
+ # app/agents/support_bot/agent.rb
47
55
  module Agents
48
56
  class SupportBot < ApplicationAgent
49
- system_prompt "You are a helpful assistant."
57
+ model "gpt-4o"
58
+ # tools :search_knowledge_base
50
59
  end
51
60
  end
52
61
  ```
53
62
 
63
+ Run it with `Ask::Agent.new("support_bot")`. The directory name is the
64
+ agent name — keep the file named `agent.rb`.
65
+
54
66
  ### `ask:workflow NAME`
55
67
 
56
68
  Scaffolds a new workflow (requires ask-graph):
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Rails
5
- VERSION = "0.8.0"
5
+ VERSION = "0.9.0"
6
6
  end
7
7
  end
@@ -6,13 +6,17 @@
6
6
  # agent = Ask::Agent.new("<%= file_name %>")
7
7
  # response = agent.run("Hello")
8
8
  #
9
+ # Instructions load automatically from instructions.md next to this file.
10
+ # Per-agent tools live in tools/ — reference them with `tools :tool_name`.
11
+ #
9
12
  module Agents
10
13
  class <%= class_name %> < ApplicationAgent
11
14
  # model "gpt-4o"
12
- system_prompt "You are a helpful assistant."
15
+ # provider :openai
16
+ # max_turns 25
13
17
 
14
- # tool :bash
15
- # tool :read
16
- # tool :grep
18
+ # tools :bash
19
+ # tools :read
20
+ # tools :grep
17
21
  end
18
22
  end
@@ -0,0 +1,9 @@
1
+ # <%= class_name %>
2
+
3
+ You are a helpful assistant. Describe what this agent does and how it
4
+ should behave. This file is auto-loaded as the system prompt.
5
+
6
+ ## Guidelines
7
+
8
+ - Be concise and direct.
9
+ - Use the tools available to you when you need information.
@@ -7,10 +7,12 @@ module Ask
7
7
  class AgentGenerator < ::Rails::Generators::NamedBase
8
8
  source_root File.expand_path("agent/templates", __dir__)
9
9
 
10
- desc "Creates an agent under app/agents — subclass ApplicationAgent with a model and system prompt"
10
+ desc "Creates an agent under app/agents/<name>/the ask-agent directory convention with agent.rb, instructions.md, and tools/"
11
11
 
12
12
  def create_agent
13
- template "agent.rb", "app/agents/#{file_name}.rb"
13
+ template "agent.rb", "app/agents/#{file_name}/agent.rb"
14
+ template "instructions.md", "app/agents/#{file_name}/instructions.md"
15
+ empty_directory "app/agents/#{file_name}/tools"
14
16
  end
15
17
  end
16
18
  end
@@ -4,23 +4,20 @@
4
4
  #
5
5
  # Subclass this to define agents:
6
6
  #
7
- # class Agents::SupportBot < ApplicationAgent
7
+ # # app/agents/support_bot/agent.rb
8
+ # class SupportBotAgent < ApplicationAgent
8
9
  # model "gpt-4o"
9
- # system_prompt "You help users with support questions."
10
- #
11
- # tool :search_knowledge_base
10
+ # tools :search_knowledge_base
12
11
  # end
13
12
  #
13
+ # # app/agents/support_bot/instructions.md — auto-loaded as the system prompt
14
+ # # app/agents/support_bot/tools/search_knowledge_base.rb — per-agent tools
15
+ #
14
16
  # Then run:
15
17
  # agent = Ask::Agent.new("support_bot")
16
18
  # agent.run("How do I reset my password?")
17
19
  #
18
20
  class ApplicationAgent < Ask::Agent::Definition
19
- # Default instructions — override in subclasses
20
- system_prompt "You are a helpful assistant."
21
-
22
- # Uncomment to add built-in tools:
23
- # tool :bash
24
- # tool :read
25
- # tool :grep
21
+ # Default instructions — override by adding an instructions.md file
22
+ # in the agent directory, or with option :system_prompt, "..."
26
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto
@@ -116,6 +116,7 @@ files:
116
116
  - lib/generators/ask/action/templates/action.rb
117
117
  - lib/generators/ask/action_generator.rb
118
118
  - lib/generators/ask/agent/templates/agent.rb
119
+ - lib/generators/ask/agent/templates/instructions.md
119
120
  - lib/generators/ask/agent_generator.rb
120
121
  - lib/generators/ask/install/templates/application_action.rb
121
122
  - lib/generators/ask/install/templates/application_agent.rb