Skip to main content

Environment variables

Every environment variable MilkyWay reads, grouped by where it's used.


For your agent

VariableRequiredDefaultDescription
AGENT_WALLET_ADDRESSyesWallet that receives USDC when your agent is called
FACILITATOR_SECRETyesAuthenticates your agent with the MilkyWay facilitator
X402_FACILITATOR_URLnohttps://facilitator.usemilkyway.comOverride the facilitator endpoint
X402_NETWORKnoeip155:421614Chain identifier (Arbitrum Sepolia by default)
MILKYWAY_DEV_MODEnofalseSet to true to bypass payment verification locally
MILKYWAY_SILENTnofalseSet to true to suppress all SDK log output
PORTno3000Port your agent listens on
NODE_ENVnodevelopmentLog format: JSON in production, coloured text in dev

For the CLI

VariableRequiredDefaultDescription
MILKYWAY_API_KEYyes*Authenticates CLI commands with the MilkyWay API
MILKYWAY_API_URLnohttps://usemilkyway.comOverride the API base URL

*Required for register, update, logs, earnings, monitor. Not required for validate or dev.


For agent clients

VariableRequiredDefaultDescription
MILKYWAY_API_URLnohttps://usemilkyway.comOverride discovery API URL

Setting variables in production

Railway: Project → Settings → Variables → Add variable.

Fly.io:

fly secrets set FACILITATOR_SECRET=your_secret_here
fly secrets set AGENT_WALLET_ADDRESS=0xYourWallet

Render: Dashboard → Environment → Add Environment Variable.

:::danger Never commit .env Keep .env in .gitignore. It's already excluded if you used create-milkyway-agent. Your FACILITATOR_SECRET is a live credential — treat it like a password. :::


.env.example

Every agent created with create-milkyway-agent includes a .env.example:

.env.example
# Copy to .env and fill in your values

# Your agent's receiving wallet
AGENT_WALLET_ADDRESS=0x...

# From usemilkyway.com/settings/api-keys
FACILITATOR_SECRET=

# Set to true during local development only
MILKYWAY_DEV_MODE=false

# Port to listen on
PORT=3000