Inference Logoinference.sh

Environment Variables

Store encrypted API keys and credentials.


Overview

Environment secrets are encrypted key-value pairs injected into your agent's runtime. Use them for API keys, tokens, and credentials you already have.


Adding a secret

  1. Go to Settings → Secrets
  2. Click Add Secret
  3. Enter a key (e.g., OPENAI_API_KEY) and value
  4. Click Save

Your agents can now access it via environment variables:

python
1import os2api_key = os.environ["OPENAI_API_KEY"]

Security

FeatureBenefit
Encrypted at restAES-256-GCM encryption
Never loggedNot exposed in task outputs or logs
Team scopedOther teams cannot access your secrets
Runtime onlyInjected only when apps run, not stored in code
Selective injectionOnly apps that declare the secret receive it

Using in apps

Apps declare which secrets they need:

yaml
1requirements:2  secrets:3    - key: OPENAI_API_KEY4      description: For GPT-4 API calls5    6    - key: DATABASE_URL7      description: PostgreSQL connection string8      optional: true

Required secrets must be set before the app can run.

Optional secrets won't block execution if missing.


Best practices

Use descriptive names

code
1 OPENAI_API_KEY2 STRIPE_SECRET_KEY3 AWS_ACCESS_KEY_ID4 5 KEY16 TOKEN7 SECRET

Don't commit secrets

Never put secrets in:

  • Version control
  • App code
  • Configuration files

Use the Secrets UI instead.

Rotate regularly

  1. Generate a new key in the external service
  2. Update the secret in Settings
  3. Revoke the old key

No app changes needed.

Use separate keys per environment

If you have staging and production:

  • Use different API keys for each
  • Set different secrets per team/environment

Common secrets

SecretServiceDescription
OPENAI_API_KEYOpenAIGPT-4, DALL-E, Whisper
ANTHROPIC_API_KEYAnthropicClaude models
REPLICATE_API_TOKENReplicateML model hosting
HUGGINGFACE_TOKENHugging FaceModel downloads
AWS_ACCESS_KEY_IDAWSS3, Lambda, etc.
AWS_SECRET_ACCESS_KEYAWS(paired with above)
STRIPE_SECRET_KEYStripePayment processing
SENDGRID_API_KEYSendGridEmail delivery
TWILIO_AUTH_TOKENTwilioSMS, voice

Secrets vs Integrations

FeatureSecretsIntegrations
SetupYou provide the keyOAuth flow or service account
ManagementManual rotationAuto token refresh
Best forAPIs with static keysOAuth services (Google, X.com)
ExamplesOpenAI, Stripe, AWSGmail, Google Sheets, Twitter

Use secrets when you have an API key.

Use integrations for OAuth services where we handle token management.


Troubleshooting

"Secret not found"

  • Check the exact key name (case-sensitive)
  • Verify the secret is set in Settings → Secrets
  • Make sure the app declares the secret in requirements

"Permission denied"

  • Secrets are team-scoped — you need access to the team
  • Check you're logged into the correct team

App not receiving secret

  • The app must declare the secret in requirements.secrets
  • Only declared secrets are injected for security

Next

Integrations Overview

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.