aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/dashapi/ai.go
blob: 893ed72150b6dc3f47d685f7b92e8ddb546f0d2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2025 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

package dashapi

import (
	"github.com/google/syzkaller/pkg/aflow/ai"
	"github.com/google/syzkaller/pkg/aflow/trajectory"
)

type AIJobPollReq struct {
	LLMModel     string // LLM model that will be used to execute jobs
	CodeRevision string // git commit of the syz-agent server
	Workflows    []AIWorkflow
}

type AIWorkflow struct {
	Type ai.WorkflowType
	Name string
}

type AIJobPollResp struct {
	ID       string
	Workflow string
	Args     map[string]any
}

type AIJobDoneReq struct {
	ID      string
	Error   string
	Results map[string]any
}

type AITrajectoryReq struct {
	JobID string
	Span  *trajectory.Span
}

func (dash *Dashboard) AIJobPoll(req *AIJobPollReq) (*AIJobPollResp, error) {
	resp := new(AIJobPollResp)
	if err := dash.Query("ai_job_poll", req, resp); err != nil {
		return nil, err
	}
	return resp, nil
}

func (dash *Dashboard) AIJobDone(req *AIJobDoneReq) error {
	return dash.Query("ai_job_done", req, nil)
}

func (dash *Dashboard) AITrajectoryLog(req *AITrajectoryReq) error {
	return dash.Query("ai_trajectory_log", req, nil)
}