There are 2 ways to execute Python scripts in Ant:
JSR-223 enables dynamic languages to be callable via Java in a seamless manner. Unfortunately this is currently only supported with Jython 2.2.1 and not the latest 2.5.0. Since PyAMF only supports Jython 2.5 or newer, you have to use the PythonInterpreter class directly. This style of embedding code is very similar to making use of a scripting engine, but it has the advantage of working with Jython 2.5.
Here you see the gateway running in Ant:
[mkdir] Created dir: build/classes
[javac] Compiling 1 source file to build/classes
[mkdir] Created dir: build/jar
[jar] Building jar: build/jar/HelloWorld.jar
[java] *sys-package-mgr*: processing new jar, 'build/jar/HelloWorld.jar'
[java] Running AMF gateway on http://localhost:8000
Read the complete howto, including a sample server/client, on http://pyamf.org/tutorials/jython/ant.html.