Overview
Thesam run command starts the Solace Agent Mesh application using specified or discovered YAML configuration files.
Syntax
Description
Runs the Solace application with the specified YAML configuration files. When a directory is provided, it is recursively searched for YAML files (.yaml, .yml). If no files are specified, the command discovers configuration files automatically.
The command:
- Loads environment variables from
.envfile (unless--system-envis used) - Discovers and validates YAML configuration files
- Initializes the Solace AI Connector
- Starts all configured components (agents, gateways, etc.)
Arguments
Paths to individual YAML files or directories containing YAML files. Multiple paths can be specified.
- Individual files:
agent.yaml gateway.yaml - Directories:
configs/(recursively searches for YAML files) - Mixed:
configs/agents/ my-gateway.yaml
Options
File name(s) to exclude from the run. Can be used multiple times.Example:
-s agent1.yaml -s agent2.yamlUse system environment variables only; do not load
.env file.When enabled, the command will not search for or load a .env file, relying solely on environment variables already set in the system.Examples
Run with Auto-Discovery
Run Specific Files
Run All Files in Directory
configs/ directory.
Exclude Specific Files
configs/ except for test_agent.yaml and experimental_gateway.yaml.
Use System Environment Only
.env file, using only system environment variables.
Run Specific Directory with Exclusions
Configuration File Discovery
Therun command uses the following logic to discover configuration files:
- If specific files/directories are provided:
- Files are added directly
- Directories are recursively searched for
.yamland.ymlfiles
- Files matching names in
--skipare excluded - The final list is passed to the Solace AI Connector
Environment Variables
The command loads environment variables from.env file in the following order:
- Searches for
.envin current directory - Searches parent directories up to root
- Loads variables with
override=True(overwrites existing)
LOGGING_CONFIG_PATH: If relative path, converted to absolute path
Output
Successful startup:Exit Codes
0: Successful execution1: Error (configuration file not found, startup failure, etc.)- Other: Propagated from Solace AI Connector
Implementation Details
The command is implemented in/home/daytona/workspace/source/cli/commands/run_cmd.py:40-147 and:
- Sets up logging configuration
- Loads environment from
.envfile (if not using--system-env) - Runs enterprise initialization hooks
- Discovers configuration files using
discover_config_files()utility - Delegates to
solace_ai_connector.mainfor component execution
Notes
- The command blocks until interrupted (Ctrl+C) or all components exit
- Log output is controlled by
LOGGING_CONFIG_PATHenvironment variable - Configuration files must be valid YAML and follow SAM schema
- The
.envfile supports variable substitution in YAML configs using${VAR_NAME}syntax
Troubleshooting
Error: No configuration files found
Cause: No YAML files in specified paths or all files excluded via--skip
Solution: Verify paths and check file extensions (.yaml or .yml)
Error: .env file not found
Cause: Running from directory without.env file
Solution:
- Run from project root, or
- Use
--system-envflag, or - Create
.envfile with required variables
Logging not configured
Cause:LOGGING_CONFIG_PATH not set or file not found
Solution: Set LOGGING_CONFIG_PATH in .env or use default logging
See Also
- sam init - Initialize a new project
- sam task run - Run SAM and execute a task in one command
- sam add - Add new components to your project