()
| 36 | } |
| 37 | |
| 38 | func Example() { |
| 39 | ctx := context.Background() |
| 40 | |
| 41 | registry := map[string]agent.Agent{ |
| 42 | "planner": AgentFunc(func(inputs []*proto.Message, tm agent.Executor, o agent.OutputHandler) { |
| 43 | if _, err := tm.Exec(ctx, "test-conv", "deep-research-task", &proto.AgentStart{ |
| 44 | AgentId: "deep-research", |
| 45 | Messages: inputs, |
| 46 | }, o); err != nil { |
| 47 | return |
| 48 | } |
| 49 | |
| 50 | if _, err := tm.Exec(ctx, "test-conv", "pub-med-lookup-task", &proto.AgentStart{ |
| 51 | AgentId: "pub-med-index", |
| 52 | Messages: inputs, |
| 53 | }, o); err != nil { |
| 54 | return |
| 55 | } |
| 56 | }), |
| 57 | } |
| 58 | |
| 59 | tm := DefaultExecutor(memoryEventLog(), registry) |
| 60 | if _, err := tm.Exec(ctx, "test-conv", "test", &proto.AgentStart{ |
| 61 | AgentId: "planner", |
| 62 | Messages: []*proto.Message{text("user", "Hello, I'd like to research cancer treatment options.")}, |
| 63 | }, nil); err != nil { |
| 64 | log.Fatal(err) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | func TestTaskManager(t *testing.T) { |
| 69 | ctx := context.Background() |
nothing calls this directly
no test coverage detected