Files
ai-agent/internal/ai/application/runtime/service.go
T

33 lines
833 B
Go
Raw Normal View History

package runtime
import (
"context"
"code.tczkiot.com/wlw/ai-agent/internal/models"
)
type Service struct {
engine *AgentLoopEngine
}
func NewService() *Service {
return NewServiceWithEngine(NewAgentLoopEngine())
}
func NewServiceWithEngine(engine *AgentLoopEngine) *Service {
return &Service{engine: engine}
}
func (s *Service) Run(ctx context.Context, req RunInput) (*RunResult, error) {
return s.engine.Run(ctx, req)
}
func (s *Service) Resume(ctx context.Context, req ResumeInput) (*RunResult, error) {
return s.engine.Resume(ctx, req)
}
func (s *Service) RunOfflineEvaluation(ctx context.Context, agent models.AIAgent, config models.AIConfig, cases []OfflineEvaluationCase) (OfflineEvaluationReport, error) {
runner := NewOfflineEvaluationRunner(s.engine.Run)
return runner.Run(ctx, agent, config, cases), nil
}