MixtrainDocs

Secrets store encrypted credentials like API keys and passwords. They're scoped to workspaces and accessible in workflows via environment variables.

Quick Start

# Set a secret
mixtrain secret set openai_key -d "OpenAI API key"

# List secrets
mixtrain secret list

Key Concepts

Creating Secrets

Via CLI (recommended):

mixtrain secret set api_key "sk-abc123" --description "API key"

# Interactive (prompts for value)
mixtrain secret set db_password -d "Database password"

Via SDK:

from mixtrain import MixClient

client = MixClient()
api_key = client.get_secret("openai_api_key")

Using Secrets in Workflows

Access secrets within MixFlow:

from mixtrain import MixFlow

class MyWorkflow(MixFlow):
    def run(self):
        api_key = self.mix.get_secret("openai_key")
        db_password = self.mix.get_secret("db_password")
        # Use the secrets...

Listing Secrets

mixtrain secret list

Output:

| Name          | Description         | Created    |
|---------------|---------------------|------------|
| openai_key    | OpenAI API key      | 2024-01-15 |
| anthropic_key | Anthropic API key   | 2024-01-15 |

Security Notes

  • Secrets are encrypted at rest
  • Scoped to the workspace they're created in
  • Only accessible to workspace members

Next Steps

On this page