Skip to main content

owyl - 0.3.0

A fast and flexible Behavior Tree library for AI.

David Eyk

You have Pyglet. You've got Rabbyt. But who do your sprites go to for advice? Owyl, of course.


The goal of Owyl: provide a fast and flexible Behavior Tree framework implemented in python. Owyl trees use nested generators to iterate through your behaviors. The root of the tree always works just like a normal python iterator. If you know how to work with iterators, you know how to work with an Owyl tree. Because Owyl is small and behavior trees are easy to grasp, it's easy to control and extend your AI behaviors.

Trees as Iterators

Trees as iterators give you total control over how a behavior tree integrates with your code: use a for loop, a list comprehension, a generator expression, or manual calls to Run the tree one step, five, or fifty with every frame.


Writing new behaviors is simple and easy (and soon to be documented!). Any object that corresponds to python's iterator interface and a few simple rules for yielded values will work. Owyl's core behaviors are written as simple generator functions.

More Information

  • Owyl does not depend on any particular framework. You can use it with PyGame, pyglet, PyOpenGL, Panda3D, OGRE, TurboGears, Django, urwid, wxPython, PyQT, and probably 50 million other frameworks, as long as you have Python.
  • Owyl has been tested on python 2.5. It will probably work on 2.6. It most likely won't work on 2.4 (not without some jiggering). Please let me know if you have any trouble with it.
  • For more information on Behavior Trees, see these articles. Remember: AI isn't about math, it's about getting things done.
  • For more information on python generators, see this introduction to generators.

Questions? Comments?

Drop a line below, or bring your questions and comments to the Owyl discussion group.


Many improvements, enough to warrant version 0.3.

  • Working(!) boids example.
  • Child handling has now been pushed into parent behaviors.
    • Previously, children were only run once, and then re-instantiated on the next iteration (oops!).
    • Parent must call children before yielding them.
    • visit will call the root task of its tree.
  • Non-working decorators now work.
  • I think parallel is really working correctly now.
  • Tracebacks are totally not helpful right now.
    • Debugging is a pain in the neck.
    • This needs to be improved upon.
    • I have no idea how. Tracebacks seem to ignore time spent inside of generators.
    • Some sort of value-added generator-ified traceback may be in order.


Home Page


owyl 0.2.1 — 5 Jan, 2009

owyl 0.2.2 — 8 Jan, 2009

owyl 0.3.0 — 15 Jan, 2009 account Comments