dify/dify-agent/.example.env
盐粒 Yanli a048f35099
refactor: introduce agent working environment architecture (#39480)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-28 13:16:05 +00:00

83 lines
4.0 KiB
Bash

# Dify Agent run server settings template.
# Mirrors dify_agent.server.settings.ServerSettings with the DIFY_AGENT_ prefix.
# This template intentionally covers the current run-server settings only.
# Redis
# Redis connection URL for run records and per-run event streams.
DIFY_AGENT_REDIS_URL=redis://localhost:6379/0
# Prefix for Redis run-record and event-stream keys.
DIFY_AGENT_REDIS_PREFIX=dify-agent
# Shutdown and retention
# Seconds to wait for active local runs during graceful shutdown before cancellation.
DIFY_AGENT_SHUTDOWN_GRACE_SECONDS=30
# Seconds to retain Redis run records and per-run event streams (default: 3 days).
DIFY_AGENT_RUN_RETENTION_SECONDS=259200
# Plugin daemon
# Base URL for the Dify plugin daemon used by local runs.
DIFY_AGENT_PLUGIN_DAEMON_URL=http://localhost:5002
# API key sent to the Dify plugin daemon.
DIFY_AGENT_PLUGIN_DAEMON_API_KEY=
# Dify API inner endpoints
# Base URL for Dify API inner endpoints used by Agent Stub config/file/drive requests.
DIFY_AGENT_INNER_API_URL=http://localhost:5001
# Must match API/worker INNER_API_KEY_FOR_PLUGIN, not the generic INNER_API_KEY.
DIFY_AGENT_INNER_API_KEY=
# Runtime resources
# Select one coherent Home Snapshot + Execution Binding backend: local, enterprise, or e2b.
DIFY_AGENT_RUNTIME_BACKEND=local
# Local backend: shellctl data-plane URL and optional bearer token.
# Leave the endpoint empty when this server will not provide dify.runtime or resource endpoints.
DIFY_AGENT_LOCAL_SANDBOX_ENDPOINT=
DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN=
# Enterprise resource operations currently fail fast with NotImplementedError.
# These names are retained for the configured Enterprise Gateway boundary.
DIFY_AGENT_ENTERPRISE_SANDBOX_GATEWAY_ENDPOINT=
DIFY_AGENT_ENTERPRISE_SANDBOX_GATEWAY_AUTH_TOKEN=
DIFY_AGENT_ENTERPRISE_SANDBOX_GATEWAY_TIMEOUT=30
DIFY_AGENT_ENTERPRISE_SANDBOX_PROXY_TIMEOUT=60
# E2B backend: API key, prepared shellctl template, and active Binding policy.
DIFY_AGENT_E2B_API_KEY=
DIFY_AGENT_E2B_TEMPLATE=difys-default-team/dify-agent-local-sandbox
# Maximum continuous active time. Binding resources pause; temporary Home initialization resources are killed.
# This is not a retention TTL for paused resources or immutable snapshots.
DIFY_AGENT_E2B_ACTIVE_TIMEOUT_SECONDS=3600
DIFY_AGENT_E2B_SHELLCTL_AUTH_TOKEN=
DIFY_AGENT_E2B_SHELLCTL_PORT=5004
# Maximum whole-file size read through /workspace/files for an Agent Stub ToolFile upload (50 MiB).
# The environment variable keeps its existing SANDBOX name for deployment compatibility.
DIFY_AGENT_SANDBOX_FILE_UPLOAD_MAX_BYTES=52428800
# JSON array of regex patterns to redact from shell output shown to the agent.
DIFY_AGENT_SHELL_REDACT_PATTERNS=
# Agent Stub
# Public Agent Stub URL reachable from shellctl-managed remote machines.
# Use http(s)://.../agent-stub for HTTP or grpc://host:port for gRPC.
# Leave empty to avoid injecting DIFY_AGENT_STUB_* into shell.run jobs.
DIFY_AGENT_STUB_API_BASE_URL=http://localhost:5050/agent-stub
# Optional bind override used only when DIFY_AGENT_STUB_API_BASE_URL uses grpc://.
DIFY_AGENT_STUB_GRPC_BIND_ADDRESS=
# Server-wide root secret used to derive Agent Stub JWE keys.
# This is security-sensitive: it derives the JWE encryption key for Agent Stub bearer tokens.
# Replace this development default in production.
# Generate one with: python -c 'import secrets; print(secrets.token_urlsafe(32))'
DIFY_AGENT_SERVER_SECRET_KEY=MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY
# Inbound Bearer token for /runs API authentication.
# Must match AGENT_BACKEND_API_TOKEN on the Dify API side.
# Replace this development default in production.
# Generate one with: python -c 'import secrets; print(secrets.token_urlsafe(32))'
DIFY_AGENT_API_TOKEN=dify-agent-run-token-for-dev-only
# Shared outbound HTTP client timeouts and limits.
DIFY_AGENT_OUTBOUND_HTTP_CONNECT_TIMEOUT=10
DIFY_AGENT_OUTBOUND_HTTP_READ_TIMEOUT=600
DIFY_AGENT_OUTBOUND_HTTP_WRITE_TIMEOUT=30
DIFY_AGENT_OUTBOUND_HTTP_POOL_TIMEOUT=10
DIFY_AGENT_OUTBOUND_HTTP_MAX_CONNECTIONS=100
DIFY_AGENT_OUTBOUND_HTTP_MAX_KEEPALIVE_CONNECTIONS=20
DIFY_AGENT_OUTBOUND_HTTP_KEEPALIVE_EXPIRY=30