The advancements in artificial intelligence have led to significant legal and ethical issues related to privacy, bias, accountability, etc. In recent years, many regulations have been put in place to limit or mitigate the risks associated with AI. Compliance with these regulations are necessary for the reliability of AI systems and to ensure that they are being used responsibly. In addition, reliable AI systems should also be ethical, ensuring alignment with ethical norms. Compliance with applicable laws and adherence to ethical principles are essential for most AI applications. We investigate this problem from the point of view of AI agents. In other words, how an agent can ensure the compliance of its actions with legal and ethical norms. We are interested in approaches based on logical reasoning to integrate legal and ethical compliance in the agent's planning process. The specific domain in which we pursue our objective is the processing of personal data. i.e. the agent's actions involve the use and processing of personal data. A regulation that applies in such a domain is the General Data Protection Regulations (GDPR). In addition, the processing of personal data may entail certain ethical risks with respect to privacy or bias.
We address this issue through a series of contributions presented in this thesis. We start with the issue of GDPR compliance. We adopt Event Calculus with Answer Set Programming(ASP) to model agents' actions and use it for planning and checking the compliance with GDPR. A policy language is used to represent the GDPR obligations and requirements. Then we investigate the issue of ethical compliance. A pluralistic ordinal utility model is proposed that allows one to evaluate actions based on moral values. This model is based on multiple criteria and uses voting systems to aggregate evaluations on an ordinal scale. We then integrate this utility model and the legal compliance framework in a Hierarchical Task Network(HTN) planner. In this contribution, legal norms are considered hard constraints and ethical norms as soft constraints. Finally, as a last step, we further explore the possible combinations of legal and ethical compliance with the planning agent and propose a unified framework. This framework captures the interaction and conflicts between legal and ethical norms and is tested in a use case with AI systems managing the delivery of health care items.