Humans and other animals are exquisitely attuned to their context. Context affects almost all aspects of behavior, and it does so for the most part automatically, without a conscious reasoning effort. This would be a very useful property for an artificial agent to have: upon recognizing its context, the agent's behavior would automatically adjust to fit it. This paper describescontext-mediated behavior(CMB), an approach to context-sensitive behavior we have developed over the past few years for intelligent autonomous agents. In CMB, contexts are represented explicitly ascontextual schemas(c-schemas). An agent recognizes its context by finding the c-schemas that match it, then it merges these to form a coherent representation of the current context. This includes not only a description of the context, but also information about how to behave in it. From that point until the next context change, knowledge for context-sensitive behavior is available with no additional effort. This is used to influence perception, make predictions about the world, handle unanticipated events, determine the context-dependent meaning of concepts, focus attention and select actions. CMB is being implemented in the Orca program, an intelligent controller for autonomous underwater vehicles.