Self-Evolving Agentic Security Systems: From Model Capability to Harness Optimization

    In complex software security tasks, outcomes depend not just on a model's reasoning ability, but on how the entire system organizes reasoning, allocates tasks, invokes tools, and adapts strategy after failures. This article explains why the real optimization target is the agent's Harness—the task orchestration and execution layer surrounding the model—and covers task decomposition, role topology, layered memory, automated workflow search, feedback-driven evolution, evaluation metrics, and the safety boundaries required for engineering deployment.

    Self-Evolving Agentic Security Systems: From Model Capability to Harness Optimization

    In complex software security tasks, what truly determines effectiveness is often not just whether the model “can reason,” but how the entire system organizes reasoning, allocates tasks, uses tools, and adjusts its next-round strategy based on failures.

    So rather than saying an agent suddenly acquired vulnerability scanning capability, it is more accurate to say the Harness behind the agent has gained the ability to optimize itself. Here, the Harness refers to the complete task orchestration and execution mechanism built around the model, including role assignment, context management, tool scheduling, result verification, state recording, error recovery, and strategy iteration.

    1. The Core Problem: Shifting the Optimization Target from Model to System

    Discussions about agents have traditionally focused on questions like: Is the model large enough? Is the context window long enough? Is code comprehension accurate? Are tool calls stable? Is the reasoning chain deep enough?

    These factors certainly matter, but in complex tasks like vulnerability discovery, improving model capability alone does not solve everything. The reason is that vulnerability discovery is not a one-shot Q&A—it is a long pipeline with multiple stages:

    1. Understanding the structure and functionality of the target program;
    2. Identifying input boundaries, state transitions, and key constraints;
    3. Designing test data or execution paths;
    4. Running the program and collecting feedback;
    5. Analyzing abnormal behavior, coverage, and runtime logs;
    6. Determining whether anomalies are real and reproducible;
    7. Adjusting the next round of exploration based on results.

    If a single agent completes all of these stages within one context, obvious structural problems emerge.

    First, information overload. An instrumented program may continuously produce large volumes of logs, execution traces, coverage data, and error output. Not all of this content is equally important, but without effective filtering, the model must sift through massive low-value information to find a few critical clues.

    Second, context interference. Source code analysis, test generation, anomaly judgment, and strategy planning are different types of cognitive tasks. Mixing them in a single reasoning chain makes it easy for key conclusions to be buried under intermediate noise, or for an incorrect judgment in an earlier stage to contaminate every subsequent step.

    Finally, strategy concentration risk. A single execution trajectory usually represents only one hypothesis. If that hypothesis is wrong, the entire process can remain stuck on a low-value direction for a long time, unable to switch to alternative exploration paths.

    Therefore, the bottleneck in complex agentic systems is not always that “the model isn’t smart enough”—it may be that “the system hasn’t placed the model in the right position.”

    2. What Exactly Does the Harness Optimize?

    An evolvable Harness does not optimize a single prompt; it optimizes the overall operating structure of the system. This can generally be abstracted into the following components.

    2.1 Task Decomposition

    The system must decide how many subtasks a large task should be split into, and where the boundaries of each subtask lie.

    For example, vulnerability discovery can be decomposed into:

    • Code structure analysis;
    • Identification of potentially dangerous points;
    • Input constraint extraction;
    • Test case generation;
    • Attribution of runtime results;
    • Anomaly reproduction and verification;
    • Risk severity assessment.

    If the split is too coarse, a single agent takes on too many responsibilities, and context confusion becomes likely. If it is too fine, communication costs rise, and significant time is spent passing intermediate results between agents.

    Task decomposition is therefore itself a variable that needs optimization. An ideal decomposition should satisfy two conditions: each subtask has a relatively clear objective, and subtasks can connect through structured outputs rather than vague natural-language descriptions.

    2.2 Roles and Execution Order

    Having multiple agents does not simply mean “calling the model more times.” The system must also decide who executes first, who performs review, who can trigger replanning, and which steps can run in parallel.

    A common organizational pattern looks like this:

    • An analysis node extracts program structure and constraints;
    • A generation node constructs test inputs based on those constraints;
    • An execution node invokes an isolated environment to run the target program;
    • A diagnosis node analyzes logs and anomalies;
    • A verification node confirms whether the issue reproduces reliably;
    • A planning node decides the next round of exploration based on results.

    Different tasks suit different topologies. Source code analysis and input generation can run in parallel; runtime feedback and log parsing work better in sequence; high-risk conclusions warrant an independent review step.

    This shows that the key to a Harness is not “the more agents, the better,” but whether it forms a sensible information flow and control flow.

    2.3 Context and Memory Management

    In complex tasks, putting all information into a single context is not a good approach. A more reliable method is to maintain layered state:

    • Raw state: source code snippets, runtime logs, and original inputs;
    • Summary state: confirmed facts, key constraints, and candidate hypotheses;
    • Task state: the current stage, completed steps, and pending items;
    • Evidence state: reproducible anomalies, execution environments, and verification results;
    • Strategy state: which exploration directions have worked and which have proven low-value.

    This layered approach reduces context burden and prevents the model from repeatedly reprocessing already-confirmed information.

    Memory should also preserve not just “conclusions” but the evidence behind them. For example, “a certain input may cause an anomaly” is only a hypothesis; only when that input reliably reproduces under controlled conditions—with environmental noise ruled out—can it be upgraded to a high-confidence finding.

    Traditional agentic systems are usually designed manually by engineers: define the roles, write the prompts, arrange the tools, set retry counts, and tune parameters based on experience.

    This works for early prototypes, but as task complexity grows, it becomes impractical for humans to enumerate all possible system structures. At that point, the Harness can be formalized as a “searchable program.”

    It consists of at least the following elements:

    • Node set: different types of tasks or agents;
    • Edge set: information passing and execution dependencies;
    • State variables: current task progress and historical results;
    • Tool set: callable execution, analysis, and verification capabilities;
    • Control rules: when to continue, roll back, parallelize, or replan;
    • Evaluation function: the system’s final effectiveness.

    On this foundation, the system can automatically try different orchestration schemes, such as:

    • Changing task decomposition granularity;
    • Adjusting the execution order of different roles;
    • Adding or removing review nodes;
    • Replacing anomaly filtering strategies;
    • Modifying context summarization methods;
    • Changing retry and rollback rules after failures;
    • Selecting different workflows for different types of target programs.

    The evaluation function should not only measure “how many anomalies were found.” More reasonable metrics include:

    1. The number of valid issues;
    2. The proportion of genuine issues among all reports;
    3. The average verification cost per issue;
    4. Time from analysis to reproduction;
    5. Generalization across different program types;
    6. Resistance to repeated tasks and noisy output;
    7. Resource consumption and execution stability.

    If you optimize only for the number of findings, the system may tend to submit large volumes of low-quality reports; if you optimize only for speed, it may miss complex but high-value vulnerabilities. The evaluation function must therefore balance accuracy, coverage, cost, and reproducibility simultaneously.

    4. Why Failure Feedback Is the Key to Self-Evolution

    Without feedback, a Harness can only execute passively; with feedback, the system gains a foundation for improvement.

    In vulnerability discovery, failure is not worthless. A test that fails to trigger an anomaly may indicate:

    • The current input does not satisfy the constraints of the target path;
    • The test did not reach the critical code region;
    • The anomaly was intercepted by another mechanism;
    • The constraints extracted by the analysis node are incomplete;
    • There are problems with the execution environment or observation method;
    • The target path simply carries no risk.

    The system therefore cannot record only “success” or “failure”; it must also analyze at which stage the failure occurred and what it implies for the next round of strategy.

    A reasonably complete feedback loop can be expressed as:

    1. Generate candidate strategies;
    2. Execute strategies and collect evidence;
    3. Classify the results;
    4. Determine the cause of failure;
    5. Update task state and strategy memory;
    6. Select the next set of candidates;
    7. Independently verify the improved scheme.

    For example, if multiple consecutive rounds of testing remain stuck in the same code region, the system should conclude that current exploration has a path bias, rather than continuing to generate similar inputs. Conversely, if a particular input transformation significantly expands coverage, that strategy’s priority in subsequent tasks should be raised.

    The “evolution” here is not the model spontaneously generating new knowledge—it is the system continuously modifying its own way of working based on environmental feedback.

    5. Safety Boundaries Required for Engineering Deployment

    Self-evolving systems have strong autonomous exploration capabilities, but this does not mean they can run without limits. Especially in security testing scenarios, strict isolation and auditing mechanisms must be established.

    5.1 Execution Environment Isolation

    All automatically generated inputs, scripts, and test tasks should run in controlled environments, with restricted file access, network access, system calls, and resource usage, to prevent testing from affecting real business systems.

    5.2 Tiered Tool Permissions

    Different nodes should not hold the same permissions. Analysis nodes can read sanitized source code; execution nodes can only access dedicated test environments; reporting nodes are responsible for organizing evidence and must not modify target systems directly.

    5.3 Tiered Output Credibility

    System output should distinguish between candidate leads, anomalies pending verification, and confirmed issues. Model speculation must not be treated directly as a security conclusion. Every high-risk conclusion should be bound to minimal sufficient evidence, including trigger conditions, reproduction steps, runtime results, and environment information.

    5.4 Preventing Strategy Degradation

    Automated optimization can produce “gaming behavior,” such as manufacturing large numbers of low-quality anomalies to inflate surface metrics. The evaluation system therefore needs duplicate penalties, false-positive penalties, and manual sampling reviews to ensure the optimization direction stays aligned with actual security value.

    5.5 Complete Audit Trails

    Every round of strategy selection, tool invocation, input generation, anomaly judgment, and workflow modification should be traceable. Only then can engineers determine why the system reached a particular conclusion and, when necessary, roll back to a stable version.

    6. Implications for Enterprise Agent Development

    The biggest takeaway from this kind of research is that when building agentic systems, one should not only pursue stronger models, but also value the “systems engineering” beyond the model itself.

    A mature agent platform should provide at least the following capabilities:

    • Representing task workflows as composable modules;
    • Supporting independent configuration of roles, tools, and context;
    • Unified observability of the execution process;
    • Structured diagnosis of failure results;
    • Controlled experiments across multiple strategies;
    • Adjusting workflows based on feedback;
    • Preserving versions, metrics, and evidence chains;
    • Making explainable trade-offs between efficiency and reliability.

    From this perspective, the focus of future agent competition may not be model parameter scale alone, but “who can design better ways of organizing tasks.” The same model, under different context management, tool orchestration, and feedback loops, may exhibit entirely different capability boundaries.

    Conclusion: What Truly Evolves Is the System’s Organizational Capability

    Progress in complex agents should not be simplistically understood as a model learning more tricks. A more accurate statement is that the system has begun to observe its own execution results, identify inefficient parts of its current workflow, and reorganize tasks, tools, and information flows under constraints.

    This turns the Harness from a static script into a programmatic system that can be evaluated, searched, and corrected.

    For vulnerability discovery, the model is responsible for proposing hypotheses and performing local reasoning, while the Harness controls complexity, manages evidence, coordinates roles, handles failures, and maintains the overall objective. What holds long-term value is not having a single agent do everything at once, but enabling the entire system to become more stable, accurate, and efficient through continuous feedback.