Search as Code: Perplexity rewrites AI search

From fixed API to programmer agent: a paradigm shift

For years, AI-based search systems followed a rigid pattern. A language model received a query, called a predefined search API and returned the results. The process was linear, but also limited. Fixed APIs can't adapt dynamically to the complexity of a request. As a result, the model had to work with standardized outputs, often redundant or off-target.

Perplexity has flipped this logic with Search as Code. In this new paradigm, the AI agent doesn't call an external API. Instead, it writes the Python code needed to build its own search pipeline. The model decides on its own how to filter data, remove duplicates and aggregate sources. It all happens inside an isolated, controlled sandbox environment.

This approach is close to the logic of tool-use agents, but it goes further. Rather than using predefined tools, the agent becomes the author of its own tools. In short, it's a qualitative leap in the reasoning ability and autonomy of language models applied to search.

Inside the architecture: how the Python sandbox works

At the heart of Search as Code is a secure execution environment. The AI agent generates Python code that runs in a sandbox with controlled access to external resources. This lets the system query diverse sources, apply custom filtering logic and deduplicate results before passing them back to the main model.

According to The Decoder, the system cuts token consumption by up to 85% compared with equivalent OpenAI and Anthropic architectures. That's a significant figure. Token costs are one of the biggest expenses for anyone running AI pipelines at scale.

The system also outperforms the sector's reference benchmarks. This suggests that the flexibility of a dynamically generated pipeline delivers better-quality results than static approaches. In particular, built-in deduplication reduces informational noise and improves the accuracy of the final answers.

To dig deeper into the architectural implications of autonomous AI agents, see Gartner's analysis of how AI agents are evolving and the research by MIT Technology Review on emerging architectures.

Real-World Use Cases for Italian SMEs

The most relevant question for an Italian SME isn't technical. It's operational: does this technology change anything in my processes today? The answer depends on the industry and on the company's digital maturity.

In B2B retail, for example, a Search as Code agent could build fully automated pipelines to monitor supplier prices and availability. Instead of relying on rigid scrapers or costly commercial APIs, the agent writes its own data-collection code. The system then adapts dynamically to changes in sources, with no manual intervention.

In digital marketing, the applications are just as interesting. An agent could build research pipelines for competitive analysis, aggregating data from different sources with custom filtering logic. At SHM Studio, we see this approach as a natural evolution of artificial intelligence applied to marketing tools.

In professional services, custom search pipelines can also support due diligence, regulatory monitoring and market analysis. The value isn't just in cost savings, but in the quality and relevance of the information collected.

For companies weighing how to integrate these capabilities, the starting point is often a review of their digital marketing strategy and existing information flows.

Comparing OpenAI and Anthropic: where the difference lies

OpenAI and Anthropic offer agentic search solutions through tools like function calling and tool use. However, these approaches remain tied to predefined patterns. The model chooses which tool to use, but can't change how it works internally.

Perplexity's Search as Code brings a higher level of flexibility. The agent doesn't pick from existing tools. It builds the tool best suited to the specific need. From an engineering standpoint, that difference is substantial.

On costs, the advantage is already quantified: up to an 85% reduction in token consumption. For a company handling large volumes of AI queries, that means real operating savings. Likewise, less informational noise improves output quality and lowers the cost of manually checking results.

Still, it's important not to overstate the comparison. OpenAI and Anthropic have more mature ecosystems, with established enterprise integrations. So the choice between platforms depends on each organization's specific context. For an in-depth look at competitive dynamics in AI, see Harvard Business Review's analysis of enterprise AI.

Trade-offs and risks to consider

Every innovative architecture comes with trade-offs, and Search as Code is no exception. The first critical issue is sandbox security. Letting an AI agent write and run Python code introduces security risks that need careful management. Perplexity says it has implemented robust controls, but the attack surface remains larger than with fixed APIs.

The second trade-off is reproducibility. A dynamically generated pipeline can produce different results on every run. That can be an advantage for adaptability, but it becomes a problem where outputs must be deterministic and auditable.

Operational complexity also grows. Running a system where code is generated and executed on the fly takes specific technical skills. For SMEs without a structured IT team, this can be a barrier to adoption. So it's essential to assess your own technological maturity before moving ahead with integration.

Finally, relying on a single vendor remains a strategic risk. Depending on Perplexity for a critical part of your information pipeline exposes your company to changes in pricing, policy or service availability. A balanced AI strategy always includes a contingency plan.

Work still in progress: what's missing for enterprise adoption

Search as Code is a promising technology, but it isn't yet mature enough for widespread enterprise adoption. Several aspects are still undefined. First, agent governance: who is responsible for AI-generated code? How do you manage the audit trail in regulated environments?

Second, there are no interoperability standards. Today, a pipeline built with Perplexity's Search as Code can't easily be ported to other systems. So companies that adopt this technology implicitly accept a degree of lock-in.

Even so, the direction is clear. The AI industry is moving toward increasingly autonomous agents that can build their own tools instead of using predefined ones. This shift will have far-reaching implications for automated advertising campaigns, for SEO and for content production.

Our recommendation: how to find your bearings today

For an Italian SME looking to evaluate Search as Code, we recommend a gradual approach. First, map your information flows and identify where rigid search pipelines create bottlenecks. Then, consider a pilot project built around a specific, low-risk use case.

In particular, companies that already use AI agents in their processes are best placed to experiment with this technology. If you're still in the early stages, it's wiser to shore up the fundamentals first: a solid web presence, a structured SEO strategy and optimized LinkedIn and Google Ads campaigns.

At SHM Studio, we follow the evolution of these technologies with an analytical eye. Our approach never changes: assess the real impact before recommending adoption. To explore how these innovations can fit into your company's digital strategy, our team is available through the contact page. You can also follow the key developments in AI and digital marketing on our blog.

Related articles

Discover more articles exploring similar topics, selected to offer you a more complete and stimulating perspective. Each piece of content is carefully chosen to enrich your experience.

The interior of an industrial facility showcases large metal pipes, tanks, and catwalks. A reflective surface shines in the foreground under bright lighting, a setting where SHM Web Agency could accurately deploy a website.

Super-amortization 2026 and the end of Transition 5.0: a guide for businesses

Discover more
GEO for e-commerce marketing

E-commerce marketing and GEO: how to get cited in Google AI Overviews

Discover more
brand positioning

Brand positioning in the AI era: how to stay visible in generative search engines

Discover more
strategic digital consulting

Strategic digital consulting for SMEs: complete guide 2026

Discover more
privacy and artificial intelligence

Data privacy and artificial intelligence: what SMEs and professionals can really do without exposing themselves to unnecessary risks

Discover more
AI marketing tools

The best AI marketing tools of 2026: how to leverage them for automation, communication, and advertising

Discover more
Generative engine optimization

From SEO to GEO: 2026 guide to getting found on Google AI Overviews and ChatGPT

Discover more
Custom AI chatbots

Custom AI chatbots: a complete guide for SMEs and businesses

Discover more
Google Workspace Intelligence: AI automation for B2B business

B2B LinkedIn Ads campaigns: when it beats Meta and Google

Discover more
google ads campaigns

Google Ads campaigns for SMEs: when it's really worth investing

Discover more
website creation

Website creation with AI: pros, cons, and real advantages for companies

Discover more
AI marketing

AI marketing: artificial intelligence in your company's strategy

Discover more
AI-powered presentations

AI-powered presentations: how to go from scattered documents to client-ready slides

Discover more
technology experts in Milan

Tech Experts in Milan: The Best IT Choices for AI

Discover more
Illustration on artificial intelligence for SMEs and 2026 digital tools

Artificial intelligence for SMEs: the most useful tools in 2026

Discover more
best ai consultants milan

The best AI consultants in Milan specialized for startups: the strategic selection of 2026

Discover more
Startup launch in Milan

Startups in Milan: the essential checklist for launching your digital project in 2026

Discover more
Artificial intelligence for startups

Artificial intelligence for startups and SMEs in 2026: the 10 mistakes to avoid on your first project (with operational checklist)

Discover more
Best web agencies in Milan in 2026

The best web agencies in Milan in 2026: updated guide for SMEs and companies

Discover more
A single LED light bulb with a silver screw base by SHM Studio is placed on a simple white surface, embodying the precision needed to effectively position a website.

The 10 best AI SEO tools in 2026: the definitive guide to scaling the SERP and dominating search engines

Discover more
Marketing agency Milan

Marketing agency in Milan: guide to choosing the most suitable one

Discover more
Illustration of a digital marketing agency in Milan and the required professional roles

Marketing communications agency in Milan: the most in-demand roles

Discover more
Illustration on artificial intelligence startups in Milan and technological innovation

Artificial Intelligence in Milan: the best startups to know

Discover more
Illustration on artificial intelligence startups in Milan and technological innovation

Artificial intelligence companies: the future of work between innovation and automation

Discover more
Illustration on artificial intelligence in companies, customer experience, and chatbots

Artificial intelligence in companies between customer experience and chatbots

Discover more
Illustration with social communication strategies for companies in 2026 and digital platforms

Social Communication: 20 Strategies for 2026

Discover more
Local SEO

The 13 winning techniques for Local SEO in 2026

Discover more
The bright azure swimming pool, reminiscent of a well-conceived SEO strategy, features a yellow bridge and a metal ladder on the right.

SEO strategy: the importance of media, video, and images

Discover more
web agency Milan

The best Web Agencies in Milan in 2025

Discover more
A solitary tree stands on a snowy landscape under an overcast sky, like a distinctive icon meticulously positioned by a web agency for optimal visibility.

Optimize your website: the best tools for 2026

Discover more
WordPress consulting

WordPress consulting: when a web agency is necessary

Discover more
SHM Studio: blog on digital marketing and AI

Storytelling in digital communication

Discover more
marketing agency

Marketing and AI agency: a practical guide to the tools

Discover more
SHM Studio: blog on web, SEO, and AI marketing

SEO consulting in Milan: the best choices of 2025

Discover more
web agency Rome

Rome web agency: the best choices of 2026

Discover more
rank a website

Positioning a website in 2026: operational checklist in 10 points

Discover more
communication and marketing agency

Communication and marketing agency: how to choose the best one

Discover more
web consulting

Strategic web consulting: complete guide for Italian companies

Discover more
graphic design agency

Graphic design agency: a complete guide to choosing well

Discover more
logo design studio

Successful logo design: what to ask designers

Discover more
web consulting

Web consulting or DIY: when to call an expert?

Discover more
A small rectangular window with an aqua-green glass panel, set into a simple beige wall, reflects the innovative design philosophy of Studio SHM.

Websites for architects: what's essential

Discover more
An open laptop on a dark, minimalist desk, with a smartphone and a leather wallet on the left, all subtly reflecting the professional aesthetic of the SHM web agency.

SEO Analysis: 5 indispensable tools

Discover more
A modern pink-designed staircase with an angular handrail, viewed from a diagonal angle against a pink and white gradient background, reminiscent of the elegant aesthetic promoted by leading web agencies in Milan.

Company Brochures: 7 Tips for Effective Creation

Discover more
brands and logos

Brands and Logos: what's the difference?

Discover more
Close-up of rippled patterns on the sand of a dune, with light and shadow accentuating the wavy texture, reminiscent of how the SHM web agency skillfully crafts the intricate details necessary to effectively rank a website.

Quote for a website in 2024: how much does it cost?

Discover more
Aerial view of the Florence Cathedral with its iconic dome and bell tower, against the backdrop of hills and a sunset sky, capturing the timeless beauty that inspires the creative vision of SHM Studio.

The ten best web agencies in Florence in 2026

Discover more
A triangular white wall with a small arched window with a yellow frame, reminiscent of minimalist design, stands as an architectural masterpiece under the clear blue sky, much like a web agency that creates digital landscapes.

Progressive Web Apps: definition and benefits

Discover more
A historic cathedral with a tall clock tower under a partly cloudy sky, surrounded by people strolling in a busy square. Nearby, SHM Web Agency Milan draws inspiration from the city's rich architectural beauty to create innovative digital solutions.

The ten best web agencies in Modena in 2024

Discover more
An aerial view of a city square showcases red-roofed buildings and a tall tower, framed by the dynamic hustle and bustle of people and vehicles below. Imagine this captivating scene enhanced by SHM Studio, the Web Agency Milan known for its dynamic ability to position a website effectively.

The 10 best Web Agencies in Bologna in 2024

Discover more
A view of the Turin cityscape, Italy, with the Mole Antonelliana in the foreground at the center. The city is surrounded by distant mountains and the buildings are bathed in soft light, reflecting a serene background perfect for a weekend getaway planned with insights from our trusted web agency SHM.

The 10 best Web Agencies in Turin in 2024

Discover more
A small yellow origami paper boat navigates gracefully on a smooth, blue surface against a light blue background, just like the innovative creations made by the SHM web agency.

Graphics for websites: everything you need to know

Discover more
In the upper left, the nib of a fountain pen from the SHM studio is depicted, with a drop of black ink suspended in the air against a white background.

SEO Copywriting: the best tools on the market

Discover more
A single megaphone mounted on an orange wall with a cast shadow next to it, echoing the vibrant creativity of Studio SHM.

Complete guide to SEO in 2024

Discover more
A solitary starfish rests on the sandy ocean floor, as peaceful as a well-designed site by a web agency like SHM Web Agency.

SEO for ecommerce: a complete guide

Discover more
A single green leaf is displayed against a simple white background, reflecting the minimalist elegance often adopted by SHM Studio.

Web Agency in Milan: the 10 best for SMEs and businesses

Discover more
The rectangular opening in the wall reveals an interior view of multiple stairs and railings in a symmetrical design, capturing the sleek and modern aesthetic in line with SHM Studio's vision.

Ecommerce development in Milan: Muchidecor

Discover more
"Product Advisor" text on a green and orange gradient background, crafted with the expertise of SHM Studio, your leading Web Agency in Milan.

Case study of a Milanese web agency

Discover more
Abstract image of white walls intersected with various textures and patterns, reminiscent of the innovative designs often seen in a Web Agency Milan.

Keywords with Google search, the Keyword planner

Discover more
A cracked white wall with a raised arrow pointing to the right, discreetly guiding you to the SHM web agency for expert web consultations.

Website optimization crucial for ranking

Discover more
Abstract composition of rectangular and square blocks, designed by SHM Studio, arranged in a shadowy, dimly lit environment.

Is link building still a decisive factor for SEO?

Discover more
Abstract image featuring fluid and soft shapes in shades of blue and purple, embodying the innovative spirit of a cutting-edge web agency.

SEO Agency Milan: the complete guide to reaching the first page

Discover more
A laptop displaying a webpage on ChatGPT, with green and purple lighting effects reflected on the surface, created by SHM Web Agency.

How to leverage AI for web marketing?

Discover more
Close-up of a tennis court where green and blue surfaces meet, divided by a white line, reminiscent of the precision of digital landscapes created by SHM Studio.

Website creation in Milan? Defeat your competitors

Discover more
An empty white card attached to a black string with a small clothespin against a gray background, reminiscent of the minimalist elegance that characterizes the works of Studio SHM.

Communication agency in Milan, express the strength of your brand

Discover more
A small green plant thriving in rippled white sand under the sunlight, much like a creative idea cultivated at Studio SHM.

Web agency Milan: boost your brand

Discover more