Compare commits

..

3 Commits

Author SHA1 Message Date
mudler
47492f890f chore(tests): add timeout 2025-04-22 21:46:25 +02:00
mudler
ddac344147 chore: better defaults for parallel jobs
Signed-off-by: mudler <mudler@localai.io>
2025-04-22 21:28:00 +02:00
Ettore Di Giacinto
25bb3fb123 feat: allow the agent to perform things concurrently (#74)
* feat: allow the agent to perform things concurrently

Signed-off-by: mudler <mudler@localai.io>

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* collect errors

Signed-off-by: mudler <mudler@localai.io>

---------

Signed-off-by: mudler <mudler@localai.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-22 16:49:28 +02:00
3 changed files with 8 additions and 2 deletions

View File

@@ -990,7 +990,6 @@ func (a *Agent) periodicallyRun(timer *time.Timer) {
} }
func (a *Agent) Run() error { func (a *Agent) Run() error {
a.startNewConversationsConsumer() a.startNewConversationsConsumer()
xlog.Debug("Agent is now running", "agent", a.Character.Name) xlog.Debug("Agent is now running", "agent", a.Character.Name)
// The agent run does two things: // The agent run does two things:
@@ -1013,7 +1012,12 @@ func (a *Agent) Run() error {
var muErr sync.Mutex var muErr sync.Mutex
var wg sync.WaitGroup var wg sync.WaitGroup
for i := 0; i <= a.options.parallelJobs; i++ { parallelJobs := a.options.parallelJobs
if a.options.parallelJobs == 0 {
parallelJobs = 1
}
for i := 0; i < parallelJobs; i++ {
xlog.Debug("Starting agent worker", "worker", i) xlog.Debug("Starting agent worker", "worker", i)
wg.Add(1) wg.Add(1)
go func() { go func() {

View File

@@ -64,6 +64,7 @@ func (o *options) SeparatedMultimodalModel() bool {
func defaultOptions() *options { func defaultOptions() *options {
return &options{ return &options{
parallelJobs: 1,
periodicRuns: 15 * time.Minute, periodicRuns: 15 * time.Minute,
LLMAPI: llmOptions{ LLMAPI: llmOptions{
APIURL: "http://localhost:8080", APIURL: "http://localhost:8080",

View File

@@ -25,6 +25,7 @@ var _ = Describe("Agent test", func() {
agent, err = New( agent, err = New(
WithLLMAPIURL(apiURL), WithLLMAPIURL(apiURL),
WithModel(testModel), WithModel(testModel),
WithTimeout("10m"),
WithRandomIdentity(), WithRandomIdentity(),
) )
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())