Skip to main content

Overview

Constants integrates with GitHub to turn your existing scripts into governed Tools:
  • Import scripts directly from repositories
  • Pin to SHA for reproducible execution
  • Track provenance — know exactly what code is running
  • Update versions when the source changes

Connecting GitHub

Step 1: Open GitHub Settings

  1. Click your profile icon in the sidebar
  2. Look for the GitHub section in the menu
  3. Click Connect GitHub

Step 2: Authorize Constants

You’ll be redirected to GitHub to authorize the Constants application. We request:
  • Read access to your repositories (for importing scripts)
  • Read access to your profile information
You can revoke access at any time from your GitHub Settings → Applications → Authorized OAuth Apps.

Step 3: Confirm Connection

Once authorized, you’ll see your GitHub username displayed in the sidebar menu. You’re now ready to import from GitHub!

Importing a Script

From the Composer

  1. Click Create new Tool
  2. Click the GitHub button or paste a URL directly
  3. Enter the repository URL:
https://github.com/your-org/your-repo/blob/main/scripts/process_data.py
  1. Constants will:
    • Parse the URL
    • Fetch the repository contents
    • Analyze the script structure

URL Formats Supported

Point to a specific script file:
https://github.com/owner/repo/blob/main/script.py

Version Pinning

When you import from GitHub, your Tool is pinned to a specific SHA:

Why Pin to SHA?

  • Reproducibility: The same code runs every time
  • Auditability: Clear record of what version executed
  • Stability: Repository changes don’t break your Tool
  • Compliance: Provenance tracking for regulated environments

Updating Versions

When you want to update to a newer version:
  1. Open your Tool settings
  2. Click Update Version
  3. Select the new branch/SHA
  4. Review any spec changes
  5. Confirm the update
Updating versions may change the Tool’s behavior. Review the diff carefully before confirming.

Private Repositories

To import from private repositories:
  1. Ensure you’ve connected your GitHub account
  2. Grant Constants access to the specific repository
  3. Import using the same URL format
Constants uses your OAuth token to access private repos — credentials are never stored in the Tool itself.

What Gets Imported

When you import a script, Constants:

Analyzes the Code

  • Detects the programming language
  • Identifies the main entrypoint
  • Parses function signatures and CLI arguments
  • Extracts docstrings and comments

Generates the Spec

  • Input schema from function parameters or CLI args
  • Output schema from return types or file outputs
  • Dependencies from requirements.txt, package.json, etc.

Sets Up the Runtime

  • Installs required dependencies
  • Configures the execution environment
  • Sets default resource limits

Branch Selection

After entering a repository URL:
  1. Constants fetches available branches
  2. Select your target branch from the dropdown
  3. The Tool will be pinned to the latest SHA on that branch
For production Tools, pin to a release tag or specific SHA rather than a moving branch like main.

Troubleshooting

Make sure you’ve:
  1. Connected your GitHub account
  2. Granted access to the repository (for private repos)
  3. Have at least read permission on the repository
If Constants can’t find the entrypoint:
  • Ensure the file has a recognized extension (.py, .js, etc.)
  • Add a clear if __name__ == "__main__" block for Python
  • Use a descriptive filename (e.g., main.py, run.py)
Ensure your repo includes:
  • requirements.txt for Python
  • package.json for JavaScript/TypeScript
  • Or specify dependencies manually in the Tool settings
If a branch doesn’t appear:
  • Check that it exists on the remote
  • Ensure you have access to view the branch
  • Try refreshing the branch list

Best Practices

Use Clear Entrypoints

Scripts with obvious entry points (main.py, index.js) are easier to import and result in better specs.

Include Dependencies

Always include a requirements.txt or package.json so Constants can set up the environment correctly.

Add Documentation

Docstrings and comments help Constants generate better input/output descriptions.

Pin to Tags

For production Tools, pin to release tags rather than branch heads for stability.

Workflow Recommendation

For teams using Constants with GitHub:
  1. Develop scripts in your repository as usual
  2. Test locally until the script works
  3. Import into Constants to create the Tool
  4. Pin to the tested SHA
  5. Share with team members who can run without setup
  6. Update the Tool version when you release changes
This keeps your source of truth in Git while making execution accessible to everyone.