What happens during a run
Depending on the deployment type and inputs, a run can include these steps:- Load config: For models, reads
config.yamlfrom the Truss directory and extractsmodel_metadata.example_model_inputfor the predict step. Thepredict-payloadinput overrides that value. For Chains, detects the entrypoint class from the.pyfile. - Deploy: Pushes the model or Chain to Baseten. For a model, the action streams build logs into the GitHub Actions output. For a Chain, it prints deployment status changes and chainlet log URLs. For models, the action also names each deployment from git context:
PR-42_abc1234for pull requests orabc1234for direct pushes. Override the generated name withdeployment-name. - Predict: If the action resolves a payload that it doesn’t skip, sends a predict request and reports latency. For streaming models when the payload includes
"stream": true, it reports time-to-first-byte, token count, and tokens per second. - Cleanup: If
cleanup: true, deactivates the newly created deployment. Setcleanup: falsewhen a model workflow deploys to an environment or when you want to inspect a deployment manually.
Prerequisites
Store your Baseten API key as an encrypted secret namedBASETEN_API_KEY in your repository or organization settings. See API keys for how to generate one.
Deploy with the Baseten CLI
The GitHub Action wraps deploy, predict validation, and cleanup in one step. If you only need to deploy, run the Baseten CLI directly in your workflow. The CLI reads your API key from theBASETEN_API_KEY environment variable, and --wait blocks the step until the deployment is active so a failed deploy fails the job:
.github/workflows/deploy.yml
model push. To add predict validation and cleanup to a CLI-based flow, see Validate on pull request for the Action-based equivalent.
Deploy to an environment on merge
Deploy a validated model to a specific environment every time code merges tomain.
Create .github/workflows/deploy.yml and add the following:
.github/workflows/deploy.yml
environment publishes the model deployment to the specified environment. Setting cleanup: false keeps the deployment active so it can serve traffic.
For a model deployed to a regional environment, add regional-environment: true to the action’s with block. The action then sends its predict validation request through the regional endpoint.
Validate on pull request
Catch model regressions before they reach production. The action deploys, runs a predict request, and tears down the deployment inside the PR check. Create.github/workflows/validate-model.yml and add the following:
.github/workflows/validate-model.yml
model_metadata.example_model_input from your config.yaml to build the predict request. With the default (cleanup: true), the deployment is deactivated after validation, so no resources are left running.
Deploy a Chain
Deploy a Baseten Chain from a Python source file. The action auto-detects Chains whentruss-directory points to a .py file:
predict-payload because there’s no config.yaml to read example input from.
Deploy multiple models
Use a matrix strategy to deploy each model in your repository as a separate job. Create.github/workflows/deploy-all.yml and add the following:
.github/workflows/deploy-all.yml
Custom predict validation
Override the default predict payload when your model needs a specific input shape that differs frommodel_metadata.example_model_input:
null, false, 0, an empty string (""), an empty object ({}), or an empty array ([]). A skipped predict step doesn’t validate the deployment.
Deploy with labels
Attach metadata labels to track model deployments in your CI pipeline:Override model name
Set a custom model name instead of using the name fromconfig.yaml:
Use action outputs
The action exposes outputs you can reference in downstream steps. This example posts the deploy time as a PR comment:Troubleshooting
deploy_timeout
The default timeout is 45 minutes, which accommodates large builds like TRT-LLM. For smaller models, reduce deploy-timeout-minutes to fail faster. If your model needs more time, increase the value.
deploy_failed
Verify the BASETEN_API_KEY secret first. For a model, check config.yaml and expand the build output in the GitHub Actions UI. For a Chain, check the source file and follow the chainlet log URLs in the deploy output.
predict_failed
Verify the predict payload shape matches what your model expects. Check model_metadata.example_model_input in config.yaml, or override it with predict-payload. For Chains, provide the predict payload explicitly.
cleanup_failed
The deployment may still be running. Deactivate it manually from the Baseten dashboard.
429 too many requests
The action calls Management API endpoints that are rate limited per API key. Matrix jobs that fan out across many models can exceed the per-endpoint limits. See Management API rate limits for thresholds and backoff guidance.No predict output
The action skips prediction when the resolved JSON value is missing,null, false, 0, an empty string (""), an empty object ({}), or an empty array ([]). For a model, add an example input to config.yaml that isn’t one of these values. For a Chain, set predict-payload to a value that the action doesn’t skip.
Team selection required but running in a non-interactive context
For a model workflow, your API key has access to multiple teams and Truss can’t infer a single target team without a prompt. Pass the team explicitly with the team input on the action. If you invoke truss push directly, use --team <name>.
0.18.3 or later.
The team input in action-truss-push@v0.1.2 applies to models only. For a Chain workflow, use an API key that resolves to the intended team without an interactive selection.
Next steps
Rolling deployments
Promote validated deployments to production without downtime.
Environments
Manage staging and production environments for your models.
Manage deployments
Scale, promote, and clean up deployments from the Baseten CLI or Management API.