mirror of
https://github.com/GH05TCREW/pentestagent.git
synced 2026-03-07 22:33:38 +00:00
refactor(config): unify agent and orchestrator iteration env vars
This commit is contained in:
@@ -20,4 +20,10 @@ PENTESTAGENT_MODEL=gpt-5
|
||||
# PENTESTAGENT_EMBEDDINGS=local
|
||||
|
||||
# Settings
|
||||
PENTESTAGENT_DEBUG=false
|
||||
PENTESTAGENT_DEBUG=false
|
||||
|
||||
# Agent max iterations (regular agent + crew workers, default: 30)
|
||||
# PENTESTAGENT_AGENT_MAX_ITERATIONS=30
|
||||
|
||||
# Orchestrator max iterations (crew mode coordinator, default: 50)
|
||||
# PENTESTAGENT_ORCHESTRATOR_MAX_ITERATIONS=50
|
||||
@@ -4,7 +4,7 @@ from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass, field
|
||||
from typing import TYPE_CHECKING, Any, AsyncIterator, List, Optional
|
||||
|
||||
from ..config.constants import DEFAULT_MAX_ITERATIONS
|
||||
from ..config.constants import AGENT_MAX_ITERATIONS
|
||||
from .state import AgentState, AgentStateManager
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -78,7 +78,7 @@ class BaseAgent(ABC):
|
||||
llm: "LLM",
|
||||
tools: List["Tool"],
|
||||
runtime: "Runtime",
|
||||
max_iterations: int = DEFAULT_MAX_ITERATIONS,
|
||||
max_iterations: int = AGENT_MAX_ITERATIONS,
|
||||
):
|
||||
"""
|
||||
Initialize the base agent.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import json
|
||||
from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Optional
|
||||
|
||||
from ...config.constants import DEFAULT_MAX_ITERATIONS
|
||||
from ...config.constants import ORCHESTRATOR_MAX_ITERATIONS
|
||||
from ...knowledge.graph import ShadowGraph
|
||||
from ..prompts import pa_crew
|
||||
from .models import CrewState, WorkerCallback
|
||||
@@ -156,7 +156,7 @@ class CrewOrchestrator:
|
||||
final_report = ""
|
||||
|
||||
try:
|
||||
while iteration < DEFAULT_MAX_ITERATIONS:
|
||||
while iteration < ORCHESTRATOR_MAX_ITERATIONS:
|
||||
iteration += 1
|
||||
|
||||
response = await self.llm.generate(
|
||||
|
||||
@@ -109,7 +109,7 @@ class WorkerPool:
|
||||
worker_runtime = LocalRuntime()
|
||||
await worker_runtime.start()
|
||||
|
||||
from ...config.constants import WORKER_MAX_ITERATIONS
|
||||
from ...config.constants import AGENT_MAX_ITERATIONS
|
||||
|
||||
agent = PentestAgentAgent(
|
||||
llm=self.llm,
|
||||
@@ -117,7 +117,7 @@ class WorkerPool:
|
||||
runtime=worker_runtime, # Use isolated runtime
|
||||
target=self.target,
|
||||
rag_engine=self.rag_engine,
|
||||
max_iterations=WORKER_MAX_ITERATIONS,
|
||||
max_iterations=AGENT_MAX_ITERATIONS,
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
@@ -56,8 +56,10 @@ DEFAULT_TEMPERATURE = 0.7
|
||||
DEFAULT_MAX_TOKENS = 4096
|
||||
|
||||
# Agent Defaults
|
||||
DEFAULT_MAX_ITERATIONS = int(os.environ.get("PENTESTAGENT_MAX_ITERATIONS", "50"))
|
||||
WORKER_MAX_ITERATIONS = int(os.environ.get("PENTESTAGENT_WORKER_MAX_ITERATIONS", "10"))
|
||||
AGENT_MAX_ITERATIONS = int(os.environ.get("PENTESTAGENT_AGENT_MAX_ITERATIONS", "30"))
|
||||
ORCHESTRATOR_MAX_ITERATIONS = int(
|
||||
os.environ.get("PENTESTAGENT_ORCHESTRATOR_MAX_ITERATIONS", "50")
|
||||
)
|
||||
|
||||
# File Extensions
|
||||
KNOWLEDGE_TEXT_EXTENSIONS = [".txt", ".md"]
|
||||
|
||||
@@ -6,7 +6,7 @@ from pathlib import Path
|
||||
from typing import List, Optional
|
||||
|
||||
from .constants import (
|
||||
DEFAULT_MAX_ITERATIONS,
|
||||
AGENT_MAX_ITERATIONS,
|
||||
DEFAULT_MAX_TOKENS,
|
||||
DEFAULT_MODEL,
|
||||
DEFAULT_TEMPERATURE,
|
||||
@@ -40,7 +40,7 @@ class Settings:
|
||||
docker_image: str = "ghcr.io/gh05tcrew/pentestagent:kali"
|
||||
|
||||
# Agent Settings
|
||||
max_iterations: int = DEFAULT_MAX_ITERATIONS
|
||||
max_iterations: int = AGENT_MAX_ITERATIONS
|
||||
|
||||
# VPN Settings
|
||||
vpn_config_path: Optional[Path] = None
|
||||
|
||||
Reference in New Issue
Block a user