Add user agent support

Adds support for user agents -- patterns can be specified with only_agents or except_agents.