Dev.to AI πŸ€– Ai πŸ‘ 2 πŸ“– 4 min read

Building Safer AI Agents: 250 Actions Tested with Deterministic Validation

Large language models can reason, plan, and propose actions. But should they be allowed to directly change a system's state? In our research, we built MACSWC (Multi-Agent Conflict Simulation With World Constraints), a f

Large language models can reason, plan, and propose actions. But should they be allowed to directly change a system's state?

In our research, we built MACSWC (Multi-Agent Conflict Simulation With World Constraints), a framework that separates AI reasoning from execution.

Instead of allowing LLM agents to modify the environment directly, every action must pass through a validation pipeline.

We evaluated the framework using 250 proposed actions across 50 simulation rounds.

The Problem with Autonomous AI Agents

LLMs can generate invalid JSON, hallucinate entities, propose unsupported actions, or make decisions that conflict with existing rules.

In a chatbot, these errors may produce an incorrect response.

In an autonomous system, they can corrupt a shared environment.

Imagine an AI agent controlling a simulated country. It might propose an alliance with a nonexistent country or a military action that violates the simulation's rules.

If the model can execute that proposal without validation, the error becomes part of the world state.

We wanted to prevent this by separating what an AI agent proposes from what the system actually executes.

How MACSWC Works

MACSWC uses a geopolitical simulation inspired by the Second Balkan War.

Five country agents represent Bulgaria, Serbia, Greece, Romania, and the Ottoman Empire.

They can propose diplomatic, military, and economic actions, but they cannot change the simulation directly.

The framework has four main components.

1. Country Agents

Each country agent receives information about the current world state and generates a strategic proposal using an LLM.

Proposals may involve alliances, peace negotiations, sanctions, trade agreements, or military decisions.

The generated proposal is not executed immediately.

2. Secretary Agent

The Secretary Agent checks whether the proposal is structurally valid.

It verifies:

  • JSON structure
  • Required parameters
  • Supported action types
  • Valid target countries
  • Compliance with the registered rules

Malformed or unsupported actions are rejected.

3. Board Agent

Proposals that pass structural checks move to the Board Agent.

It evaluates strategic benefit and geopolitical risk using a simplified utility model.

Actions that do not meet the approval threshold are rejected.

4. World Engine

The World Engine maintains the authoritative simulation state.

It manages countries, diplomatic relationships, alliances, conflicts, sanctions, and treaties.

Only the World Engine can apply approved state changes.

Before execution, it performs a final consistency check.

The core principle is that LLMs propose actions while trusted software validates and executes them.

The Decision Pipeline

Each simulation round follows the same sequence:

  1. The World Engine provides the current state.
  2. Country Agents generate proposals.
  3. The Secretary Agent performs structural validation.
  4. The Board Agent evaluates strategic value and risk.
  5. The World Engine checks and executes approved actions.
  6. The updated state becomes the input for the next round.

This separation prevents LLM-generated actions from directly controlling the environment.

Implementation

We implemented the framework in Python using:

  • Python 3 for the core system
  • NetworkX for diplomatic relationship graphs
  • JSON for persistent world-state storage
  • LLM provider interfaces for model-independent reasoning
  • Deterministic validation for rule enforcement

The framework supports multiple LLM providers, including OpenAI, Groq, Hugging Face, and Ollama, through a shared interface.

The experiment focused on architectural reliability rather than historical prediction accuracy.

Experimental Results

We ran 50 simulation rounds and recorded the following results:

Metric Result
Simulation rounds 50
Actions generated 250
Actions accepted 201
Secretary Agent rejections 31
Board Agent rejections 18
World Engine rejections 0

49 out of 250 actions were rejected before execution, representing 19.6% of generated proposals.

The Secretary Agent rejected 31 proposals for structural or rule-related issues.

The Board Agent rejected another 18 after strategic evaluation.

The World Engine recorded zero rejections in the reported experiment.

The paper reports that the simulation maintained a consistent world state throughout the tested rounds.

These results demonstrate the behavior of the framework in this specific experiment, not a universal guarantee that all unsafe actions can be prevented.

Why This Matters Beyond Simulations

The underlying principle is relevant to production AI agents.

Consider an AI system that can:

  • Update customer records
  • Change financial workflow states
  • Trigger business processes
  • Interact with external applications

Letting an LLM directly execute its own proposals creates risks when the model produces invalid or unexpected actions.

A safer design separates three responsibilities:

Reasoning: The AI decides what action it wants to propose.

Validation: Trusted code checks permissions, constraints, and business rules.

Execution: The application performs approved actions through controlled interfaces.

Our paper tested this approach in a geopolitical simulation. Applying it to business systems would require additional security controls and evaluation.

Limitations

The experiment used one historical scenario, five country agents, 50 rounds, and 250 generated actions.

It did not establish universal AI safety guarantees or provide a controlled failure-rate comparison against every major multi-agent framework.

Larger simulations, additional scenarios, and human-in-the-loop oversight are directions for further research.

Conclusion

MACSWC explores how autonomous AI agents can make strategic decisions without having unrestricted control over a persistent environment.

Across 250 generated proposals:

  • 201 were accepted.
  • 49 were rejected before execution.
  • The reported simulation maintained a consistent world state.

The main lesson: AI agents should propose actions, while trusted software controls what actually gets executed.

Original Research

Paper: MACSWC – Multi-Agent Conflict Simulation With World Constraints

Authors: Borjan Ladinski, Dusko Sofronievski, and Marija Stankova Medarovska.

Conference manuscript: International Conference on Computer Sciences (IHCONCS 2026), Zagreb, Croatia.

Read the full technical article:

https://borjan.ladinski.com/articles/safer-ai-agents-deterministic-validation/

About the Author

I'm Borjan Ladinski, an AI Engineer, AI Expert, and AI Consultant based in Skopje, North Macedonia.

I build AI agents, LLM applications, RAG systems, machine learning solutions, and Python backend systems.

Explore my projects and AI consulting services:

https://borjan.ladinski.com/ai-consultant-north-macedonia/

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.