Agents that don't run forever
class SayHelloWorld5TimesAgent < Sublayer::Agents::Base
trigger TimeTrigger.new(5)
goal_condition { @greeting_count == 5 }
check_status { puts "Current hello world count is: #{@greeting_count}" }
step do
@greeting_count += 1
puts "hello world"
end
def initialize
@greeting_count = 0
end
end
There may be a desire to have "stop" conditions for an agent.
The code above is "wrong" in the sense that "goal conditions" and "status checking" is meant for the repetition of steps. Triggers are meant for the "starting" of the step/goal condition flow, and in some ways the agent itself. so "starting" is directly related to "triggers" and status/goals/steps is the repetitve "action" but "stopping" the entire agent itself is currently not yet a thing.
Bringing the conversation here over from Discord.
Couple things to thing about with this...
I know there are probably a lot of them, but would love to see some examples of agents that we'd want to stop on their own (and not sit around waiting for a trigger) where you wouldn't just kill the process yourself.
We're also exploring bringing back the CLI/TUI from an earlier version of the framework for controlling and building agents, and in that case being able to control execution directly between multiple agents, actions, and generators