Python Code

The Python Code block lets you execute fully custom logic within a Structured Visual Agent.

The block expects a Python function that can yield one or more output chunks. Each chunk is streamed to the user as soon as it is produced. Chunks can be a plain string, or a dict of the form {"chunk": {"text": "..."}}. To control which block runs next, yield a NextBlock object.