autogen/dotnet/website/articles/Run-dotnet-code.md
Why running code snippet is useful? The ability of running code snippet can greatly extend the ability of an agent. Because it enables agent to resolve tasks by writing code and run it, which is much more powerful than just returning a text response.  For example, in data analysis scenario, agent can resolve tasks like "What is the average of the sales amount of the last 7 days?" by firstly write a code snippet to query the sales amount of the last 7 days, then calculate the average and then run the code snippet to get the result.  > [!WARNING] > Running arbitrary code snippet from agent response could bring risks to your system. Using this feature with caution. 