Files
archie/internal/agentexec/modelloop/runtime.go
T
sam 1e435e9224 style: adopt task fmt output; regenerate contracts and sqlc code; gateway cleanup derives its context
goimports during the service refactors rewrote generated files; they are
restored from their generators.
2026-10-04 01:48:32 +10:00

28 lines
890 B
Go

package modelloop
import (
"github.com/samcharles93/ai-sdk/runtime"
"github.com/samcharles93/archie-core/internal/domain/agentrun"
)
// NewRuntime builds a provider runtime for interactive chat or a worker-local
// workflow stage. Nil means no providers were configured.
func NewRuntime(providers map[string]agentrun.Provider) *runtime.Runtime {
if len(providers) == 0 {
return nil
}
runtime.RegisterBuiltinClasses()
catalog := make(map[string]runtime.ProviderConfig, len(providers))
for name, provider := range providers {
cfg := runtime.ProviderConfig{ID: name, Class: provider.Class, BaseURL: provider.BaseURL}
if provider.APIKeyEnv == "" {
cfg.Auth = runtime.AuthConfig{Type: runtime.AuthTypeNone}
} else {
cfg.Auth = runtime.AuthConfig{APIKeyEnv: provider.APIKeyEnv}
}
catalog[name] = cfg
}
return runtime.NewRuntime(runtime.Config{Providers: catalog})
}