Reference Documentation
Detailed guides for advanced configuration, security, and supported workloads.
Looking to set up DagTab?
The Settings page has the complete guided setup — connect your GCP project, generate an API key, and install the agent all in one place.
Quickstart Installation
Install our zero-code agent into your Airflow environment and configure your API key. The agent automatically hooks into Airflow task completion callbacks to track and attribute BigQuery execution costs without modifying your DAG code.
1. Install package in your Airflow environment:
pip install explainio-airflow-agent
2. Set your API key environment variable:
export EXPLAIN_IO_API_KEY="your-api-key"
Note: The PyPI package (explainio-airflow-agent) and EXPLAIN_IO_API_KEY environment variable retain their legacy names for backward compatibility with existing deployments.
Security & Privacy
DagTab only extracts execution metadata (bytes billed, slot usage) to calculate cost. We never read your actual query results, table contents, or sensitive business data. By using Service Account Impersonation with Dedicated Per-Tenant Principals, you never have to share private JSON keys with our platform. Each customer is assigned a unique, isolated service account principal, ensuring strict tenant isolation and preventing unauthorized cross-tenant access.
Supported Workloads
Native Airflow Operators
Operators like BigQueryInsertJobOperator work instantly out-of-the-box. DagTab automatically captures the job ID and attributes the cost with zero configuration required.
dbt-core (BashOperator, Cosmos)
Because dbt runs externally and does not natively report BigQuery job IDs back to Airflow, DagTab requires you to configure dbt to pass context labels to BigQuery to guarantee 100% accurate cost attribution.
Configure dbt query-comment
Inject the Airflow context variables into your BigQuery jobs via your dbt_project.yml:
# dbt_project.yml
query-comment:
job-label: true
comment: |
{
"airflow_dag_id": "{{ env_var('AIRFLOW_CTX_DAG_ID', '') | lower }}",
"airflow_task_id": "{{ env_var('AIRFLOW_CTX_TASK_ID', '') | lower }}",
"node_id": "{{ node.unique_id if node else '' }}"
}By doing this, dbt automatically creates JSON query comments which the dbt-bigquery adapter converts into BigQuery Job Labels. This approach is strongly recommended because BigQuery enforces a strict 63-character limit and character restrictions (lowercase, numbers, underscores, dashes) which dbt-bigquery automatically sanitizes. DagTab perfectly isolates the costs to the correct DAG and task using these labels!
Note for KubernetesPodOperator / GKEStartPodOperator / DockerOperator:
Airflow does not automatically propagate environment variables into external containers. Pass them via env_vars (Kubernetes/GKE) or environment (DockerOperator):
# KubernetesPodOperator / GKEStartPodOperator
env_vars={
"AIRFLOW_CTX_DAG_ID": "{{ dag.dag_id }}",
"AIRFLOW_CTX_TASK_ID": "{{ task.task_id }}",
}
# DockerOperator
environment={
"AIRFLOW_CTX_DAG_ID": "{{ dag.dag_id }}",
"AIRFLOW_CTX_TASK_ID": "{{ task.task_id }}",
}