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.1.0.tar.gz (19.0 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.1.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coreason_simulacrum-0.1.0.tar.gz
  • Upload date:
  • Size: 19.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 176e0f201d438eaddf7c1fb22d4a4792d8d03dcc08da2fd36ed5f85af1d23b0a
MD5 4faad93eeb52e3e1b8f38c8cc6f14fcc
BLAKE2b-256 5d093447130c33be999e295b0dc375db2c94bbd594929fb511a73577d2deec33

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_simulacrum-0.1.0.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for coreason_simulacrum-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efd0ec5fa5d97d313ba1e8698e08177cb9950cfc98bd5e166a7d7168a931344d
MD5 102b66c10419bf353a94f6123d6f50a4
BLAKE2b-256 6d6323f048099974df6579cf778ef0d07dd2c47da17f09fb34277db24f256c85

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_simulacrum-0.1.0-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