Skip to content

How Run duration is counted

Understand elapsed time, direct Database operations, and retries.

Applies to
CLIConsoleAPI

Verified · v1.4.16

Markdown

Your daily time allowance resets at midnight UTC. Free accounts get 30 minutes; AGI Lab members get 90 minutes. New Free accounts get 10 minutes during their first 7 days. Wings counts elapsed time from start to finish, not the number of Runs.

Run time

Both successful and failed Runs count toward the daily allowance. Calling another Handler also uses time for the child Run. A timed-out Run counts up to its deadline.

A Run ends at the earlier of the plan's time limit and the remaining daily allowance. Scheduled and manual attempts do not count if Wings fails before calling the execution environment. After that call, elapsed time counts even if the Handler's code never starts.

Database time

Database work outside a Run also counts toward the daily allowance. This includes wings db query, wings db exec, and browsing tables in the Console.

An env.db call is already part of its Run's elapsed time. It is not counted twice. There is no separate daily Database time allowance.

When the daily allowance runs out

New Runs and Database operations outside Runs cannot start. They return rate_limited (HTTP 429, scope: duration_day). retryAfterSeconds tells you how many seconds remain until midnight UTC. Time reserved for active Runs also reduces the available allowance. Database calls inside an active Run are not stopped for this reason.

A Schedule retries at midnight only if midnight comes before its next occurrence. Otherwise, that occurrence is skipped with superseded_by_next_occurrence and creates no Run. An already scheduled retry also skips if a newer occurrence has been created. See Schedules.

Waiting for a Database

An account runs one Database operation at a time. If an operation outside a Run waits but never starts, that waiting time is not added as Database usage. Waiting for a Database inside a Run still counts toward that Run’s elapsed time. The Database operation's time is not counted twice.

An operation outside a Run waits up to 9.5 seconds. Inside a Run, it can wait until 0.5 seconds before the Run's deadline.

Temporary Database pauses

An operation taking more than 5 seconds on Free or 10 seconds for members pauses Database operations for 15 minutes. A second pause on a Free account in the same UTC day lasts until midnight.

If the outcome of an operation is unknown, Wings counts 30 seconds. It adjusts that value when the measured time becomes available. Only operations outside a Run add those 30 seconds to the daily allowance. Inside a Run, the Run's own elapsed time is counted. A lost response can leave the next operation waiting for up to 5 minutes.

When Wings finishes an operation with its outcome marked unknown, Database operations are also paused. If a started operation reaches its 5-minute deadline without a result, that alone does not pause Database operations.

If you receive db_time_quota_exceeded, check reason and retryAfterSeconds. busy means an earlier operation has not finished; paused means a temporary pause is in effect. Wait for the indicated time before trying again.

How Run duration is counted | AGI Wings Documentation