Newshot

I Build Engines Before I Build AI Agents?

Original text(via HN AI)

Stop Giving Cloud AI All the Work: Building Engine-Driven Agents for the Enterprise

I've been researching and building AI agents, particularly in the field of software testing. The more time I spend on engineering and real-world implementation, the more convinced I become of one architectural principle:

Don't hand every task to a cloud-based AI model. Build a local engine first, then use AI to make that engine more intelligent.

I would like to share some of my thoughts and discuss them with people working on similar problems.

1. Why Not Just Give a Website to an AI and Let It Test Everything?

With the capabilities of modern multimodal models, this sounds entirely reasonable.

Give an AI access to a browser, let it navigate through pages, take screenshots, understand interfaces, interact with elements, and report defects.

But what happens when this approach is scaled from an impressive demonstration to a production-grade testing system that runs thousands of tasks every month?

The model repeatedly observes the screen, interprets page states, decides what to do, executes an action, and observes the result again.

Many of these operations do not require intelligence. They require reliable execution, accurate state detection, and deterministic verification.

Why should we pay a large language model to repeatedly perform work that a well-designed local engine can handle more efficiently?

The ability to perform a task does not necessarily make an AI model the most appropriate or economical component for performing it.

2. A Broader Vision: Three Types of AI Agents

I have been thinking about three types of agents that could provide substantial long-term value to an organization.

None of them should rely entirely on cloud AI.

Advertising and Campaign Optimization Agent

Architecture: Local engine + locally hosted AI model.

The local engine handles data collection, normalization, attribution, metric calculation, rule-based decisions, and authorized campaign operations.

The local model handles interpretation, trend analysis, strategy evaluation, and more complex decision-making.

The reason for local deployment is straightforward: sensitive business data, financial information, and proprietary strategies should remain within the organization's infrastructure.

Before designing such a system, I believe the AI should conduct structured interviews with the marketing and operations teams through a comprehensive questionnaire.

It needs to understand existing workflows, business objectives, available data, operational constraints, budgets, approval mechanisms, and acceptable levels of risk.

Building an agent before understanding the business it is supposed to serve is an architectural mistake.

Software Testing Agent

Architecture: Local engine-driven execution + cloud AI as the reasoning layer.

This is the area I have actually been researching and implementing.

The local engine handles deterministic operations, protocol interactions, browser automation, visual feature extraction, state recognition, execution, and result verification.

Cloud AI is introduced when the system encounters unfamiliar situations, complex interactions, ambiguous information, or problems requiring semantic understanding and reasoning.

I think of cloud AI as the nervous system rather than the entire body.

The engine should be capable of performing routine work independently. AI should extend its capabilities rather than replace every component.

The objective is not to eliminate traditional automation. It is to overcome its limitations without inheriting all the costs and uncertainties of model-driven automation.

Workplace Collaboration Agent

Architecture: Central AI + distributed conversation collection + organizational memory.

Imagine an organization where employees already use different AI tools in their daily work.

With appropriate consent and access controls, relevant work-related conversations could be synchronized with a central AI system.

The central agent could understand project progress, identify dependencies between departments, detect conflicting requirements, recognize duplicated work, and preserve valuable knowledge.

An initial implementation could be relatively simple: conversation synchronization, classification, summarization, and retrieval.

Over time, the system could introduce locally hosted models, curated organizational knowledge, long-term memory, and domain-specific training where justified.

The eventual goal would be an organizational AI hub.

However, conversations must not automatically be treated as facts. The system needs to distinguish between speculation, AI-generated suggestions, verified findings, and approved business decisions.

Privacy, employee consent, departmental access boundaries, and information retention policies must also be fundamental architectural requirements.

At every stage, the operational cost should be evaluated against the actual value delivered.

The Connection Between These Three Agents

These should not become three completely isolated systems.

They could share a common infrastructure:

  • Model routing and inference services.
  • Local execution engines.
  • Knowledge bases and long-term memory.
  • Task scheduling and resource management.
  • Data collection and normalization.
  • Permission management and security controls.
  • Monitoring, auditing, and evaluation systems.

The long-term objective is not simply to build several agents.

It is to establish an AI infrastructure upon which an organization can continuously build new capabilities.

3. The Three Pillars

My current architectural philosophy is based on three pillars.

First, deterministic rule engines are indispensable.

Not every problem requires probabilistic reasoning. When an operation can be defined, measured, and verified deterministically, an engine should handle it.

Second, cloud AI cannot always be avoided.

There are situations where powerful cloud models provide capabilities that are difficult or expensive to reproduce locally.

The objective should not be to eliminate cloud AI at all costs, but to eliminate unnecessary inference.

Third, locally hosted models are essential when sensitive data cannot leave the organization.

Organizations should retain control over their data, knowledge, and critical decision-making infrastructure.

Local deployment does not automatically guarantee security, but it provides greater control over data boundaries when properly implemented.

4. Why Not Let One Powerful Cloud AI Handle Everything?

I see five major problems with this approach.

Inference Costs

Repeatedly sending screenshots, page structures, logs, execution histories, and contextual information to cloud models can become extremely expensive at scale.

Data Exposure

The more work an external model performs, the more internal information may need to leave the organization's infrastructure.

External Dependencies

Usage limits, service interruptions, latency, pricing changes, and model availability can directly affect business operations.

Probabilistic Decisions Affecting Real Money

A model's interpretation or assumption can become a financial loss if it is allowed to execute consequential operations without deterministic validation.

Loss of Control Over Organizational Knowledge

An organization should own the knowledge it accumulates.

If its operational intelligence exists primarily inside external AI conversations or proprietary platform-specific workflows, migrating away from those services becomes increasingly difficult.

The organization should own its rules, verified knowledge, evaluation datasets, and execution infrastructure.

Models should be replaceable components.

5. The Economics of AI Agents

This is probably the most important part of the discussion.

Consider a large-scale testing system that relies entirely on cloud AI.

Every browser interaction, screenshot interpretation, state transition, and subsequent decision may require another model invocation.

Under a sufficiently demanding workload, monthly inference costs could exceed $40,000.

Now consider an alternative architecture.

A local engine handles routine execution, extracts relevant information, recognizes known states, and performs deterministic verification.

Cloud AI is invoked only when genuine reasoning is required.

If this architecture reduces cloud inference expenditure to approximately 5% of the original amount, the economics change dramatically.

ArchitectureEstimated Monthly Inference CostEstimated Annual Inference Cost
Fully cloud-driven AI$40,000$480,000
Engine-driven hybrid AI$2,000$24,000

Under these assumptions, annual cloud inference savings could exceed $380,000, even after allowing some room for additional infrastructure expenditure.

These figures are illustrative estimates, not universal benchmarks. Actual savings depend on workload, model pricing, image resolution, context size, invocation frequency, caching, hardware, and engineering costs.

But the architectural point remains:

Why repeatedly purchase intelligence for operations that do not require intelligence?

More importantly, reducing model involvement does not necessarily mean sacrificing testing quality.

A hybrid architecture can potentially deliver better reliability, reproducibility, and verification accuracy while using significantly fewer tokens.

That improvement, of course, must be demonstrated through controlled evaluations rather than assumed.

6. Intelligence Is Not the Same as Reliability

Imagine a model that is correct 99% of the time.

That sounds impressive until the model is responsible for verifying financial transactions.

Even if that accuracy were genuinely measured, a 1% error rate could be unacceptable in a critical verification system.

An AI model can investigate an anomaly, explain a discrepancy, or propose a possible cause.

But the final verification of a financial operation should depend on deterministic invariants, authoritative records, and explicitly defined business rules.

A rule engine can still contain bugs. The difference is that its behavior can be inspected, reproduced, tested, and corrected systematically.

I do not want an AI to tell me that a financial result probably looks correct.

I want the system to demonstrate why it is correct.

7. A Rather Naive Suggestion: Why Not Ask AI to Generate the Entire Engine?

Occasionally, someone unfamiliar with the engineering involved suggests that we could simply ask an AI to generate the entire engine.

I find this suggestion rather naive, and frankly, somewhat dismissive of the engineering work behind such systems.

AI can certainly help write code, improve implementations, and accelerate development.

But generating code is not equivalent to discovering the correct rules.

Behind a mature engine are rules learned from real defects, unexpected system behavior, costly failures, and countless late nights investigating problems that were never documented in advance.

Many of these rules exist because reality repeatedly contradicted our original assumptions.

An AI can implement a rule once we understand it.

Discovering why that rule needs to exist is an entirely different problem.

The source code is not necessarily the most valuable part of an engine. The accumulated engineering knowledge behind it is.

8. Why Is Building a Local Engine So Difficult?

The difficulty is not simply writing automation scripts.

It is building a system that remains reliable when reality does not behave as expected.

A production-grade engine must deal with:

  • Incomplete, delayed, duplicated, or contradictory information.
  • Asynchronous events and unpredictable state transitions.
  • Dynamic interfaces and changing interaction patterns.
  • Temporary failures that resemble permanent defects.
  • Valid but previously unseen behavior.
  • External dependencies that change without notice.
  • Concurrent operations and race conditions.
  • Recovery mechanisms that must not introduce additional errors.
  • False positives and false negatives.
  • Continuous changes to the systems being observed.

One of the hardest problems is distinguishing between a genuine defect and a limitation of the engine itself.

If an engine fails to understand a situation, that does not automatically mean the system being tested is defective.

Likewise, successfully completing an operation does not prove that the underlying business result is correct.

Every new rule also introduces the possibility of interfering with existing behavior.

A rule that solves one problem may create three others.

This is why regression testing, evidence collection, observability, and carefully controlled learning mechanisms are essential to the engine itself.

A mature engine is not built once.

It evolves through continuous confrontation with reality.

9. Resource Management: What Should an Agent Forget?

Another problem that I believe receives insufficient attention is resource management.

Every execution generates resources:

Temporary files, screenshots, logs, browser sessions, intermediate results, cached responses, execution traces, and model context.

Once a task finishes, unnecessary resources should be released or removed according to appropriate retention policies.

However, the knowledge gained during execution must survive.

The next execution should be faster, more accurate, or more efficient because of what the system has previously learned.

If we clean up too little, the system will eventually drown in accumulated garbage.

If we clean up too much, every execution becomes a cold start.

I believe an agent needs to distinguish between at least four categories of information:

  • Temporary execution resources: disposable after the task completes.
  • Diagnostic evidence: retained according to debugging, auditing, and compliance requirements.
  • Reusable operational knowledge: preserved to improve future executions.
  • Unverified observations: isolated until they can be validated.

Not everything an agent observes deserves to become permanent knowledge.

Incorrect learning can be more damaging than no learning at all.

The challenge is not merely giving an agent memory. It is teaching the system what deserves to be remembered, what needs verification, and what should be forgotten.

10. Final Thoughts

I do not believe the future of enterprise AI is necessarily a single enormous model controlling everything.

I believe it is more likely to involve specialized engines, deterministic execution, local intelligence, selectively invoked cloud models, and shared organizational knowledge.

The most powerful model is not always the most appropriate component.

The most autonomous system is not always the most reliable one.

And the system that consumes the most tokens is not necessarily the most intelligent.

My preferred direction is to build systems that become progressively more capable through engineering, real-world execution, verified learning, and continuous improvement.

I would be interested in hearing from others who are building production-grade AI agents.

  • Where do you draw the boundary between deterministic execution and AI reasoning?
  • How much of your agent's workload genuinely requires a language model?
  • Have you measured the cost difference between fully model-driven and engine-driven architectures?
  • How do you prevent an agent from learning incorrect information?
  • How do you manage long-term knowledge without accumulating excessive operational data?
  • Do you believe enterprises should own their agent infrastructure rather than depend entirely on external AI platforms?

Perhaps the next major challenge in AI engineering is not making models do more work, but designing systems that know when a model is actually needed.

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗