import (
"context"
"io"
+ "net/http"
"os"
"path/filepath"
"strings"
require.Len(t, agents, 3)
require.Equal(t, []string{"Garden", "Library"}, agents.ChildNames())
+ server.reply = func(w http.ResponseWriter, call ModelFakeCall) {
+ text := ""
+ if call.body["prompt_cache_key"] == agents[0].agent.CacheKey() {
+ text = "The decision is recorded."
+ }
+
+ modelWriteEvents(w, modelCompletedEvent([]any{modelMessageItem(text)}, 100, 0, 5))
+ }
+
for _, agent := range agents {
at := clock.Now().Add(time.Minute).Format(scheduleAtLayout)
_, err = agent.schedules.Set("Record the decision for "+agent.agent.config.Name, &at, nil)
require.Eventually(t, func() bool {
for _, agent := range agents {
- if agent.memory.Len() != 2 {
+ count := 1
+ if agent == agents[0] {
+ count = 2
+ }
+
+ usage, err := os.ReadFile(filepath.Join(agent.agent.dir, "usage.jsonl"))
+ if err != nil || !strings.HasSuffix(string(usage), "\n") || agent.memory.Len() != count {
return false
}
}