top of page

How to enable Python support in Layla

  • Writer: Layla
    Layla
  • 12 minutes ago
  • 2 min read

Layla Agents can execute python! This is possible after update v6.7.0: https://www.layla-network.ai/post/layla-v6-7-0-has-been-published


To enable Python code execution, we need to install a few mini-apps. If you need a refresher on how to do this, here is a tutorial: https://www.layla-network.ai/post/how-to-add-features-mini-apps-in-layla


Step 1: You need the Agents mini-app and the Python Interpreter mini-app

Go to your apps, tap the plus sign, and browser mini-apps. Find the Agents and Python Interpreter mini-app. Tap Download to add them to Layla.

App interface showing "Agents" tool for Layla. Description highlights features like web search and Spotify integration. "Go to App" button visible.
The Agents mini-app
App screen for "Python Interpreter" in Layla. Shows code snippets, a Python logo, and a description about running scripts. "Go to App" button.
The Python Interpreter mini-app

Step 2: Test out the Python Interpreter After you've installed those two mini-apps, let's go to the Python Interpreter mini-app to test it out.


Try executing a simple "Hello Layla" script by tapping the Run button at the top right.

Python Interpreter app showing code in the editor with "print('Hello Layla!')" and output "Hello Layla!" Dark background, blue "Run" button.

You should see the green text "Hello Layla!" in the Console Output below. This confirms that Python is working in Layla!


Step 3 (optional): install dependencies

Python scripts aren't really useful unless you can install libraries and dependencies. Layla allows you to do that!


The "Package Manager" below the output allows you to install Python packages via "pip", just like how you would in a PC.


Let's try installing "requests", a popular library to make network requests (you will be needing this a lot!).


Python script installation in progress on a dark interface. Text shows package names and download status in green against a black background.

Type "requests" in the package manager input and tap "Add"


Tip: this input works just like a command line, you can add arguments such as "--upgrade" to replace already installed packages. You fix a version by using "[package name]==[version]". You can even install multiple packages by simply typing them with a space between their names!


Afterwards, you should see green text detailing the install progress.


Step 3: Create a test agent

Python scripting becomes a lot more useful if Agents can execute them; and Layla supports that.


In this article, we will create a simple test agent that prints something to be sent to the LLM. In future articles, we will go over creating more complicated agents.


Go back to the Agents mini-app. The easiest way is to duplicate an existing agent. Let's do that.


Edit the name and description to something you can remember.


App interface showing automation agents: "Get CNN news," "Test Python code," and "Create Note." Options to Edit, Test, Share. Dark theme.

Edit this new agent:


App interface showing "Edit Agent" screen with system prompt text. "Triggers" section has a phrase "Python." Buttons for "Cancel" and "Save" are below.

For now, we will just use the phrase "Python". This means whenever you mention "python" in your messages to Layla, this agent will be triggered. (Obviously more complex triggers are needed later for more complex agents!)


Add the "execute Python code" tool:


Edit Agent screen showing tool options: Create Event, Display Image, DuckDuckGo search. Buttons for Cancel and Save are visible.

In the Python code tool, you are able to edit the script to execute, and add any dependencies that your code needs. For now, a simple "print" will do:


A digital interface titled "Edit Agent" showing a toggle for LLM tool call and code input box with print statement. Buttons: Cancel, Save.

Since the "print" code requires not dependencies, we will leave that section blank.


That's it! Your agent is created.


Now, go back and start a chat with Layla (make sure your agent is enabled, you can check the toggle is ON in the agents list).


When you mention "python", the code will execute, and the output is sent to the LLM!

Chat screen with a dark hexagon background. Text: "Run some python code!" Notification says, "Finished executing Python code."
Chat interface with hexagon pattern background. User says "Run some python code!" and AI responds "Hello from Python code!".

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating

Email

Location

Gold Coast, Australia

SUBSCRIBE

Sign up to receive news and updates from Layla

Thanks for submitting!

© 2026 by Layla Network

  • Discord
  • Youtube
  • TikTok
  • X
  • Facebook
bottom of page