Automating batch processing
Use a recurring Schedule to run a Flow or Agent against Records. Runtype resolves the Record target each time the Schedule runs, so a Record Type target includes Records added after you create the Schedule.
Use cases
Use a Schedule for the following workloads:
- Enrich Records that arrive during the day.
- Generate a weekly report from Records.
- Archive or update old Records.
- Refresh cached data from external sources.
Before you begin
Before you begin, create and test the Flow or Agent. Create the Records that it processes. Choose a metadata field, such as processed, to mark completed Records.
Set up batch processing
Follow these steps to create a recurring Schedule that processes Records:
- Open Schedules from the sidebar.
- Click New schedule.
- Select Flow or Agent, then select the Flow or Agent to run.
- Set Input Source to Records.
- In Records, select a Record type. Add filter conditions to limit the Records.
- In Timing, select Recurring.
- Review the time zone shown next to Timing, then configure the recurrence. For example, set a daily run at 2:00 AM.
- Click Create.
Choose a record target
A Schedule resolves its Record target each time it runs. Choose the targeting mode that matches your workload.
Use a Record Type
Use a Record Type to process every Record of that type. Records added to the type enter the target on a later run.
Use Record IDs
Use Record IDs to process a fixed set of Records. The target keeps the configured IDs, so later Records do not enter the target automatically.
To configure this target through the API, pass the IDs in target.recordIds.
Use a Record Filter
Use a Record Filter to process only Records that match conditions on metadata fields. Runtype evaluates the filter each time the Schedule runs, so Records enter or leave scope as their metadata changes. Record Filters use a structured filter language with operators such as eq, contains, gt, withinLastDays, isSet, and isNotSet.
Use the following filter to target customer Records that are not processed:
This filter matches Records of type customers whose processed metadata field equals false.
Mark Records as processed
Write a processed flag after successful processing so the Record Filter excludes the Record on a later run.
Follow these steps to mark each successful Record:
- In your Flow, add Upsert Record after the processing steps.
- Write
processed: trueto the Record metadata. - Configure the Schedule’s Record Filter to exclude Records with
processed: true.
Monitor batch Schedules
Follow these steps to review scheduled runs:
- Open Schedules.
- Click the Schedule row to open its details.
- Select Runs to review recent runs, statuses, and timings.
- Open a run to inspect its results.
Handle failures
If a Record fails before the Flow writes processed: true, the Record remains in the filter’s scope. The next recurring run includes the Record again.
Use these steps to investigate and retry a failed Record:
- Open the failed run from Runs.
- Open Logs and inspect the step errors.
- Fix the Flow or the affected Record.
- Click Run now to retry without waiting for the next recurring run.
Control batch costs
Each Record in a record-based Schedule creates a Flow or Agent execution. Model and tool calls contribute to usage cost. Use these practices:
- Use a Record Filter to process only the Records that you need.
- Choose a cadence that matches how often your data changes.
- Use a lower-cost model for batch work when it meets your quality requirements.
Next steps
Continue with these guides:
- What are Schedules?: review Schedule setup and controls.
- What are Records?: learn how Records store type and metadata.
- What are Logs?: inspect scheduled run errors and details.