Skip to main content

Using Secrets in Julep

This guide will walk you through the process of creating, managing, and using secrets in your Julep applications. Secrets provide a secure way to store and use sensitive information like API keys, credentials, and tokens without exposing them in your code or configuration files.

Creating Secrets

You can create secrets using the Julep CLI, SDKs, or directly through the API.

Using the CLI

Using the Python SDK

Using the Node.js SDK

Using the REST API

You can also create secrets directly using the REST API:

Using Secrets in Tasks

Once you’ve created secrets, you can reference them in your tasks using the secret_name field or the secrets object.

Direct Secret Reference

For tools that require a single API key or token:

Multiple Secrets

For tools that require multiple secrets:

Using Secrets in Expressions

You can reference secrets in expressions using the secrets object:
For template variables in prompts:

Managing Secrets

Updating Secrets

To update an existing secret:

Adding Metadata

You can add metadata to organize and categorize your secrets:
This metadata can be used for filtering when listing secrets:

Deleting Secrets

When a secret is no longer needed:

Common Use Cases

Securing LLM API Keys

Julep can automatically use developer secrets for LLM API keys based on the provider:

External API Integration

For tools that call external APIs:

Database Connections

For database operations:

Best Practices

  1. Never commit secrets to version control
  2. Use descriptive names for your secrets
  3. Add metadata to organize your secrets
  4. Rotate secrets regularly
  5. Use the minimum necessary permissions
  6. Delete unused secrets promptly
  7. Use secret references instead of hardcoding values

Next Steps