On-device conversational agent for psycho-oncology based on acceptance and commitment therapy manuals
Main Article Content
Abstract
Psychological distress is highly prevalent among individuals diagnosed with cancer, yet access to specialist psycho-oncology services remains limited by workforce shortages, geographical barriers, and concerns about privacy. This study presents a fully on-device conversational agent that combines Retrieval-Augmented Generation with a curated corpus of Acceptance and Commitment Therapy (ACT) manuals to deliver evidence-grounded emotional support without reliance on cloud resources. Multiple ACT guides and workbooks are parsed using PyMuPDF, segmented into 250-character chunks via a token-aware recursive splitting strategy, and embedded with all-MiniLM-L6-v2 sentence transformers. The resulting are indexed in a FAISS IndexFlatIP store. At inference, LangChain retrieves and ranks the top-k passages, while LangGraph enforces source fidelity before passing the context to a locally hosted llama3 model served via ChatOllama. Preliminary interactions suggest that the agent delivers concise, empathic responses referencing core ACT processes, while attaching inline citations that trace each claim to a specific passage. All responses are generated in real time on CPU-only hardware, preserving user privacy and making the system viable in low-resource clinical environments. Although current evaluation remains qualitative, no hallucinated citations or clinically unsafe statements are observed, indicating robust factual grounding at this early stage. Future work will add psycho‑oncology texts, enable optional web search for unseen queries, and run concordance studies with psycho‑oncologists to measure accuracy, tone, and usability. This lightweight offline pipeline therefore paves the way for privacy‑preserving chatbots that enhance psychosocial care in oncology and other mental‑health settings.
Article Details

This work is licensed under a Creative Commons Attribution 4.0 International License.
References
World Health Organization, "Global cancer burden growing, amidst mounting need for services," News Release, Geneva, 2024. [Online]. Available: https://www.who.int/news/item/01-02-2024-global-cancer-burden-growing--amidst-mounting-need-for-services
F. Bray, J. Ferlay, I. Soerjomataram, R. L. Siegel, L. A. Torre, and A. Jemal, "Global cancer statistics 2022: GLOBOCAN estimates of incidence and mortality worldwide for 36 cancers in 185 countries," CA: A Cancer Journal for Clinicians, vol. 74, no. 3, pp. 229–263, 2024. doi: 10.3322/caac.21834 .
A. J. Mitchell, M. Chan, H. Bhatti, M. Halton, L. Grassi, C. Johansen, and N. Meader, "Prevalence of depression, anxiety, and adjustment disorder in oncological, haematological, and palliative-care settings: a meta-analysis of 94 interview-based studies," The Lancet Oncology, vol. 12, no. 2, pp. 160–174, 2011. doi: 10.1016/S1470-2045(11)70002-X .
A. Pitman, S. Suleman, N. Hyde, and A. Hodgkiss, "Depression and anxiety in patients with cancer," BMJ, vol. 361, p. k1415, 2018. doi: 10.1136/bmj.k1415 .
M. Heinrich, L. Hofmann, H. Baurecht, P. M. Kreuzer, H. Knüttel, M. F. Leitzmann, and C. Seliger, "Suicide risk and mortality among patients with cancer," Nature Medicine, vol. 28, no. 4, pp. 852–859, 2022. doi: 10.1038/s41591-022-01745-y .
J. C. Holland, B. Andersen, W. S. Breitbart, L. O. Buchmann, B. Compas, T. L. DeShields, M. M. Dudley, S. Fleishman, C. D. Fulcher, D. B. Greenberg et al., "Distress management," Journal of the National Comprehensive Cancer Network, vol. 11, no. 2, pp. 190–209, 2013. doi: 10.6004/jnccn.2013.0027 .
F. I. Fawzy, "Psychosocial interventions for patients with cancer: what works and what doesn't," European Journal of Cancer, vol. 35, no. 11, pp. 1559–1564, 1999. doi: 10.1016/S0959-8049(99)00191-4 .
S. L. Ehlers, K. Davis, S. M. Bluethmann, L. M. Quintiliani, J. Kendall, R. M. Ratwani, M. A. Diefenbach, and K. D. Graves, "Screening for psychosocial distress among patients with cancer: implications for clinical practice, healthcare policy, and dissemination to enhance cancer survivorship," Translational Behavioral Medicine, vol. 9, no. 2, pp. 282–291, 2019. doi: 10.1093/tbm/iby119 .
P. Lewis, E. Perez, A. Piktus, F. Petroni, V. Karpukhin, N. Goyal, H. Küttler, M. Lewis, W.-T. Yih, T. Rocktäschel et al., "Retrieval-augmented generation for knowledge-intensive NLP tasks," in Advances in Neural Information Processing Systems, vol. 33, 2020, pp. 9459–9474. [Online]. Available: https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html
K. K. Fitzpatrick, A. Darcy, and M. Vierhile, "Delivering cognitive behavior therapy to young adults with symptoms of depression and anxiety using a fully automated conversational agent (woebot): a randomized controlled trial," JMIR Mental Health, vol. 4, no. 2, p. e7785, 2017. doi: 10.2196/mental.7785 .
M. Luciano and K. Wilson, Terapia de aceptación y compromiso: Un tratamiento conductual orientado a los valores. Madrid: Pirámide, 2002.
J. I. Cruz Gaitán, R. O. Sánchez, and P. L. Gutiérrez, Duelo: Tratamiento basado en la Terapia de Aceptación y Compromiso. Ciudad de México, Mexico: Editorial El Manual Moderno, 2017.
S. C. Hayes, K. D. Strosahl, and K. G. Wilson, Acceptance and Commitment Therapy: An Experiential Approach to Behavior Change. New York, NY, USA: Guilford Press, 1999.
J. Johnson, M. Douze, and H. Jégou, "Billion-scale similarity search with GPUs," IEEE Transactions on Big Data, vol. 7, no. 3, pp. 535–547, 2021. doi: 10.1109/TBDATA.2019.2921572 .
Meta AI, "Meta Llama 3 — technical report," Meta AI, Tech. Rep. arXiv:2404.14219, 2024. [Online]. Available: https://arxiv.org/abs/2404.14219
LangChain Developers. (2025) ChatOllama integration guide. [Online]. Available: https://python.langchain.com/docs/integrations/chat/ollama