Some ideas:
1. from command line: agi debug
2. using a shell script: how to debug agi scripts
HTH
In reply to Re: debugging AGI script by dHarry in thread debugging AGI script by targetsmart