MCPcopy
hub / github.com/google/ax / TestResume

Function TestResume

internal/controller/executor/executor_test.go:264–299  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

262}
263
264func TestResume(t *testing.T) {
265 ctx := context.Background()
266 eventLog := memoryEventLog()
267
268 registry := map[string]agent.Agent{
269 "root": AgentFunc(func(inputs []*proto.Message, tm agent.Executor, o agent.OutputHandler) {
270 if _, err := tm.Exec(ctx, "test-conv", "child-task", &proto.AgentStart{
271 AgentId: "child",
272 Messages: inputs,
273 }, nil); err != nil {
274 t.Fatal(err)
275 }
276 if o != nil {
277 o(&proto.AgentOutputs{
278 Messages: []*proto.Message{text("assistant", "root done")},
279 })
280 }
281 }),
282 "child": AgentFunc(func(inputs []*proto.Message, tm agent.Executor, o agent.OutputHandler) {
283 time.Sleep(100 * time.Millisecond)
284 if o != nil {
285 o(&proto.AgentOutputs{
286 Messages: []*proto.Message{text("assistant", "child done")},
287 })
288 }
289 }),
290 }
291
292 tm := DefaultExecutor(eventLog, registry)
293 if _, err := tm.Exec(ctx, "test-conv", "root-task", &proto.AgentStart{
294 AgentId: "root",
295 Messages: []*proto.Message{text("user", "hello!")},
296 }, nil); err != nil {
297 t.Fatal(err)
298 }
299}
300
301func TestResumeAgentIDMismatch(t *testing.T) {
302 ctx := context.Background()

Callers

nothing calls this directly

Calls 5

memoryEventLogFunction · 0.85
AgentFuncFunction · 0.85
textFunction · 0.85
DefaultExecutorFunction · 0.85
ExecMethod · 0.65

Tested by

no test coverage detected