# Agent The **MTConnect Agent** receives data from one or more device Adapters and writes the data to an XML tree. This XML can be consumed by other applications, or displayed in a browser as an HTML webpage. ## Run Image The Agent comes with a recording of a CNC machine for playback. This command will download an image of the Agent from Docker Hub (a central repository for Docker services) and run the simulation - ```bash docker run -it --rm --init --name agent -p5000:5000 mtconnect/agent ``` ## View Output View the output in your browser at http://localhost:5000 - ![](../_images/agent-html_1200.jpg) The Agent starts in the **Probe** tab, which shows the data items available - first for the Agent itself, then the CNC machine. Click on the **Current** tab to see the current data values, then click on the Autorefresh button to have the view refreshed every 2 seconds. The **Sample** tab shows a series of recent data values. The Agent comes with a buffer to store data values, and you can query it with XPath expressions. For example, to see the last 10 values for the x-axis position, visit http://localhost:5000/sample?path=//Linear[@name=%22X%22]//DataItem[@type=%22POSITION%22%20and%20@subType=%22ACTUAL%22]&count=10 ![](../_images/ladder99-agent-sample.png) Click the question mark to see more help. ## XML Output Click **XML** to see the underlying XML data - ![](../_images/agent-xml.jpg) ## Exit Agent When you're done, hit Ctrl+C in the terminal window. ## Source Code The MTConnect Agent is an open source C++ application. To learn more about it, see https://github.com/mtconnect/cppagent.