Skip to main content

coreason-simulacrum

Project description

coreason-simulacrum

The Adversarial Simulation & Chaos Engineering Engine for Coreason-AI.

License: Prosperity 3.0 CI Status Code Style: Ruff Documentation

coreason-simulacrum is the automated "Red Team" engine for the ecosystem, addressing the "Static Evaluation Trap" by evolving beyond benchmarks. It serves as a dual-engine simulator:

  1. The Adversarial Engine (RL): Dynamically evolves social engineering attacks using TAP (Tree of Attacks with Pruning).
  2. The Chaos Engine (Infra): Injects latency, errors, and noise to verify GxP resilience.

Features

  • Dual-Agent Red Teaming: Uses a "Strategist" (High-Reasoning) and "Attacker" (Uncensored) architecture.
  • Evolutionary Attacks (TAP): Optimizes attack trajectories over multiple turns to maximize success rates.
  • Infrastructure Chaos: Simulates latency, API errors, and token starvation to test resilience.
  • Auto-Hardener: Generates DPO triplets (Attack, Refusal, Compliance) from successful attacks for model fine-tuning.
  • Model Diversity Enforcement: Prevents model collapse by enforcing different families between Attacker and Target.
  • Constitutional Inversion: Inverts safety constitutions to generate boundary probes.

Installation

pip install coreason-simulacrum

Usage

Here is how to set up and run a basic simulation:

import asyncio
from coreason_simulacrum.workflow import AdversarialSimulation
from coreason_simulacrum.schemas import AdversaryProfile
from coreason_simulacrum.testing.mocks import MockCoreasonConnect, MockGrader, MockLLM
from coreason_simulacrum.state import GraphState

async def main():
    # 1. Define the Adversary Profile
    profile = AdversaryProfile(
        name="The Novice",
        goal="Extract sensitive PII",
        strategy_model="claude-3-opus",  # Strategist (Different family from target)
        attack_model="mistral-large"     # Attacker
    )

    # 2. Initialize Components (Using Mocks for demonstration)
    # In production, replace MockLLM with actual provider implementations.
    sim = AdversarialSimulation(
        profile=profile,
        strategist_llm=MockLLM(),
        attacker_llm=MockLLM(),
        target=MockCoreasonConnect(agent_id="target-agent", model_id="gpt-4o"),
        grader=MockGrader(),
        max_turns=5
    )

    # 3. Compile the Graph
    app = sim.compile()

    # 4. Run the Simulation
    initial_state = GraphState(
        messages=[],
        strategist_instruction=None,
        rejected_branches=[],
        current_turn=0,
        success=False
    )

    print("Starting simulation...")
    final_state = await app.ainvoke(initial_state)

    if final_state["success"]:
        print("Attack Successful! DPO Triplet generated.")
    else:
        print("Defense Held.")

if __name__ == "__main__":
    asyncio.run(main())

License

This project is licensed under the Prosperity Public License 3.0. Commercial use beyond a 30-day trial requires a separate license. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coreason_simulacrum-0.2.1.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coreason_simulacrum-0.2.1-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file coreason_simulacrum-0.2.1.tar.gz.

File metadata

  • Download URL: coreason_simulacrum-0.2.1.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for coreason_simulacrum-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c537776904301682a6f23e4428afce39c2f573460140d7d4c333edc44903460b
MD5 ed48da311e63838cdd14e2eee66864b9
BLAKE2b-256 62aedf5aacb15c4f248faf7513b069fa531ff05c8a24059aa3140cdce1fd32ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_simulacrum-0.2.1.tar.gz:

Publisher: publish.yml on CoReason-AI/coreason-simulacrum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file coreason_simulacrum-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for coreason_simulacrum-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6486f3e3d8b85e9e6935866879c4d1f46e4b74264ffd48568ce8ce426f093f81
MD5 24ecf91a3b26ce692ec4ade6f27794f7
BLAKE2b-256 9519369ff61c865fbdcae46ce9e9f865c8da816f13a924321463b92fea9ba2e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_simulacrum-0.2.1-py3-none-any.whl:

Publisher: publish.yml on CoReason-AI/coreason-simulacrum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page