Files
archie/internal/agentexec/runtime.go
T
sam 59166eda3a refactor(agentrun): agent stage contract moves to the domain layer
internal/domain/workflow imported internal/agentexec for its protocol types,
pulling the AI runtime into every binary that touches workflow types. The
request, result and runner contract now live in internal/domain/agentrun;
agentexec keeps the runtime. The model catalog cache moves from servicekit
into modelcatalog and WaitForPeer into staterpc, so archie-state-store and
archie-messaging no longer link the AI runtime.
2026-10-04 01:33:00 +10:00

27 lines
889 B
Go

package agentexec
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})
}