Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,6 @@ func WithEnv(env []string) Opt {
// NewLocalRuntime creates a new LocalRuntime without the persistence wrapper.
// This is useful for testing or when persistence is handled externally.
func NewLocalRuntime(agents *team.Team, opts ...Opt) (*LocalRuntime, error) {
modelsStore, err := modelsdev.NewStore()
if err != nil {
return nil, err
}

defaultAgent, err := agents.DefaultAgent()
if err != nil {
return nil, err
Expand All @@ -265,7 +260,6 @@ func NewLocalRuntime(agents *team.Team, opts ...Opt) (*LocalRuntime, error) {
currentAgent: defaultAgent.Name(),
resumeChan: make(chan ResumeRequest),
elicitationRequestCh: make(chan ElicitationResult),
modelsStore: modelsStore,
sessionCompaction: true,
managedOAuth: true,
sessionStore: session.NewInMemorySessionStore(),
Expand All @@ -275,6 +269,14 @@ func NewLocalRuntime(agents *team.Team, opts ...Opt) (*LocalRuntime, error) {
opt(r)
}

if r.modelsStore == nil {
modelsStore, err := modelsdev.NewStore()
if err != nil {
return nil, err
}
r.modelsStore = modelsStore
}

// Validate that the current agent exists and has a model
// (currentAgent might have been changed by options)
defaultAgent, err = r.team.Agent(r.currentAgent)
Expand Down
Loading