Add auto-discovery script for the agent.

Refs #4865