From 56fbbe5f393e812d5ccaeeebf48abbacdbb95d50 Mon Sep 17 00:00:00 2001 From: FAQ Bot Date: Fri, 3 Jul 2026 20:27:58 +0000 Subject: [PATCH 1/2] NEW: Why is token usage monitored in Kestra workflows? --- ...5_a4adc70f41_token-usage-kestra-workflows.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 _questions/llm-zoomcamp/module-3/005_a4adc70f41_token-usage-kestra-workflows.md diff --git a/_questions/llm-zoomcamp/module-3/005_a4adc70f41_token-usage-kestra-workflows.md b/_questions/llm-zoomcamp/module-3/005_a4adc70f41_token-usage-kestra-workflows.md new file mode 100644 index 00000000..4a66c042 --- /dev/null +++ b/_questions/llm-zoomcamp/module-3/005_a4adc70f41_token-usage-kestra-workflows.md @@ -0,0 +1,17 @@ +--- +id: a4adc70f41 +question: Why is token usage monitored in Kestra workflows? +sort_order: 5 +--- + +Token usage monitoring in Kestra workflows helps you understand and control the cost and efficiency of LLM-based tasks run in production. The main reasons are: + +- Cost awareness: token usage is directly tied to costs charged by LLM providers. Tracking usage lets you budget, forecast, and detect cost anomalies early. +- Prompt optimization and lean outputs: by measuring how many tokens are consumed for prompts and generated outputs, you can iteratively improve prompts to be more concise and reduce unnecessary output without sacrificing quality. +- Production guardrails: monitoring usage enables setting thresholds and alerts if token consumption spikes, helping prevent runaway costs in long-running or looping flows. + +How to apply: + +- Instrument each LLM call in Kestra tasks to capture usage metrics from the provider's response, such as input_tokens, prompt_tokens, and total_tokens. +- Aggregate these metrics per run and per flow, and push them to your monitoring or observability stack (logs, metrics, dashboards). +- Review token budgets and flow designs regularly to identify optimization opportunities and enforce cost controls. \ No newline at end of file From aad0e314797a6088a963ce7aea69cc9cadd44fd1 Mon Sep 17 00:00:00 2001 From: Alexey Grigorev Date: Thu, 9 Jul 2026 18:15:50 +0200 Subject: [PATCH 2/2] Rename to 009_ (fix sort/prefix collision) and tighten content --- ...5_a4adc70f41_token-usage-kestra-workflows.md | 17 ----------------- ...9_a4adc70f41_token-usage-kestra-workflows.md | 13 +++++++++++++ 2 files changed, 13 insertions(+), 17 deletions(-) delete mode 100644 _questions/llm-zoomcamp/module-3/005_a4adc70f41_token-usage-kestra-workflows.md create mode 100644 _questions/llm-zoomcamp/module-3/009_a4adc70f41_token-usage-kestra-workflows.md diff --git a/_questions/llm-zoomcamp/module-3/005_a4adc70f41_token-usage-kestra-workflows.md b/_questions/llm-zoomcamp/module-3/005_a4adc70f41_token-usage-kestra-workflows.md deleted file mode 100644 index 4a66c042..00000000 --- a/_questions/llm-zoomcamp/module-3/005_a4adc70f41_token-usage-kestra-workflows.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -id: a4adc70f41 -question: Why is token usage monitored in Kestra workflows? -sort_order: 5 ---- - -Token usage monitoring in Kestra workflows helps you understand and control the cost and efficiency of LLM-based tasks run in production. The main reasons are: - -- Cost awareness: token usage is directly tied to costs charged by LLM providers. Tracking usage lets you budget, forecast, and detect cost anomalies early. -- Prompt optimization and lean outputs: by measuring how many tokens are consumed for prompts and generated outputs, you can iteratively improve prompts to be more concise and reduce unnecessary output without sacrificing quality. -- Production guardrails: monitoring usage enables setting thresholds and alerts if token consumption spikes, helping prevent runaway costs in long-running or looping flows. - -How to apply: - -- Instrument each LLM call in Kestra tasks to capture usage metrics from the provider's response, such as input_tokens, prompt_tokens, and total_tokens. -- Aggregate these metrics per run and per flow, and push them to your monitoring or observability stack (logs, metrics, dashboards). -- Review token budgets and flow designs regularly to identify optimization opportunities and enforce cost controls. \ No newline at end of file diff --git a/_questions/llm-zoomcamp/module-3/009_a4adc70f41_token-usage-kestra-workflows.md b/_questions/llm-zoomcamp/module-3/009_a4adc70f41_token-usage-kestra-workflows.md new file mode 100644 index 00000000..a6271ae9 --- /dev/null +++ b/_questions/llm-zoomcamp/module-3/009_a4adc70f41_token-usage-kestra-workflows.md @@ -0,0 +1,13 @@ +--- +id: a4adc70f41 +question: Why is token usage monitored in Kestra workflows? +sort_order: 9 +--- + +Token usage is tracked because it maps directly to what LLM providers charge you for, and Kestra workflows run LLM calls on a schedule or in loops where costs add up fast. The main reasons: + +- **Cost control**: tokens are the unit providers bill by, so tracking usage lets you budget, forecast, and spot cost spikes before they get expensive. +- **Prompt optimization**: seeing how many tokens each prompt and response consumes helps you tighten prompts and trim output without losing quality. +- **Guardrails**: in long-running or looping flows, usage monitoring lets you set thresholds and alerts so a runaway task doesn't quietly rack up a large bill. + +In practice, each AI task in a Kestra flow can capture usage from the provider's response (for example `usage.total_tokens`), and you can surface those numbers in logs, metrics, or dashboards to keep an eye on spend per run.