Agent Smith is a program that works within the Matrix system to maintain it. He is not a free being, nor the creator (that is the Architect), and he does not work against the Matrix. In the first film, he is clearly established as an Agent serving the system's purposes.