Skip to main content

Parameterized Runs

In production, it is common for the same DAG code to be run on different days, or to call an external service (for example, an LLM for data enrichment). Bauplan supports these scenarios with parameters and secrets.

You can define a parameter using the CLI either as a simple value or by loading from a file.

bauplan parameter set prompt_summary "Write a concise, incisive summary of the news article." --description "Prompt passed to GPT for article summarization"
note

For other commands related to parameters, see the reference.

Each parameter is defined in bauplan_project.yml with a type and a default value.

parameters:
interest_rate:
default: 3.5
type: float
loan_amount:
default: 200000
type: int

Parameters can be:

  • Strings (str)
  • Numbers (int, float)
  • Booleans (bool)
  • Secrets (a special, encrypted type of parameter used for API keys or credentials)

Parameters

Parameters let you pass runtime values to models without changing code. They can be accessed in a variety of ways.

Parameters can be passed as variables to your model code:

@bauplan.model()
@bauplan.python('3.11')
def loan_model(
interest_rate=bauplan.Parameter('interest_rate'), # passing parameters as variables
loan_amount=bauplan.Parameter('loan_amount'),
loan_term_years=bauplan.Parameter('loan_term_years'),
):
...
note

To learn more, see reference.

Defaults can be overridden at runtime:

bauplan run --param interest_rate=4.5 --param loan_amount=500000

Secrets

Secrets are encrypted parameters for sensitive values like API keys, database credentials, or tokens. They are encrypted, versioned, and injected into your pipeline code at runtime, avoiding hardcoding.

Use the CLI with --type secret to create one:

bauplan parameter set openai_api_key sk-abc123... --type secret

Bauplan encrypts the value via AWS KMS and stores only the ciphertext in your bauplan_project.yml. Secrets are never stored or transmitted in plaintext.

In your code, reference secrets with bauplan.Parameter just like regular parameters.

For a complete walkthrough using secrets with an LLM pipeline, see the Using LLMs with Secrets example.