Pickaxe Learn

Get Started

Environment Variables

Runtime environment variables injected into actions and MCP servers.


Related In Learn

Actions

Connect your agents to external tools, APIs, and other agents so they can take real actions.

Open Learn

When Pickaxe runs an Action or MCP server, it injects runtime context as environment variables.

Custom Per-User Secrets

You can also inject your own per-user environment variables by calling POST /studio/user/secrets/create.

  • Set identifier to the same end-user identifier that your run uses, usually a Studio user email or userId.
  • That identifier is exposed to the runtime as PICKAXE_USER_IDENTIFIER.
  • Each key in the secrets object becomes an environment variable inside Actions and MCP servers for matching runs.
  • Updating the same identifier replaces the stored secret set for that user.
  • Avoid using the reserved PICKAXE_ prefix for custom keys.

Example request:

curl -X POST https://api.pickaxe.co/v1/studio/user/secrets/create \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
    "identifier": "jane.doe@example.com",
    "secrets": {
      "HUBSPOT_API_KEY": "hubspot-live-key",
      "CRM_REGION": "us-east-1"
    }
  }'

Core Context

  • PICKAXE_FORM_ID: the Pickaxe ID.
  • PICKAXE_RESPONSE_ID: the current session or conversation ID.
  • PICKAXE_USER_IDENTIFIER: the end-user identifier for the current run.
  • PICKAXE_USER_EMAIL: the resolved end-user email when available.

Knowledge And File Context

  • PICKAXE_END_USER_DOC_URLS: JSON-encoded array of end-user document URLs.
  • PICKAXE_END_USER_RAW_DOC_URLS: JSON-encoded array of raw or original end-user document URLs.
  • PICKAXE_END_USER_IMAGE_URLS: JSON-encoded array of image URLs available to the run.

Additional Image Context

  • PICKAXE_CURRENT_REQUEST_IMAGE_URLS: JSON-encoded array of images attached in the current request.
  • PICKAXE_SESSION_IMAGE_URLS: JSON-encoded array of image URLs seen earlier in the session.
  • PICKAXE_PRIMARY_IMAGE_URL: the first available image URL for the run, or an empty string if none exists.

User And Frontend Context

  • PICKAXE_END_USER_PAID: string value "True" or "False" indicating whether the user is paid.
  • PICKAXE_FRONTEND_PICKAXE_CONFIG: JSON-encoded frontend metadata or config supplied by the Pickaxe frontend for the current session, when available.
  • PICKAXE_USER_MEMORIES: JSON-encoded array of formatted memory strings when user memories are available.

Frontend Config Passed To Actions And MCP Servers

PICKAXE_FRONTEND_PICKAXE_CONFIG is populated from metadata supplied by the Pickaxe frontend for the request that starts the Pickaxe run. Use this for customer, account, routing, or other business context that Actions and MCP servers need.

For script embeds, define window.PickaxeConfig.metadata before the embed script loads:

<script>
  window.PickaxeConfig = {
    metadata: {
      customerId: "cus_123",
      accountTier: "enterprise",
      region: "us-east-1",
    },
  };
</script>
<script src="https://studio.pickaxe.co/api/embed/bundle.js" async></script>

You can also scope metadata to one deployment by nesting it under that deployment ID:

<script>
  window.PickaxeConfig = {
    "deployment-DEPLOYMENT_ID": {
      metadata: {
        customerId: "cus_123",
        accountTier: "enterprise",
      },
    },
  };
</script>
<script src="https://studio.pickaxe.co/api/embed/bundle.js" async></script>

The embed forwards the metadata with the submit request. The Action or MCP runtime receives it as a JSON string in PICKAXE_FRONTEND_PICKAXE_CONFIG.

Client-only PickaxeConfig keys such as class, style, and sso are not forwarded to Actions or MCP servers.

Python Runtime Example

import json
import os

doc_urls = json.loads(os.getenv("PICKAXE_END_USER_DOC_URLS", "[]"))
raw_doc_urls = json.loads(os.getenv("PICKAXE_END_USER_RAW_DOC_URLS", "[]"))
image_urls = json.loads(os.getenv("PICKAXE_END_USER_IMAGE_URLS", "[]"))
user_memories = json.loads(os.getenv("PICKAXE_USER_MEMORIES", "[]"))

print("Pickaxe ID:", os.getenv("PICKAXE_FORM_ID"))
print("Session ID:", os.getenv("PICKAXE_RESPONSE_ID"))
print("User Identifier:", os.getenv("PICKAXE_USER_IDENTIFIER"))
print("Paid User:", os.getenv("PICKAXE_END_USER_PAID"))
print("Primary Image URL:", os.getenv("PICKAXE_PRIMARY_IMAGE_URL"))
print("Docs:", doc_urls)
print("Memories:", user_memories)

Important Notes

  • Several values above are JSON-encoded strings, not native arrays or objects. Actions and MCP servers should parse them before use.
  • Prompt injectors and environment variables are different systems. Prompt injectors perform string replacement inside the Pickaxe prompt. Environment variables are injected into Action and MCP execution environments.