What the agent does
The agent reads the project before it adds a cron line. In a workspace laid out like dagster-io/hooli-data-eng-pipelines, the root dg.toml lists six projects, and the one with no schedule is hooli-basics. Its pyproject.toml depends on dagster, dagster-duckdb, pandas, beautifulsoup4, html5lib, scikit-learn and dagster-cloud[insights], keeps dagster-webserver and pytest under a dev extra, builds with hatchling, requires Python >=3.9,<3.13, and points [tool.dg.project] at hooli_basics.definitions; uv.lock pins dagster and dagster-cloud at 1.11.12. src/hooli_basics/definitions.py declares three assets: country_stats reads a population table from a web page with read_html, change_model fits a LinearRegression on it and returns a MaterializeResult with metadata, and continent_stats groups by continent; check_country_stats is an asset_check on the first. The Definitions object passes those assets through with_source_code_references and link_code_references_to_git_if_cloud, lists the check, and nothing else: no jobs, no schedules, no sensors. dagster_cloud.yaml deploys it as the basics code location, and .github/workflows/deploy-dagster-cloud.yml rebuilds only the projects whose directory changed.
The agent follows the shape the sibling project already uses. In hooli-data-eng/src/hooli_data_eng/defs/pandas/schedules.py, a schedule is dg.ScheduleDefinition(name=..., cron_schedule=..., job=dg.define_asset_job(...)), and components/scheduled_job_component.py builds the same pair from cron_schedule, asset_selection and job_name. So for hooli-basics it adds src/hooli_basics/schedules.py with basics_job = dg.define_asset_job("basics_job", selection=[country_stats, change_model, continent_stats]) and basics_daily = dg.ScheduleDefinition(name="basics_daily", job=basics_job, cron_schedule="0 6 * * *", execution_timezone="UTC", description=...), then passes jobs=[basics_job] and schedules=[basics_daily] to the existing Definitions call. The asset check runs with the job because it is attached to country_stats, so each morning's materialisation carries the check result. default_status is left at its default, stopped: this location deploys to Dagster+ from master, and the pull request says a person turns the schedule on in the UI after the deploy rather than having a merge start a daily job by itself.
The web page the first asset reads is the reason a schedule makes sense here, and also the thing to be careful about: a daily job that fetches a public table should fail loudly rather than retry in a loop. The agent sets tags={"team": "basics"} on the job so the run list can be filtered, and writes in the schedule's description what the job refreshes and where its input comes from. It does not add a sensor, a partition or a backfill policy, because the assets are unpartitioned and the three of them run in under a minute on a laptop; the pull request names build_schedule_from_partitioned_job, which the sibling component uses, as the form to switch to if the assets ever gain a daily partition.
There are tests in the sibling project (hooli_data_eng_tests/test_repo_loads.py asserts get_job(...) on the loaded definitions) and none in hooli-basics, so the agent adds hooli_basics_tests/test_definitions.py: it imports defs from hooli_basics.definitions, asserts defs.get_schedule_def("basics_daily").cron_schedule == "0 6 * * *", asserts defs.get_job_def("basics_job") resolves and selects exactly three asset keys, and loads the definitions once so an import error in schedules.py fails the suite. It runs uv sync --extra dev and uv run pytest from hooli-basics/, then uv run dg check defs so the project loads the way Dagster+ will load it, and opens the pull request with that output.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Add a daily schedule to the hooli-basics Dagster project in this repository. Read dg.toml, dagster_cloud.yaml, .github/workflows/deploy-dagster-cloud.yml, hooli-basics/pyproject.toml, hooli-basics/uv.lock (for the Dagster version), hooli-basics/src/hooli_basics/definitions.py, and the existing schedule pattern in hooli-data-eng/src/hooli_data_eng/defs/pandas/schedules.py and hooli-data-eng/src/hooli_data_eng/components/scheduled_job_component.py first. Add hooli-basics/src/hooli_basics/schedules.py with an asset job named basics_job selecting country_stats, change_model and continent_stats, tagged team=basics, and a ScheduleDefinition named basics_daily on cron 0 6 * * * in UTC with a description; leave default_status at its default and say why in the pull request. Register both in the Definitions call. Add hooli_basics_tests/test_definitions.py that asserts the schedule's cron, that the job resolves with three asset keys, and that the definitions load. Run uv sync --extra dev, uv run pytest and uv run dg check defs from hooli-basics/, then open a pull request that quotes the output.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The pull request adds hooli-basics/src/hooli_basics/schedules.py and hooli-basics/hooli_basics_tests/test_definitions.py, and changes hooli-basics/src/hooli_basics/definitions.py (the import and the two new Definitions arguments). pyproject.toml and uv.lock do not change, because pytest is already in the dev extra and no new package is needed. Its description quotes the pytest and dg check defs output and lists the schedule's name, cron and time zone, so a reviewer who only reads the description knows when the job will fire once it is turned on.
A reviewer checks the three things that go wrong with a first schedule: a cron that fires in the wrong time zone (execution_timezone is explicit), a job that selects an asset by a stale key (the test counts three), and a schedule that starts running the moment the location deploys (the default status is stopped, and the pull request says who turns it on). Because the deploy workflow only rebuilds directories that changed, they confirm the diff stays inside hooli-basics/ so only the basics location is rebuilt.
Locally, dagster dev in hooli-basics/ shows the schedule under its code location with the next tick computed from the cron, which is the same view Dagster+ shows after the deploy.
Run it on every new asset with no schedule
An automation on the Project with a github trigger on pull_request.opened and pull_request.synchronize runs on every pull request that touches a definitions.py and reads it for assets that no job or schedule selects. An automation's run is read-only, so it posts a review comment naming the assets and the cron it would propose, rather than pushing a schedule onto someone else's branch.
For a workspace with several code locations, a handler on the reader's own server sends this body once per project directory to POST /o/{org}/sessions, with the project path in the prompt and a request_id that is a UUID v5 of that path, so a retried call returns the run it already started. Each run reads its own Definitions and proposes a job selection that matches its assets.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
A schedule is a few lines and a deploy away from a job that runs every morning for years, so the thing to get right is the check that it loads and selects what you meant. The agent runs pytest and dg check defs in its own sandbox with the same uv.lock the Dockerfile uses, and keeps that output with the pull request, so the reviewer sees the definitions load before the deploy workflow does.
Teams with many code locations add the same pattern to each one, and each one has a different asset graph and a different convention for names and tags. One run per project directory, started from a script, gives one pull request per location that follows the schedule file that location's siblings already have.
Frequently asked questions
Why is the schedule not turned on by default?
Because default_status=dg.DefaultScheduleStatus.RUNNING would start it the moment the basics location deploys from master. Leaving the default means a person turns it on in the Dagster+ UI once they have seen it, which the pull request says explicitly. Changing that is one keyword argument.
Does the asset check run on the schedule?
Yes. check_country_stats is attached to country_stats, and an asset job that materialises the asset runs its checks, so each scheduled run records the check result alongside the materialisation.
Why an asset job instead of an op job?
The project is asset-based: three @asset functions and no ops. define_asset_job with an explicit selection is the form both sibling projects use, and it keeps the schedule tied to asset keys rather than to a graph that would have to be written by hand.
What runs the schedule locally?
dagster dev starts the daemon together with the web server, so a schedule turned on locally fires on its cron. In Dagster+ the agent for the hybrid deployment runs it. Nothing in the pull request depends on which one is in use.
What about partitions?
The three assets are unpartitioned, so a plain ScheduleDefinition is right. If they gain a daily partition, build_schedule_from_partitioned_job, which scheduled_job_component.py already uses for the dbt project, replaces the cron schedule and runs one partition per tick.
More Dagster jobs
The same job on other stacks
More jobs like this: Hand off a long task
- Add Search Autocomplete to a Wagtail Site (Wagtail)
- Add Search to a Hugo Site (Hugo)