-
Notifications
You must be signed in to change notification settings - Fork 50
feat(schedules): agent run schedules (v1) #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jromualdez-scale
wants to merge
26
commits into
main
Choose a base branch
from
jerome/scheduled-agents
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,769
−3,448
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
acab2be
feat(schedules): add agent run schedules (v1)
jromualdez-scale 41f8d65
feat(schedules): label scheduled tasks for the UI
jromualdez-scale ec74e5d
docs(schedules): remove internal tracker/design-doc references from c…
jromualdez-scale 9a10531
feat(schedules): address review — idempotency, list perf, update + tr…
jromualdez-scale 6f779eb
feat(schedules): feature-flag the run schedules API (ENABLE_AGENT_RUN…
jromualdez-scale e93b92f
Merge branch 'main' into jerome/scheduled-agents
jromualdez-scale 6bb976a
feat(schedules): enforce text input, drop unused initial_input_method…
jromualdez-scale 0a1fd2b
docs(schedules): clarify temporal fire workflow ids
jromualdez-scale 4859906
feat(schedules): stamp manual trigger type on runs
jromualdez-scale 941f1ea
fix(schedules): include trigger time in manual run ids
jromualdez-scale 37795b4
feat(schedules): persist run fire time metadata
jromualdez-scale ebc3181
fix(schedules): let manual triggers fire paused schedules
jromualdez-scale d7e6bc8
feat(schedules): emit metrics for Temporal schedule operations
jromualdez-scale 279e7e8
feat(schedules): soft-delete run schedule rows for audit
jromualdez-scale 239961a
docs(schedules): document at-least-once scheduled delivery
jromualdez-scale 2181e77
feat(schedules): add version column reserved for optimistic concurrency
jromualdez-scale 6529c7e
test(schedules): assert soft-delete tombstones the row
jromualdez-scale a52f9fd
fix(schedules): apply list authorization filter before the limit
jromualdez-scale ad16681
Merge branch 'main' into jerome/scheduled-agents
jromualdez-scale ffe060f
docs(schedules): note planned move to id-as-handle identity
jromualdez-scale c051deb
fix(schedules): enforce exactly-one cadence on create/update requests
jromualdez-scale b9bd997
refactor(schedules): drop now-redundant use-case cadence checks
jromualdez-scale a00146a
fix(schedules): skip launch for soft-deleted schedules
jromualdez-scale febeba4
fix(schedules): use strict bool parser for ENABLE_AGENT_RUN_SCHEDULES
jromualdez-scale 24c7fcf
test(schedules): cover run schedule route authz
jromualdez-scale e6ea64b
fix(temporal): pass workflow args via args= in start_workflow
jromualdez-scale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
...abase/migrations/alembic/versions/2026_06_22_1200_add_agent_run_schedules_3b1c9d2e4f6a.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| """add agent_run_schedules | ||
|
|
||
| Revision ID: 3b1c9d2e4f6a | ||
| Revises: c7a1b2d3e4f5 | ||
| Create Date: 2026-06-22 12:00:00.000000 | ||
|
|
||
| Creates the agent_run_schedules table backing the scheduled-agent-runs feature. | ||
| Schema-only and idempotent: the table and its indexes are created | ||
| with IF NOT EXISTS-style guards (Alembic create_table on a fresh table), and the | ||
| indexes target the just-created table so they are non-blocking by construction. | ||
| """ | ||
|
|
||
| from collections.abc import Sequence | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "3b1c9d2e4f6a" | ||
| down_revision: str | None = "c7a1b2d3e4f5" | ||
| branch_labels: str | Sequence[str] | None = None | ||
| depends_on: str | Sequence[str] | None = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| op.create_table( | ||
| "agent_run_schedules", | ||
| sa.Column("id", sa.String(), nullable=False), | ||
| sa.Column("agent_id", sa.String(length=64), nullable=False), | ||
| sa.Column("name", sa.String(length=256), nullable=False), | ||
| sa.Column("description", sa.Text(), nullable=True), | ||
| sa.Column("cron_expression", sa.String(), nullable=True), | ||
| sa.Column("interval_seconds", sa.Integer(), nullable=True), | ||
| sa.Column("timezone", sa.String(), server_default="UTC", nullable=False), | ||
| sa.Column("start_at", sa.DateTime(timezone=True), nullable=True), | ||
| sa.Column("end_at", sa.DateTime(timezone=True), nullable=True), | ||
| sa.Column("paused", sa.Boolean(), server_default="false", nullable=False), | ||
| sa.Column("creator_principal", sa.JSON(), nullable=False), | ||
| sa.Column("task_params", sa.JSON(), nullable=True), | ||
| sa.Column("task_metadata", sa.JSON(), nullable=True), | ||
| sa.Column("initial_input", sa.JSON(), nullable=False), | ||
| sa.Column( | ||
| "created_at", | ||
| sa.DateTime(timezone=True), | ||
| server_default=sa.text("now()"), | ||
| nullable=True, | ||
| ), | ||
| sa.Column( | ||
| "updated_at", | ||
| sa.DateTime(timezone=True), | ||
| server_default=sa.text("now()"), | ||
| nullable=True, | ||
| ), | ||
| # Soft-delete marker: NULL = active, set = tombstoned for audit. Deleted | ||
| # rows keep occupying their (agent_id, name) so names are not reusable. | ||
| sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True), | ||
| # Monotonic record version reserved for future optimistic concurrency / | ||
| # change history. Added now (brand-new table) to avoid a later backfill; | ||
| # not enforced yet. | ||
| sa.Column("version", sa.Integer(), nullable=False, server_default="1"), | ||
| sa.ForeignKeyConstraint(["agent_id"], ["agents.id"]), | ||
| sa.PrimaryKeyConstraint("id"), | ||
| ) | ||
| # Indexes target the table created in this same migration, so they hold no | ||
| # write-blocking lock against live traffic (the table has no rows yet). | ||
| op.create_index( | ||
| "uq_agent_run_schedules_agent_name", | ||
| "agent_run_schedules", | ||
| ["agent_id", "name"], | ||
| unique=True, | ||
| ) | ||
| op.create_index( | ||
| "idx_agent_run_schedules_agent", | ||
| "agent_run_schedules", | ||
| ["agent_id"], | ||
| unique=False, | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| op.drop_index("idx_agent_run_schedules_agent", table_name="agent_run_schedules") | ||
| op.drop_index("uq_agent_run_schedules_agent_name", table_name="agent_run_schedules") | ||
| op.drop_table("agent_run_schedules") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.