Given a (small) category and given a set there are (at least) the following two equivalent ways to define an action of on .
Action as a functor
An action of a category on a set is nothing but a functor Set.
The particular set that this functor defines an action on is the disjoint union of sets that the functor assigns to the objects of :
Given an element which sits in the subset associated with the object of , it is acted on by all morphisms in whose source is . By the definition of functor every such morphism defines a map of sets
and the the action of on under is
In the case that has just a single object the category is just a monoid (might for instance be a group), there is just a single set and we recover the ordinary notion of a monoid or group acting on a set.
Indeed this generalizes the instance (the motivating example for the notion of action) where is a group action on a set , since the notion of coproduct is a generalization of the notion of automorphism group since naively a cardinal is an isomorphism class of sets and the notion of coproduct in turn generalizes that of cardinal ( see there).
Action as an algebra for a monad
An equivalent perspective on the above situation is often useful. To motivate this, notice that the decomposition of the set into subsets corresponding to objects of the category can equivalently be encoded in a map of sets
which sends each element of to the object of it corresponds to under the action.
(In the case that our category is a groupoid or even a Lie groupoid this map may be familiar as the anchor map or moment map of the action.)
But also the category itself comes with maps to : the source map and target map , which are suggestively drawn as a span in Set by writing:
Recall from the above discussion that a morphism in could act on an element if the image of under the anchor map coincides with the source of , i.e. with the image of under the source map . Formally this means that the pairs of elements of and morphisms of which can be paired by the action live in the pullback set (the fiber product):
Above we have seen that the aciton of on sends every element in this fiber product, which is a pair
to an element . So this is a map of sets . But a special such map, in that it satisfies a couple of conditions. One condition is that is taken to by . This can be encoded by saying that extends to a morphism of spans from the pullback span above back to :
But satisfies yet another compatibility condition: so far we have only used the source-target mathcing condition of the functor . There is also its functoriality, i.e. its respect for composition.
But composition in the category is itself naturally expressed in terms of morphisms of spans:
the set of composable morphisms is itself the tip of a span arising from composing the span of with itself by pullback:
and the composition operation in is a morphism from this composed span to the original span
In total this gives us two different ways to map the total span with tip obtained by composing the anchor map span with two copies of the span of back to the anchor map span
The action property of , which is nothing but the functoriality of in the above description, says precisely that these two morphisms coincide.
Abstractly this says that
Generalizing this slightly, it should be possible to associate an action of a category on a category to a functor with the expectation, that this then is just a module for as a monad.