AI-driven agents are increasingly deployed for automation, customer service, cybersecurity operations, and decision support systems. However, these agents have become targets of prompt-based evasion attacks where adversaries craft malicious instructions to manipulate model behavior, extract sensitive information, or execute unauthorized commands. In this study, we present a machine learning-based framework for classifying malicious and benign prompts using both traditional NLP methods and deep contextual embeddings. A custom dataset of 1000 labeled prompts representing various attack types (social engineering, obfuscation, protocol abuse, multiturn manipulation, and normal queries) was used. We evaluated multiple models, including TF-IDF + XGBoost, BERT-based embeddings with Random Forest, Gaussian Naive Bayes, Decision Tree, and a deep Very Deep CNN (VDCNN) architecture. Experimental results show that Random Forest (BERT) and VDCNN (BERT) achieved the highest accuracy of 0.9793, outperforming other techniques. These findings highlight the importance of contextual embeddings in capturing linguistic patterns in adversarial instructions. The proposed approach can be integrated into real-world AI agent firewalls, autonomy systems, and LLM security monitors to detect prompt-based attacks effectively. Although the experiments are carried out on a curated dataset of 1,000 prompts, the study aims at assessing the efficacy of contextual embeddings and model robustness rather than generalization on a large scale. To ensure robustness and mitigate overfitting concerns, stratified train-test splitting, multi-metric evaluation, and K-fold crossvalidation were employed, confirming stable and consistent model performance across data partitions. The findings indicate that the proposed framework generalizes well within the evaluated scope and can serve as a practical defensive layer for AI agent security.