This paper shows how agents that sense and act can be represented within the independent choice logic, a semantic framework that allows for independent choices (made by various agents including nature) and a logic program that gives the consequence of choices. This representation can be used as a (runnable) specification for agents that observe the world and have memory, as well as a modelling tool for dynamic environments with uncertainty. The general idea is that an agent is a (not necessarily deterministic) function from sensor readings (observations) and remembered values into actions. Actions and observations are both represented as a propositions and a logic program specifies how actions follow from experiences. The state of an agent is what needs to be remembered about the past so that actions are a function of current observations and the state. There is a clean semantics, the overall framework it is representationally powerful, and reasonably efficient code can be generated from the agent specifications, even if generating optimal agents (which is well defined for the case of a single agent in an uncertain environment) is computationally infeasible in general.