# Honcho Environment Variables Template # Copy this file to .env and fill in the appropriate values # # Required variables are marked with (REQUIRED) # Optional variables have default values and can be left commented out # ============================================================================= # Application Settings # ============================================================================= LOG_LEVEL=INFO PERFORMANCE_LOG_FORMAT=compact # compact|rich # SESSION_OBSERVERS_LIMIT=10 # GET_CONTEXT_MAX_TOKENS=100000 # MAX_FILE_SIZE=5242880 # Bytes # MAX_MESSAGE_SIZE=25000 # Characters # Embedding settings # EMBED_MESSAGES=true # EMBEDDING_VECTOR_DIMENSIONS=1536 # EMBEDDING_MAX_INPUT_TOKENS=8192 # EMBEDDING_MAX_TOKENS_PER_REQUEST=300000 # EMBEDDING_MODEL_CONFIG__TRANSPORT=openai # EMBEDDING_MODEL_CONFIG__MODEL=text-embedding-3-small # EMBEDDING_MODEL_CONFIG__MAX_BATCH_SIZE=10 # EMBEDDING_MODEL_CONFIG__OVERRIDES__BASE_URL= # EMBEDDING_MODEL_CONFIG__OVERRIDES__API_KEY_ENV= # LANGFUSE_HOST= # LANGFUSE_PUBLIC_KEY= # LANGFUSE_SECRET_KEY= # COLLECT_METRICS_LOCAL=false # LOCAL_METRICS_FILE=metrics.jsonl # REASONING_TRACES_FILE=traces.jsonl # Path to JSONL file for reasoning traces # NAMESPACE="honcho" # ============================================================================= # Database Settings (REQUIRED) # ============================================================================= # Connection URI for PostgreSQL database with pgvector support # Must use postgresql+psycopg prefix for SQLAlchemy compatibility DB_CONNECTION_URI=postgresql+psycopg://postgres:postgres@localhost:5432/postgres # Optional database settings # DB_SCHEMA=public # DB_POOL_CLASS=default # DB_POOL_SIZE=10 # DB_MAX_OVERFLOW=20 # DB_POOL_TIMEOUT=5 # seconds a pooled checkout waits for a free connection (QueuePool only) # DB_POOL_RECYCLE=300 # DB_POOL_PRE_PING=true # DB_POOL_USE_LIFO=true # DB_SQL_DEBUG=false # DB_TRACING=false # Per-connection establish timeout (seconds) so a single connection attempt # fails fast instead of hanging when the server/pooler is unreachable. # DB_CONNECT_TIMEOUT_SECONDS=2 # ============================================================================= # Authentication Settings # ============================================================================= # Whether to enable authentication (set to true for production) AUTH_USE_AUTH=false # JWT secret key (REQUIRED if AUTH_USE_AUTH=true) # Generate with: python scripts/generate_jwt_secret.py # AUTH_JWT_SECRET=your-secret-key-here # ============================================================================= # LLM Provider (REQUIRED) # ============================================================================= # Honcho uses LLMs for memory extraction, summarization, dialectic chat, and # dream consolidation. The server will fail to start without a provider configured. # # Quick start: set LLM_OPENAI_API_KEY below to use the built-in defaults. # Text-generation features default to transport = "openai" and # model = "gpt-5.4-mini". Embeddings default to transport = "openai" and # model = "text-embedding-3-small". For OpenAI-compatible proxies # (OpenRouter, Together, Fireworks, vLLM, Ollama, LiteLLM), override # MODEL_CONFIG__MODEL and MODEL_CONFIG__OVERRIDES__BASE_URL on each feature # section you want to route through that endpoint. # Models must support tool calling (function calling). # # Supported transports: openai, anthropic, gemini # Each transport picks up its API key from the corresponding LLM_*_API_KEY. # Base URLs are set per-module via MODEL_CONFIG__OVERRIDES__BASE_URL. # LLM_OPENAI_API_KEY=your-api-key-here # LLM_ANTHROPIC_API_KEY= # LLM_GEMINI_API_KEY= # ============================================================================= # LLM Configuration # ============================================================================= # Global LLM settings # LLM_DEFAULT_MAX_TOKENS=2500 # LLM_MAX_TOOL_OUTPUT_CHARS=10000 # Max chars for tool output (~2500 tokens) # LLM_MAX_MESSAGE_CONTENT_CHARS=2000 # Max chars per message in tool results # ============================================================================= # Deriver (Background Worker) # ============================================================================= # DERIVER_ENABLED=true # Defaults: # DERIVER_MODEL_CONFIG__TRANSPORT=openai # DERIVER_MODEL_CONFIG__MODEL=gpt-5.4-mini # Optional overrides: # DERIVER_MODEL_CONFIG__MODEL=your-model-here # DERIVER_MODEL_CONFIG__OVERRIDES__BASE_URL=https://openrouter.ai/api/v1 # DERIVER_WORKERS=1 # DERIVER_POLLING_SLEEP_INTERVAL_SECONDS=1.0 # Adaptive polling: grows the idle/error sleep from the base toward the max by # the multiplier each cycle, snapping back to base when work is found. # DERIVER_POLLING_BACKOFF_ENABLED=true # DERIVER_POLLING_SLEEP_MAX_INTERVAL_SECONDS=30.0 # DERIVER_POLLING_BACKOFF_MULTIPLIER=2.0 # Jitter so instances that start together don't poll in lockstep. Startup: sleep # a random delay in [0, value] before the first poll (0.0 disables). Per-cycle: # multiply every poll sleep by a random factor in [1-ratio, 1+ratio] (0.0 disables). # DERIVER_POLLING_STARTUP_JITTER_SECONDS=30.0 # DERIVER_POLLING_JITTER_RATIO=0.5 # DERIVER_STALE_SESSION_TIMEOUT_MINUTES=5 # DERIVER_QUEUE_ERROR_RETENTION_SECONDS=2592000 # 30 days # DERIVER_MODEL_CONFIG__TEMPERATURE= # DERIVER_MODEL_CONFIG__THINKING_EFFORT=minimal # DERIVER_MODEL_CONFIG__THINKING_BUDGET_TOKENS=1024 # Gemini/Anthropic only # DERIVER_MODEL_CONFIG__STRUCTURED_OUTPUT_MODE=json_object # for providers without json_schema support # DERIVER_DEDUPLICATE=true # DERIVER_MODEL_CONFIG__MAX_OUTPUT_TOKENS=4096 # DERIVER_LOG_OBSERVATIONS=false # DERIVER_MAX_INPUT_TOKENS=25000 # DERIVER_MAX_CUSTOM_INSTRUCTIONS_TOKENS=2000 # DERIVER_WORKING_REPRESENTATION_MAX_OBSERVATIONS=100 # DERIVER_REPRESENTATION_BATCH_WORK_UNIT_TARGET_TOKENS=512 # Min tokens a work unit accumulates before the deriver claims it; 0 disables the gate # DERIVER_REPRESENTATION_BATCH_TARGET_INPUT_TOKENS=1024 # Max context-window tokens per deriver LLM call # DERIVER_REPRESENTATION_BATCH_MAX_AGE_SECONDS=1800 # DERIVER_FLUSH_ENABLED=false # Bypass batch token threshold, process work immediately # DERIVER_MODEL_CONFIG__FALLBACK__MODEL= # DERIVER_MODEL_CONFIG__FALLBACK__TRANSPORT= # DERIVER_MODEL_CONFIG__OVERRIDES__BASE_URL= # DERIVER_MODEL_CONFIG__OVERRIDES__API_KEY_ENV= # ============================================================================= # Peer Card # ============================================================================= # PEER_CARD_ENABLED=true # ============================================================================= # Dialectic # ============================================================================= # DIALECTIC_MAX_OUTPUT_TOKENS=8192 # DIALECTIC_MAX_INPUT_TOKENS=100000 # DIALECTIC_HISTORY_TOKEN_LIMIT=8192 # DIALECTIC_SESSION_HISTORY_MAX_TOKENS=4096 # # Per-level settings (reasoning_level parameter in API) # Each level has its own nested MODEL_CONFIG, tool iterations, and max output tokens. # MAX_OUTPUT_TOKENS is optional per level; if not set, uses global DIALECTIC_MAX_OUTPUT_TOKENS. # Defaults: # DIALECTIC_LEVELS__minimal__MODEL_CONFIG__TRANSPORT=openai # DIALECTIC_LEVELS__minimal__MODEL_CONFIG__MODEL=gpt-5.4-mini # DIALECTIC_LEVELS__minimal__MAX_TOOL_ITERATIONS=1 # DIALECTIC_LEVELS__minimal__MAX_OUTPUT_TOKENS=250 # DIALECTIC_LEVELS__minimal__TOOL_CHOICE=auto # DIALECTIC_LEVELS__low__MODEL_CONFIG__TRANSPORT=openai # DIALECTIC_LEVELS__low__MODEL_CONFIG__MODEL=gpt-5.4-mini # DIALECTIC_LEVELS__low__MAX_TOOL_ITERATIONS=5 # DIALECTIC_LEVELS__low__TOOL_CHOICE=auto # DIALECTIC_LEVELS__medium__MODEL_CONFIG__TRANSPORT=openai # DIALECTIC_LEVELS__medium__MODEL_CONFIG__MODEL=gpt-5.4-mini # DIALECTIC_LEVELS__medium__MAX_TOOL_ITERATIONS=2 # DIALECTIC_LEVELS__high__MODEL_CONFIG__TRANSPORT=openai # DIALECTIC_LEVELS__high__MODEL_CONFIG__MODEL=gpt-5.4-mini # DIALECTIC_LEVELS__high__MAX_TOOL_ITERATIONS=4 # DIALECTIC_LEVELS__max__MODEL_CONFIG__TRANSPORT=openai # DIALECTIC_LEVELS__max__MODEL_CONFIG__MODEL=gpt-5.4-mini # DIALECTIC_LEVELS__max__MAX_TOOL_ITERATIONS=10 # Optional overrides (model and OpenAI-compatible base URL are per-level): # DIALECTIC_LEVELS__minimal__MODEL_CONFIG__MODEL=your-model-here # DIALECTIC_LEVELS__minimal__MODEL_CONFIG__OVERRIDES__BASE_URL=https://openrouter.ai/api/v1 # DIALECTIC_LEVELS__low__MODEL_CONFIG__MODEL=your-model-here # DIALECTIC_LEVELS__low__MODEL_CONFIG__OVERRIDES__BASE_URL=https://openrouter.ai/api/v1 # DIALECTIC_LEVELS__medium__MODEL_CONFIG__MODEL=your-model-here # DIALECTIC_LEVELS__medium__MODEL_CONFIG__OVERRIDES__BASE_URL=https://openrouter.ai/api/v1 # DIALECTIC_LEVELS__high__MODEL_CONFIG__MODEL=your-model-here # DIALECTIC_LEVELS__high__MODEL_CONFIG__OVERRIDES__BASE_URL=https://openrouter.ai/api/v1 # DIALECTIC_LEVELS__max__MODEL_CONFIG__MODEL=your-model-here # DIALECTIC_LEVELS__max__MODEL_CONFIG__OVERRIDES__BASE_URL=https://openrouter.ai/api/v1 # DIALECTIC_LEVELS__max__MODEL_CONFIG__THINKING_EFFORT=medium # DIALECTIC_LEVELS__max__MODEL_CONFIG__THINKING_BUDGET_TOKENS=1024 # Optional backup per level (must set both or neither): # DIALECTIC_LEVELS__max__MODEL_CONFIG__FALLBACK__MODEL=gemini-2.5-pro # DIALECTIC_LEVELS__max__MODEL_CONFIG__FALLBACK__TRANSPORT=gemini # ============================================================================= # Summary # ============================================================================= # SUMMARY_ENABLED=true # Defaults: # SUMMARY_MODEL_CONFIG__TRANSPORT=openai # SUMMARY_MODEL_CONFIG__MODEL=gpt-5.4-mini # Optional overrides: # SUMMARY_MODEL_CONFIG__MODEL=your-model-here # SUMMARY_MODEL_CONFIG__OVERRIDES__BASE_URL=https://openrouter.ai/api/v1 # SUMMARY_MODEL_CONFIG__THINKING_EFFORT=minimal # SUMMARY_MODEL_CONFIG__THINKING_BUDGET_TOKENS=1024 # Gemini/Anthropic only # SUMMARY_MESSAGES_PER_SHORT_SUMMARY=20 # SUMMARY_MESSAGES_PER_LONG_SUMMARY=60 # SUMMARY_MAX_TOKENS_SHORT=1000 # SUMMARY_MAX_TOKENS_LONG=4000 # SUMMARY_MODEL_CONFIG__FALLBACK__MODEL= # ============================================================================= # Dream # ============================================================================= # DREAM_ENABLED=true # Defaults: # DREAM_DEDUCTION_MODEL_CONFIG__TRANSPORT=openai # DREAM_DEDUCTION_MODEL_CONFIG__MODEL=gpt-5.4-mini # DREAM_INDUCTION_MODEL_CONFIG__TRANSPORT=openai # DREAM_INDUCTION_MODEL_CONFIG__MODEL=gpt-5.4-mini # Optional overrides: # DREAM_DEDUCTION_MODEL_CONFIG__MODEL=your-model-here # DREAM_DEDUCTION_MODEL_CONFIG__OVERRIDES__BASE_URL=https://openrouter.ai/api/v1 # DREAM_INDUCTION_MODEL_CONFIG__MODEL=your-model-here # DREAM_INDUCTION_MODEL_CONFIG__OVERRIDES__BASE_URL=https://openrouter.ai/api/v1 # DREAM_DOCUMENT_THRESHOLD=50 # DREAM_IDLE_TIMEOUT_MINUTES=60 # DREAM_MIN_HOURS_BETWEEN_DREAMS=8 # DREAM_ENABLED_TYPES=["omni"] # DREAM_MAX_TOOL_ITERATIONS=20 # DREAM_HISTORY_TOKEN_LIMIT=16384 # Surprisal sampling (advanced): # DREAM_SURPRISAL__ENABLED=false # DREAM_SURPRISAL__TREE_TYPE=kdtree # DREAM_SURPRISAL__TREE_K=5 # DREAM_SURPRISAL__SAMPLING_STRATEGY=recent # DREAM_SURPRISAL__SAMPLE_SIZE=200 # DREAM_SURPRISAL__TOP_PERCENT_SURPRISAL=0.10 # DREAM_SURPRISAL__MIN_HIGH_SURPRISAL_FOR_REPLACE=10 # DREAM_SURPRISAL__INCLUDE_LEVELS=["explicit","deductive"] # ============================================================================= # Webhook Settings # ============================================================================= # WEBHOOK_SECRET= # WEBHOOK_MAX_WORKSPACE_LIMIT=10 # ============================================================================= # Monitoring and Observability (Optional) # ============================================================================= # Sentry error tracking # SENTRY_ENABLED=false # SENTRY_DSN=your-sentry-dsn-here # SENTRY_RELEASE=your-release-semver # SENTRY_ENVIRONMENT=development # SENTRY_TRACES_SAMPLE_RATE=0.1 # SENTRY_PROFILES_SAMPLE_RATE=0.1 # ============================================================================= # Prometheus Metrics Settings (Pull-based metrics) # ============================================================================= # METRICS_ENABLED=false # METRICS_NAMESPACE=honcho # Inherits from NAMESPACE if not set # ============================================================================= # CloudEvents Telemetry Settings (Analytics events) # ============================================================================= # TELEMETRY_ENABLED=false # TELEMETRY_ENDPOINT=https://telemetry.honcho.dev/v1/events # TELEMETRY_HEADERS={"Authorization": "Bearer your-token"} # JSON string for auth headers # TELEMETRY_BATCH_SIZE=100 # TELEMETRY_FLUSH_INTERVAL_SECONDS=1.0 # TELEMETRY_FLUSH_THRESHOLD=50 # TELEMETRY_MAX_RETRIES=3 # TELEMETRY_MAX_BUFFER_SIZE=10000 # TELEMETRY_NAMESPACE=honcho # Inherits from NAMESPACE if not set # Full-fidelity payload tracing (llm.call.traced / trace.content). Default-off # TELEMETRY_TRACE_PAYLOADS_ENABLED=false # Trace events ship to TELEMETRY_ENDPOINT # TELEMETRY_TRACE_MAX_BYTES=262144 # Per-message cap; oversized content is clipped # TELEMETRY_TRACE_PURPOSES=[] # JSON list of CallPurpose values to capture; empty = all # ============================================================================= # Cache # ============================================================================= # CACHE_ENABLED=false # CACHE_URL="redis://localhost:6379/0?suppress=true" # CACHE_CLUSTER=false # true when CACHE_URL is a Redis Cluster (e.g. Memorystore for Redis Cluster) # CACHE_NAMESPACE="honcho" # Inherits from NAMESPACE if not set # CACHE_DEFAULT_TTL_SECONDS=300 # CACHE_DEFAULT_LOCK_TTL_SECONDS=5 # CACHE_LOCK_WAIT_CHECK_INTERVAL_SECONDS=0.1 # ============================================================================= # CORS Settings # ============================================================================= # JSON array of origins allowed by the FastAPI CORSMiddleware. Defaults match # the previously hardcoded list: localhost, 127.0.0.1:8000 and api.honcho.dev. # CORS_ORIGINS=["http://localhost","http://127.0.0.1:8000","https://api.honcho.dev"] # ============================================================================= # Vector Store Settings # ============================================================================= # Vector store type: "pgvector", "turbopuffer", or "lancedb" VECTOR_STORE_TYPE=pgvector # Migration flag: set to true when migration from pgvector is complete VECTOR_STORE_MIGRATED=false # Global namespace prefix for all vector namespaces # Namespaces follow the pattern: {NAMESPACE}.{type}.{hash} # where hash is a base64url-encoded SHA-256 of the workspace/peer names # - Documents: {NAMESPACE}.doc.{hash(workspace, observer, observed)} # - Messages: {NAMESPACE}.msg.{hash(workspace)} # VECTOR_STORE_NAMESPACE=honcho # Inherits from NAMESPACE if not set # Embedding dimensions are configured via EMBEDDING_VECTOR_DIMENSIONS (see top # of this file). VECTOR_STORE_DIMENSIONS is deprecated and ignored. # Turbopuffer-specific settings (required if TYPE is "turbopuffer") # VECTOR_STORE_TURBOPUFFER_API_KEY=your-turbopuffer-api-key # VECTOR_STORE_TURBOPUFFER_REGION=gcp-us-east4 # LanceDB-specific settings (local embedded mode) # VECTOR_STORE_LANCEDB_PATH=./lancedb_data # Reconciliation interval for background sync (default: 5 minutes) # VECTOR_STORE_RECONCILIATION_INTERVAL_SECONDS=300