Text of github.github.com › gh-aw › reference › cost-management as Styx crawled it on Nov 18, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Cost Management | GitHub Agentic Workflows

Skip to main content Cost Management If a task can be solved using deterministic tools, use deterministic tools. Only use agents when necessary, as they incur higher cost. Agentic workflows allow you to run deterministic tools first and gate agent execution using conditions, enabling workflows that avoid triggering agents most of the time and only use them when needed. The cost of running an agentic workflow is the sum of two components: GitHub Actions minutes consumed by the workflow jobs, and inference costs charged by the AI provider for each agent run.

For an overview of how billing works across providers and Copilot licensing, see Billing . AI Credits (AIC) Section titled “AI Credits (AIC)” AI Credits (AIC) are the primary metric for monitoring and budgeting inference costs in gh-aw. One AIC equals $0.01 USD. AWF manages the model pricing catalog and reports inference costs used by gh aw logs , gh aw audit , and run footer messages. AIC is shown in the gh aw logs output table under the AIC column, in audit reports alongside raw token counts, and as {ai_credits_suffix} in workflow footer templates.

For structured output, each run under .runs[] includes an aic field and each episode under .episodes[] includes total_aic . gh-aw does not bundle or refresh a model pricing catalog, and compilation does not inject catalog rates into the firewall configuration. Explicit frontmatter models.providers pricing overrides are still passed to AWF. Cost Components Section titled “Cost Components” A typical run includes a short pre-activation job (10–30 seconds) and an agent job (1–15 minutes), each with ~1.5 minutes of runner setup overhead billed at standard GitHub Actions pricing .

Inference is charged by the AI provider based on the engine and API token type used. Monitoring Costs with gh aw logs Section titled “Monitoring Costs with gh aw logs” For routed runs, the Model Routing summary separates classifier AIC from selected-model and deviated-traffic cost in each run. Cross-run --format pretty|markdown and --json output groups task labels and mode by selected model, effort, and router version, with run counts and total/average AIC.

Use the selected route to compare the cost of different classification outcomes; classifier cost is routing overhead, while deviated traffic can include sub-agents or overrides. The gh aw logs command surfaces per-run metrics — elapsed duration, token usage, AIC (AI Credits), and turn count — before you decide what to optimize. Use gh aw audit <run-id> to deep-dive into a single run’s token usage, tool calls, and inference spend; its Metrics and Performance Metrics sections cover token counts, AIC, turn counts, and estimated cost in one place.

For cost trends across multiple runs, use gh aw logs --format markdown [workflow] to generate a cross-run report with anomaly detection. View recent run durations Section titled “View recent run durations” Terminal window # Overview table for all agentic workflows (last 10 runs) gh aw logs # Narrow to a single workflow gh aw logs issue-triage-agent # Last 30 days for Copilot workflows gh aw logs --engine copilot --start-date -30d The overview table includes a Duration column showing elapsed wall-clock time per run.

Because GitHub Actions bills compute time by the minute (rounded up per job), duration is the primary indicator of Actions spend. Export metrics as JSON Section titled “Export metrics as JSON” Use --json to get structured output suitable for scripting or trend analysis: Terminal window # Write JSON to a file for further processing gh aw logs --start-date -1w --json > /tmp/logs.json # List per-run duration, tokens, and AIC across all workflows gh aw logs --start-date -30d --json | \ jq ' .runs[] | {workflow: .workflow_name, duration: .duration, tokens: .token_usage, aic: .aic} ' # AIC spend grouped by workflow over the past 30 days gh aw logs --start-date -30d --json | \ jq ' [.runs[]] | group_by(.workflow_name) | map({workflow: .[0].workflow_name, runs: length, total_aic: (map(.aic // 0) | add)}) ' Each run under .runs[] includes duration , token_usage , aic , workflow_name , and agent .

For orchestrated workflows, the same JSON includes deterministic lineage under .episodes[] and .edges[] — see the next section. Interpret Episode-Level Usage Section titled “Interpret Episode-Level Usage” gh aw logs --json emits three views of the same data: .runs[] for individual workflow runs, .episodes[] for runs sharing a recorded canonical identity, and .edges[] for recorded parent-child lineage between selected runs in the same episode.

Use .runs[] to find which run was resource-heavy and .episodes[] to measure usage across the selected members of a logical execution. Episode grouping requires a nonempty propagated context.episode_id and preserves that ID, matching OpenTelemetry correlation even when intermediate runs are absent. Runs without canonical identity remain in .runs[] and overall summary totals, but do not contribute to .episodes[] , episode counts, or edges.

Call IDs, matching revision/actor metadata, and workflow_run events do not reconstruct episodes. Totals cover only selected members with recorded canonical identity; high confidence indicates lineage evidence, not complete episode coverage. Edges require both runs to share the same canonical ID and connect distinct GitHub run IDs, so reusable workflow hops sharing one run do not produce separate run edges. Conflicting canonical identities never merge, and uncorrelated runs never bridge episodes.

Input ordering does not change episode membership or totals. Episode root and coverage fields distinguish recorded identity from the selected data: Field Meaning recorded_roots[] Distinct root claims from context: string run_id , full workflow_id , and repository when recorded, including claims without a run ID. observed is true only when that root run is selected in this episode without a known repository mismatch. Conflicting claims and original repository spelling are preserved; repository identity comparison ignores case. representative_run_id , representative_workflow Selected-data representative, preferring the earliest timestamped run, then the lowest run ID when timestamps are absent or tied.

An available workflow name is used when the representative has none. These fields do not identify a missing canonical root. coverage.scope Always selected_runs ; totals exclude unselected ancestors and descendants. coverage.status partial when recorded evidence has gaps, contradictions, invalid run IDs, or collection truncation; otherwise unknown . Logs do not establish episode completeness, even when every recorded parent and root is selected. coverage.reasons Machine-readable codes: missing_recorded_root , missing_recorded_parent , unverified_root_lineage , unverified_parent_lineage , conflicting_recorded_roots , conflicting_root_lineage , conflicting_parent_lineage , invalid_recorded_root_run_id , invalid_recorded_parent_run_id , and collection_truncated .

Unverified lineage means the referenced run is selected but has no canonical episode identity. coverage.missing_parent_run_ids Sorted, unique recorded caller run IDs absent from the selection. Same-run reusable hops are not missing run-level parents. coverage.collection_truncated True when collection truncation applies to this episode’s selected repository/workflow target, or a reached count limit cannot be scoped more precisely.

A scoped continuation does not downgrade unrelated targets. This is not proof that this particular episode has additional members; false does not establish completeness. Missing root fields remain unknown; the CLI does not infer a canonical root from a descendant or parse one from an episode ID. Root presence is run-level evidence, not proof that every reusable workflow hop or artifact was collected. Both compact and verbose JSON retain all canonical episode and edge details, including single-run episodes. total_dura

The rest of this page is on the live site.