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
- Click your profile icon in the sidebar
- Look for the GitHub section in the menu
- 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
- Click Create new Tool
- Click the GitHub button or paste a URL directly
- Enter the repository URL:
- Constants will:
- Parse the URL
- Fetch the repository contents
- Analyze the script structure
URL Formats Supported
- File URL
- Directory URL
- Repository URL
Point to a specific script file:
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:- Open your Tool settings
- Click Update Version
- Select the new branch/SHA
- Review any spec changes
- Confirm the update
Private Repositories
To import from private repositories:- Ensure you’ve connected your GitHub account
- Grant Constants access to the specific repository
- Import using the same URL format
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:- Constants fetches available branches
- Select your target branch from the dropdown
- The Tool will be pinned to the latest SHA on that branch
Troubleshooting
Can't access repository
Can't access repository
Make sure you’ve:
- Connected your GitHub account
- Granted access to the repository (for private repos)
- Have at least read permission on the repository
Script not detected
Script not detected
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)
Dependencies not found
Dependencies not found
Ensure your repo includes:
requirements.txtfor Pythonpackage.jsonfor JavaScript/TypeScript- Or specify dependencies manually in the Tool settings
Branch not showing
Branch not showing
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:- Develop scripts in your repository as usual
- Test locally until the script works
- Import into Constants to create the Tool
- Pin to the tested SHA
- Share with team members who can run without setup
- Update the Tool version when you release changes
