The traditional multi-agent workshop scheduling method uses a single scheduling rule, ignoring the influence of production environment changes on the applicability of scheduling rules and resulting in poor scheduling results. This study proposes an adaptive real-time workshop scheduling method to model the workpiece scheduling process by analogy through the contextual bandits. After several rounds of learning, the contextual bandit model can make scheduling decisions according to the production environment and obtain excellent scheduling results. Finally, simulation experiments verify the effectiveness of the proposed method.