18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/brute/tools/delegate.rb', line 18
def call(task:)
provider = Brute.provider
sub = LLM::Context.new(provider, tools: [FSRead, FSSearch])
prompt = sub.prompt do
system "You are a research agent. Analyze code, explain patterns, and answer questions. " \
"You have read-only access to the filesystem. Be thorough and precise."
user task
end
res = sub.talk(prompt)
rounds = 0
while sub.functions.any? && rounds < 10
res = sub.talk(sub.functions.map(&:call))
rounds += 1
end
{result: (res, sub)}
end
|