Secrets
Secrets are environment variables injected into your agent at runtime.Why Secrets?
Your agents often need access to:- API keys (OpenAI, Stripe, etc.)
- Database credentials
- Service tokens
- Configuration values
- Hardcoding in source code
- Committing to git
- Exposing in logs
Setting Secrets
Via CLI
Via SDK
Interactive Mode
Avoid exposing secrets in shell history:Using Secrets in Agents
Secrets are available as environment variables:Built-in Secrets
Castari automatically provides:| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | Your Anthropic API key for Claude |
Secret Storage
Secrets are:- Encrypted at rest — Using AES-256
- Never logged — Values are masked in logs
- Never returned — API only returns key names, not values
- Scoped per agent — Each agent has its own secrets
Listing Secrets
Values are never displayed — only keys and metadata.
Updating Secrets
Set the same key again to update:Deleting Secrets
Best Practices
Naming Conventions
- Use
UPPERCASE_WITH_UNDERSCORES - Be descriptive:
STRIPE_SECRET_KEYnotKEY1 - Prefix by service:
OPENAI_API_KEY,STRIPE_API_KEY
Security
- Never commit secrets — Use
.gitignorefor.envfiles - Rotate regularly — Update secrets periodically
- Limit scope — Only set secrets an agent actually needs
- Audit access — Review who can manage secrets
Development
Keep a.env.example file in your repo:
Secrets in CI/CD
Example GitHub Actions workflow:See Also
cast secrets
CLI reference
Secrets API
SDK reference