Skip to content

Commit 923833d

Browse files
authored
agent simulate: load scenarios.yaml; drop scenario CRUD UI (#863)
1 parent 0999685 commit 923833d

8 files changed

Lines changed: 540 additions & 514 deletions

File tree

cmd/lk/simulate.go

Lines changed: 259 additions & 103 deletions
Large diffs are not rendered by default.

cmd/lk/simulate_ci.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ func runSimulateCI(ctx context.Context, config *simulateConfig) error {
118118
return err
119119
}
120120
fmt.Fprintf(os.Stdout, "✓ Source uploaded (%s)\n", time.Since(start).Round(time.Millisecond))
121+
} else if g := config.scenarioGroup; g != nil {
122+
name := g.GetName()
123+
if name == "" {
124+
name = "scenarios"
125+
}
126+
fmt.Fprintf(os.Stdout, "✓ Loaded %d scenarios from %s (%q)\n", len(g.GetScenarios()), config.scenariosPath, name)
121127
}
122128

123129
fmt.Fprintln(os.Stdout, "::endgroup::")

cmd/lk/simulate_save.go

Lines changed: 0 additions & 332 deletions
This file was deleted.

cmd/lk/simulate_subprocess.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ type AgentStartConfig struct {
127127
Dir string
128128
Entrypoint string
129129
ProjectType agentfs.ProjectType
130-
CLIArgs []string // e.g. ["start", "--url", "..."] or ["console", "--connect-addr", addr]
131-
Env []string // e.g. ["LIVEKIT_AGENT_NAME=x"] or nil
130+
CLIArgs []string // subcommand first, then flags: ["start", "--url", "..."] or ["console", "--connect-addr", addr]
131+
Env []string // e.g. ["LIVEKIT_AGENT_NAME_OVERRIDE=x"] or nil
132132
ReadySignal string // substring to scan for in output (e.g. "registered worker"), empty to skip
133133
ForwardOutput io.Writer // if set, forward each output line to this writer
134134
}
@@ -140,8 +140,19 @@ func startAgent(cfg AgentStartConfig) (*AgentProcess, error) {
140140
return nil, err
141141
}
142142

143-
args := append(prefixArgs, cfg.Entrypoint)
144-
args = append(args, cfg.CLIArgs...)
143+
// Launch via the framework CLI module rather than running the user's file
144+
// directly: python -m livekit.agents SUBCOMMAND ENTRYPOINT FLAGS. The framework
145+
// discovers the AgentServer from the entrypoint and drives the thin CLI. Requires a
146+
// livekit-agents that supports start/console under -m livekit.agents; older versions
147+
// only expose download-files there.
148+
args := append(prefixArgs, "-m", "livekit.agents")
149+
if len(cfg.CLIArgs) > 0 {
150+
args = append(args, cfg.CLIArgs[0]) // subcommand: start | console
151+
args = append(args, cfg.Entrypoint) // entrypoint positional (server discovery)
152+
args = append(args, cfg.CLIArgs[1:]...)
153+
} else {
154+
args = append(args, cfg.Entrypoint)
155+
}
145156
cmd := exec.Command(pythonBin, args...)
146157
setProcAttr(cmd)
147158
cmd.Dir = cfg.Dir

0 commit comments

Comments
 (0)