IP Library Granted Patent US 12,393,676
Granted Patent B1
US 12,393,676 · App. 19/086,645 · Granted Aug 19, 2025

Secure code execution for artificial intelligence agents

Inventor: Andrew Morgan (Dublin, IE)
Assignee: Airia LLC
G06F21/53G06F21/563G06F21/606
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,393,676
App. No.
19/086,645
Granted
Aug 19, 2025
Kind
B1
Abstract

The system securely executes code blocks for artificial intelligence (AI) agents by creating nano sandboxes in which customer scripts execute. An input is received that causes an agent executor to execute an AI agent. The AI agent can be defined to include a code block for executing a customer script. To securely execute the customer script while preventing unauthorized access on an AI platform, the agent executor can create a nano sandbox in which the customer script of the code block will execute using read-only system resources and files. The agent executor can wrap the customer script in logic that seeds an input variable from a file in the nano sandbox. Execution results in writing to an output file, from which an output is retrieved and returned to the user device. The nano sandbox can then be destroyed.

Claims (55)

1. A method for securely executing code blocks for artificial intelligence (AI) agents, comprising:

receiving, from a user device, an input associated with an AI agent;

executing the AI agent by an agent executor, wherein the AI agent includes a code block for executing a customer script;

creating a nano sandbox for executing the customer script of the code block, including:

binding system resources as read-only to the nano sandbox;

binding a temporary directory to the nano sandbox; and

defining network access within the nano sandbox;

seeding an input variable within the nano sandbox for use with the customer script;

executing the customer script within the temporary directory of the nano sandbox, the customer script utilizing the input variable, wherein the execution of the customer script results in writing to an output file in the nano sandbox;

copying an output from the output file to a location outside of the nano sandbox; and

destroying the nano sandbox.

2. The method of claim 1 , wherein the customer script is a Python script that a customer assigns to the code block.

3. The method of claim 1 , wherein the input variable is generated by a prior an agent object of the AI agent that executes prior to the code block.

4. The method of claim 1 , wherein the input variable is retrieved from a read-only file included in the nano sandbox.

5. The method of claim 4 , wherein the read-only file includes the input received from a user device, and wherein a result based on the output is displayed at the user device.

6. The method of claim 1 , further comprising reading client data from a file in the nano sandbox, wherein the client data is used in executing the customer script.

7. The method of claim 1 , wherein a subprocess executes the customer script within the temporary directory.

8. The method of claim 7 , wherein the output and an error are written to the output file.

9. The method of claim 1 , wherein defining the network access includes enabling the network access.

10. The method of claim 1 , wherein creating the nano sandbox includes clearing environmental variables.

11. The method of claim 1 , wherein creating the nano sandbox includes dropping all Linux capabilities.

12. The method of claim 1 , wherein the customer script is wrapped in logic to seed the input variable and capture the output for writing to the output file.

13. The method of claim 1 , further comprising deploying a Python toolkit that is a Python webservice, wherein the Python toolkit creates the nano sandbox.

14. The method of claim 13 , wherein the Python toolkit includes an application programming interface (“API”) and a NuGet package, and wherein the agent executor utilizes the API to receive the output.

15. The method of claim 1 , wherein a user interface (“UI”) of an AI platform includes an option for adding the code block to the AI agent, wherein the UI includes a window for inserting the customer script into the code block.

16. The method of claim 15 , wherein the UI allows a user to at least:

select agent objects including a dataset, an AI model, and the code block;

connect the agent objects in a sequence for execution as the AI agent; and

simulate execution of the AI agent, wherein the simulated execution causes the creating and destroying of the nano sandbox as part of executing the code block.

17. The method of claim 1 , wherein creating the nano sandbox includes unsharing namespaces, wherein unsharing namespaces disables networks access and defining the network access enables the network access.

18. The method of claim 1 , further comprising placing, into the nano sandbox, a first read-only file that is used to seed the input variable and a second read-only file that is used to seed a customer data variable, wherein both the input variable and the customer data variable are used in the execution of the customer script.

19. A non-transitory, computer-readable medium containing instructions for securely executing code blocks for artificial intelligence (AI) agents, wherein the instructions are executed by at least one processor to perform stages comprising:

receiving, from a user device, an input associated with an AI agent;

executing the AI agent by an agent executor, wherein the AI agent includes a code block for executing a customer script;

creating a nano sandbox for executing the customer script of the code block, including:

binding system resources as read-only to the nano sandbox;

binding a temporary directory to the nano sandbox; and

defining network access within the nano sandbox;

seeding an input variable within the nano sandbox for use with the customer script;

executing the customer script within the temporary directory of the nano sandbox, the customer script utilizing the input variable, wherein the execution of the customer script results in writing to an output file in the nano sandbox;

copying an output from the output file to a location outside of the nano sandbox; and

destroying the nano sandbox.

20. A system for securely executing code blocks for artificial intelligence (AI) agents, the system comprising:

at least one physical non-transitory, computer-readable medium including instructions; and

at least one processor that executes the instructions to perform stages comprising:

receiving, from a user device, an input associated with an AI agent;

executing the AI agent by an agent executor, wherein the AI agent includes a code block for executing a customer script;

creating a nano sandbox for executing the customer script of the code block, including:

binding system resources as read-only to the nano sandbox;

binding a temporary directory to the nano sandbox; and

defining network access within the nano sandbox;

seeding an input variable within the nano sandbox for use with the customer script;

executing the customer script within the temporary directory of the nano sandbox, the customer script utilizing the input variable, wherein the execution of the customer script results in writing to an output file in the nano sandbox;

copying an output from the output file to a location outside of the nano sandbox; and

destroying the nano sandbox.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 21, 2025
From: MORGAN, ANDREW
To: AIRIA LLC
Reel/Frame 070588/0399 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 21, 2025
From: MORGAN, ANDREW
To: AIRIA LLC
Reel/Frame 070588/0758 →
References Cited (9)
US 20110029341A1 · Muse · 2011 [cited by examiner]
US 20180032384A1 · Chheda · 2018 [cited by examiner]
US 20180067790A1 · Chheda · 2018 [cited by examiner]
US 20210240818A1 · Seksenov · 2021 [cited by examiner]
US 20240098100A1 · Lal · 2024 [cited by examiner]
US 20240220619A1 · Divakaran · 2024 [cited by examiner]
US 20240241763A1 · Beveridge · 2024 [cited by examiner]
Denham et al., “Ransomware and Malware Sandboxing”, Oct. 2022, IEEE 13th Annual Ubiquitous Computing, Electronics & Mobile Communication Conference, pp. 0173-0179 (Year: 2022). [cited by examiner]
Benselloua et al., “Effective Malicious PowerShell Scripts Detection using DistilBERT”, Dec. 2023, IEEE Afro-Mediterranean Conference on Artificial Intelligence, pp. 1-6 (Year: 2023) [cited by examiner]
Cited By (2)
US 12,730,883 US 12,739,264