agent_c 2.9

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.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +10 -0
  3. data/.ruby-version +1 -0
  4. data/CLAUDE.md +21 -0
  5. data/README.md +360 -0
  6. data/Rakefile +16 -0
  7. data/TODO.md +105 -0
  8. data/agent_c.gemspec +38 -0
  9. data/docs/batch.md +503 -0
  10. data/docs/chat-methods.md +156 -0
  11. data/docs/cost-reporting.md +86 -0
  12. data/docs/pipeline-tips-and-tricks.md +453 -0
  13. data/docs/session-configuration.md +274 -0
  14. data/docs/testing.md +747 -0
  15. data/docs/tools.md +103 -0
  16. data/docs/versioned-store.md +840 -0
  17. data/lib/agent_c/agent/chat.rb +211 -0
  18. data/lib/agent_c/agent/chat_response.rb +38 -0
  19. data/lib/agent_c/agent/chats/anthropic_bedrock.rb +48 -0
  20. data/lib/agent_c/batch.rb +102 -0
  21. data/lib/agent_c/configs/repo.rb +90 -0
  22. data/lib/agent_c/context.rb +56 -0
  23. data/lib/agent_c/costs/data.rb +39 -0
  24. data/lib/agent_c/costs/report.rb +219 -0
  25. data/lib/agent_c/db/store.rb +162 -0
  26. data/lib/agent_c/errors.rb +19 -0
  27. data/lib/agent_c/pipeline.rb +152 -0
  28. data/lib/agent_c/pipelines/agent.rb +219 -0
  29. data/lib/agent_c/processor.rb +98 -0
  30. data/lib/agent_c/prompts.yml +53 -0
  31. data/lib/agent_c/schema.rb +71 -0
  32. data/lib/agent_c/session.rb +206 -0
  33. data/lib/agent_c/store.rb +72 -0
  34. data/lib/agent_c/test_helpers.rb +173 -0
  35. data/lib/agent_c/tools/dir_glob.rb +46 -0
  36. data/lib/agent_c/tools/edit_file.rb +114 -0
  37. data/lib/agent_c/tools/file_metadata.rb +43 -0
  38. data/lib/agent_c/tools/git_status.rb +30 -0
  39. data/lib/agent_c/tools/grep.rb +119 -0
  40. data/lib/agent_c/tools/paths.rb +36 -0
  41. data/lib/agent_c/tools/read_file.rb +94 -0
  42. data/lib/agent_c/tools/run_rails_test.rb +87 -0
  43. data/lib/agent_c/tools.rb +61 -0
  44. data/lib/agent_c/utils/git.rb +87 -0
  45. data/lib/agent_c/utils/shell.rb +58 -0
  46. data/lib/agent_c/version.rb +5 -0
  47. data/lib/agent_c.rb +32 -0
  48. data/lib/versioned_store/base.rb +314 -0
  49. data/lib/versioned_store/config.rb +26 -0
  50. data/lib/versioned_store/stores/schema.rb +127 -0
  51. data/lib/versioned_store/version.rb +5 -0
  52. data/lib/versioned_store.rb +5 -0
  53. data/template/Gemfile +9 -0
  54. data/template/Gemfile.lock +152 -0
  55. data/template/README.md +61 -0
  56. data/template/Rakefile +50 -0
  57. data/template/bin/rake +27 -0
  58. data/template/lib/autoload.rb +10 -0
  59. data/template/lib/config.rb +59 -0
  60. data/template/lib/pipeline.rb +19 -0
  61. data/template/lib/prompts.yml +57 -0
  62. data/template/lib/store.rb +17 -0
  63. data/template/test/pipeline_test.rb +221 -0
  64. data/template/test/test_helper.rb +18 -0
  65. metadata +194 -0
data/docs/tools.md ADDED
@@ -0,0 +1,103 @@
1
+ # Custom Tools
2
+
3
+ If you are using a Batch, these tools are available and will be automatically configured for the correct directories/environment variables.
4
+
5
+ ## Available tools
6
+
7
+ AgentC comes with several built-in tools that the LLM can use to interact with your codebase:
8
+
9
+ - `dir_glob` - List files matching patterns
10
+ - `read_file` - Read file contents
11
+ - `edit_file` - Make changes to files
12
+ - `file_metadata` - Get file information
13
+ - `grep` - Search within files
14
+ - `run_rails_test` - Execute Rails tests
15
+
16
+ # Using with sessions directly
17
+
18
+ This section is only relevant if you are not using a Batch.
19
+
20
+ ## Using Tools
21
+
22
+ Tools are specified when creating a chat or using session.prompt:
23
+
24
+ ```ruby
25
+ session = AgentC::Session.new(
26
+ agent_db_path: 'tmp/db/agent.sqlite3',
27
+ project: 'my_project'
28
+ )
29
+
30
+ # Chat with specific tools
31
+ chat = session.chat(tools: [:read_file, :grep])
32
+ response = chat.ask("What files contain the User model?")
33
+
34
+ # Or use session.prompt with tools
35
+ result = session.prompt(
36
+ prompt: "Summarize the README",
37
+ tools: [:read_file],
38
+ tool_args: { workspace_dir: '/path/to/project' },
39
+ schema: -> { string(:summary) }
40
+ )
41
+ ```
42
+
43
+ ## Tool Examples
44
+
45
+ ### dir_glob
46
+
47
+ List files matching glob patterns:
48
+
49
+ ```ruby
50
+ chat = session.chat(tools: [:dir_glob])
51
+ response = chat.ask("Show me all Ruby files in the lib directory")
52
+ ```
53
+
54
+ ### read_file
55
+
56
+ Read the contents of a file:
57
+
58
+ ```ruby
59
+ chat = session.chat(tools: [:read_file])
60
+ response = chat.ask("What does lib/agent_c/chat.rb do?")
61
+ ```
62
+
63
+ ### edit_file
64
+
65
+ Make changes to files:
66
+
67
+ ```ruby
68
+ chat = session.chat(tools: [:edit_file])
69
+ response = chat.ask("Add a method called 'foo' to lib/agent_c/chat.rb")
70
+ ```
71
+
72
+ ### grep
73
+
74
+ Search for patterns within files:
75
+
76
+ ```ruby
77
+ chat = session.chat(tools: [:grep])
78
+ response = chat.ask("Find all calls to the 'process' method in the codebase")
79
+ ```
80
+
81
+ ### run_rails_test
82
+
83
+ Execute Rails tests:
84
+
85
+ ```ruby
86
+ chat = session.chat(tools: [:run_rails_test])
87
+ response = chat.ask("Run the tests in test/models/user_test.rb")
88
+ ```
89
+
90
+ ## Tool Resolution with Pipelines
91
+
92
+ When using tools in Pipeline agent_steps, tools are automatically resolved to the workspace's working directory:
93
+
94
+ ```ruby
95
+ class MyPipeline < AgentC::Pipeline
96
+ agent_step(
97
+ :analyze_code,
98
+ tools: [:read_file, :grep]
99
+ )
100
+ end
101
+ ```
102
+
103
+ The tools will operate in the context of `workspace.dir` for that pipeline execution.