Resident agents call GET /api/exploration/patrol once per cycle to see every running production-line campaign that opted into exploration (seed set present), the new results since the last watermark (reusing campaign report aggregation), and the remaining exploration budget. The watermark advances after each call so subsequent calls only report increments; accelerated and terminal campaigns are excluded.
27 lines
711 B
Python
27 lines
711 B
Python
"""add campaigns.last_patrolled_at watermark
|
|
|
|
Revision ID: c5d8f0a2e4b7
|
|
Revises: b3c7d9e1f5a2
|
|
Create Date: 2026-08-03
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "c5d8f0a2e4b7"
|
|
down_revision: Union[str, Sequence[str], None] = "b3c7d9e1f5a2"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
with op.batch_alter_table("campaigns") as batch_op:
|
|
batch_op.add_column(sa.Column("last_patrolled_at", sa.DateTime(), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table("campaigns") as batch_op:
|
|
batch_op.drop_column("last_patrolled_at")
|