NOW LET US – AI RAG SaaS Studio TP.HCM
NOW LET US
Digital Product Studio
Back to news
DEV-TOOLS...2 min read

Launch an autonomous AI agent with sandboxed execution in 2 lines of code

Share
NOW LET US Article – Launch an autonomous AI agent with sandboxed execution in 2 lines of code

OnPrem.LLM introduces AgentExecutor, a powerful pipeline to create autonomous agents capable of executing complex tasks within a secure sandboxed environment, supporting both cloud and local LLMs.

from onprem.pipelines import AgentExecutor

This notebook demonstrates how to use the Agent pipeline from OnPrem.LLM to create autonomous agents that can execute complex tasks using a variety of tools.

The pipeline works with any LiteLLM-supported model that supports tool-calling:

Cloud: openai/gpt-5.2-codex, anthropic/claude-sonnet-4-5, gemini/gemini-1.5-pro Local: Ollama (ollama/llama3.1), vLLM (hosted_vllm/), llama.cpp (use OpenAI interface)

For llama.cpp: Use openai/<model_name> (e.g., gpt-oss-120b) as model parameter and then set env variable OPENAI_API_BASE=http://localhost:<port>/v1

The AgentExecutor

The AgentExecutor allows you to launch AI agents to solve various tasks using both cloud and local models. We will use anthropic/claude-sonnet-4-5 (cloud) and glm-4.7-flash (local) for these examples.

By default, the AgentExecutor has access to 9 built-in tools. You remove access to built-in-tools as necessary. You can optionally give the agent access to custom tools, as we’ll illustrate below.

The AgentExecutor is implemented using our coding agent, PatchPal, which you’ll need to install: pip install patchpal.

AgentExecutor.print_default_tools()

======================================================================
AgentExecutor Default Tools
======================================================================
These tools are used by default when enabled_tools=None:
1. read_file - Read complete file contents
2. read_lines - Read specific line ranges from files
3. edit_file - Edit files via find/replace
4. write_file - Write complete file contents
5. grep - Search for patterns in files
6. find - Find files by glob pattern
7. run_shell - Execute shell commands
8. web_search - Search the web for information
9. web_fetch - Fetch and read content from URLs
======================================================================
Customization Examples:
======================================================================
# Use defaults (all tools including shell):
executor = AgentExecutor(model='anthropic/claude-sonnet-4-5')
# Defaults but no shell access (safer):
executor = AgentExecutor(
model='openai/gpt-5-mini',
disable_shell=True
)
# Minimal tools:
executor = AgentExecutor(
model='openai/gpt-5-mini',
enabled_tools=['read_file', 'write_file']
)
# Web research only:
executor = AgentExecutor(
model='openai/gpt-5-mini',
enabled_tools=['web_search', 'web_fetch']
)

Examples

Let’s run through some examples for different scenarios.

Basic Calculator Example

In this introductory example, we will launch an agent to build a calculator module in Python.

By default, the agent will operate within the working_directory you specify (or the current folder if not working directory is specified). The agent cannot read or write outside the working directory.

Important Note: If the agent has access to the run_shell tool, it can potentially read or modify files outside of the working directory. For these reasons, you can either supply the disable_shell=True to remove shell access or sandbox=True, which runs the agent in an ephemeral container.

In this first example, we set sandbox=True. The example was run on Windows Subsystem for Linux (WSL) with PodMan installed.

executor = AgentExecutor(
    model='anthropic/claude-sonnet-4-5',
    sandbox=True
)
result = executor.run(
    task="""
    Create a simple Python calculator module with the following:
    - calculator.py with add, subtract, multiply, divide functions
    - test_calculator.py with pytest tests
    - All tests must pass
    """,
    working_dir='./calculator_project'
)
print(result)
© 2026 Now Let Us. All rights reserved.

Source: Hacker News

Advertisement
Ad slot ready: 5887729102

More in this category

EXPLORE TOPICS

Discover All Categories

Deep dive into the specific technology sectors that matter most to you.