Summary
Description
scheduler.exec() fails in loader/scheduler scripts with the error:
Error: scheduler.exec requires a request object
This happens on version sdk-v0.4.0-58-gc371a82.
Steps to Reproduce
- Deploy an agent with a scheduler script that uses
scheduler.exec():
name: test
agents:
test-agent:
provider: claude
model: claude-sonnet-4-6
image: some-guest-image:latest
driver:
docker: {}
scheduler:
enabled: true
script: |
scheduler.on("test.event", async function(p) {
var r = scheduler.exec(
"echo hello",
{ agent: "test-agent", sessionPolicy: "fresh" }
);
return r;
});
- Apply via
agent-compose up or Web UI
- Trigger — either:
- Web UI: click "立即运行" on the automation task
- API:
RunAgent with schedulerId
- Run fails immediately
What Works
scheduler.log() — logging works normally
scheduler.interval() / scheduler.on() — callbacks are registered correctly
scheduler.emit() — event emission works
- Web UI correctly identifies trigger rules after script validation
What Fails
scheduler.exec() inside any scheduler callback: .on(), .interval(), main()
The same pattern works in other versions (was seen working in newer SDKs).
Error Details
From the Web UI run detail:
Error: scheduler.exec requires a request object
From daemon logs:
error=agent execution failed: message is required
Call stack:
Error: scheduler.exec requires a request object
at proxyHandler (native)
at call (native)
at QJS_FunctionProxy (<proxy_factory>:1:179)
at <anonymous> (loader.js:9:5)
Steps to reproduce
- Start agent-compose v0.4.0-58 daemon
- Deploy any project with a scheduler script that calls scheduler.exec():
- agent-compose up -f test.yml (see YAML below)
- In Web UI, go to 自动化任务 → click "立即运行"
- Observe run fails immediately
name: test
agents:
test-agent:
provider: claude
model: claude-sonnet-4-6
image: agent-compose-guest:latest
driver:
docker: {}
scheduler:
enabled: true
script: |
scheduler.on("test.event", async function(p) {
return scheduler.exec(
"echo hello",
{ agent: "test-agent", sessionPolicy: "fresh" }
);
});
Expected behavior:
scheduler.exec() should create a new session and execute the specified command, then return the result to the caller.
Same behavior as agent-compose exec CLI.
Expected behavior
scheduler.exec() should create a new session and execute the specified command, then return the result to the caller.
Same behavior as agent-compose exec CLI.
Actual behavior
Run fails immediately. In Web UI run detail:
Error: scheduler.exec requires a request object
In daemon logs:
3. In Web UI, go to 自动化任务 → click "立即运行"
4. Observe run fails immediately
name: test
agents:
test-agent:
provider: claude
model: claude-sonnet-4-6
image: agent-compose-guest:latest
driver:
docker: {}
scheduler:
enabled: true
script: |
scheduler.on("test.event", async function(p) {
return scheduler.exec(
"echo hello",
{ agent: "test-agent", sessionPolicy: "fresh" }
);
});
Version or commit
No response
Runtime driver
None
Logs
Summary
Description
scheduler.exec()fails in loader/scheduler scripts with the error:This happens on version sdk-v0.4.0-58-gc371a82.
Steps to Reproduce
scheduler.exec():agent-compose upor Web UIRunAgentwithschedulerIdWhat Works
scheduler.log()— logging works normallyscheduler.interval()/scheduler.on()— callbacks are registered correctlyscheduler.emit()— event emission worksWhat Fails
scheduler.exec()inside any scheduler callback:.on(),.interval(),main()The same pattern works in other versions (was seen working in newer SDKs).
Error Details
From the Web UI run detail:
From daemon logs:
Call stack:
Steps to reproduce
name: test
agents:
test-agent:
provider: claude
model: claude-sonnet-4-6
image: agent-compose-guest:latest
driver:
docker: {}
scheduler:
enabled: true
script: |
scheduler.on("test.event", async function(p) {
return scheduler.exec(
"echo hello",
{ agent: "test-agent", sessionPolicy: "fresh" }
);
});
Expected behavior:
scheduler.exec() should create a new session and execute the specified command, then return the result to the caller.
Same behavior as agent-compose exec CLI.
Expected behavior
scheduler.exec() should create a new session and execute the specified command, then return the result to the caller.
Same behavior as agent-compose exec CLI.
Actual behavior
Run fails immediately. In Web UI run detail:
Error: scheduler.exec requires a request object
In daemon logs:
3. In Web UI, go to 自动化任务 → click "立即运行"
4. Observe run fails immediately
name: test
agents:
test-agent:
provider: claude
model: claude-sonnet-4-6
image: agent-compose-guest:latest
driver:
docker: {}
scheduler:
enabled: true
script: |
scheduler.on("test.event", async function(p) {
return scheduler.exec(
"echo hello",
{ agent: "test-agent", sessionPolicy: "fresh" }
);
});
Version or commit
No response
Runtime driver
None
Logs