MCPcopy Index your code
hub / github.com/docker/docker-agent / runSession

Function runSession

pkg/runtime/runtime_test.go:231–250  ·  view source on GitHub ↗
(t *testing.T, sess *session.Session, stream *mockStream)

Source from the content-addressed store, hash-verified

229}
230
231func runSession(t *testing.T, sess *session.Session, stream *mockStream) []Event {
232 t.Helper()
233
234 prov := &mockProvider{id: "test/mock-model", stream: stream}
235 root := agent.New("root", "You are a test agent", agent.WithModel(prov))
236 tm := team.New(team.WithAgents(root))
237
238 rt, err := NewLocalRuntime(t.Context(), tm, WithSessionCompaction(false), WithModelStore(mockModelStore{}))
239 require.NoError(t, err)
240
241 sess.Title = "Unit Test"
242
243 evCh := rt.RunStream(t.Context(), sess)
244
245 var events []Event
246 for ev := range evCh {
247 events = append(events, ev)
248 }
249 return events
250}
251
252func hasEventType(t *testing.T, events []Event, target Event) bool {
253 t.Helper()

Callers 14

TestSimpleFunction · 0.85
TestWithReasoningFunction · 0.85
TestToolCallSequenceFunction · 0.85
TestXMLToolCallFallbackFunction · 0.85
TestToolCallVariationsFunction · 0.85

Calls 8

RunStreamMethod · 0.95
NewFunction · 0.92
NewFunction · 0.92
WithAgentsFunction · 0.92
NewLocalRuntimeFunction · 0.85
WithSessionCompactionFunction · 0.85
WithModelStoreFunction · 0.85
ContextMethod · 0.80

Tested by

no test coverage detected