From d7ee0c253cd1a7a9bee4e3ab712dda216e125eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mayoral=20Vilches?= Date: Sun, 1 Jun 2025 13:38:51 +0000 Subject: [PATCH] Default to alias0 and improve overall init. message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Víctor Mayoral Vilches --- src/cai/agents/__init__.py | 2 +- src/cai/agents/blue_teamer.py | 2 +- src/cai/agents/bug_bounter.py | 2 +- src/cai/agents/codeagent.py | 2 +- src/cai/agents/dfir.py | 2 +- src/cai/agents/flag_discriminator.py | 4 +-- src/cai/agents/mail.py | 2 +- src/cai/agents/memory.py | 2 +- src/cai/agents/network_traffic_analyzer.py | 2 +- src/cai/agents/one_tool.py | 2 +- src/cai/agents/red_teamer.py | 2 +- src/cai/agents/replay_attack_agent.py | 2 +- src/cai/agents/retester.py | 2 +- src/cai/agents/thought.py | 2 +- src/cai/cli.py | 10 +++---- src/cai/repl/commands/config.py | 2 +- src/cai/repl/commands/flush.py | 2 +- src/cai/repl/ui/banner.py | 29 ++++++++++++------- .../agents/models/openai_chatcompletions.py | 2 +- src/cai/util.py | 4 +-- 20 files changed, 43 insertions(+), 36 deletions(-) diff --git a/src/cai/agents/__init__.py b/src/cai/agents/__init__.py index 356e7cfb..9626748f 100644 --- a/src/cai/agents/__init__.py +++ b/src/cai/agents/__init__.py @@ -64,7 +64,7 @@ from dotenv import load_dotenv # pylint: disable=import-error # noqa: E501 __path__ = pkgutil.extend_path(__path__, __name__) # Get model from environment or use default -model = os.getenv('CAI_MODEL', "qwen2.5:14b") +model = os.getenv('CAI_MODEL', "alias0") PATTERNS = [ diff --git a/src/cai/agents/blue_teamer.py b/src/cai/agents/blue_teamer.py index 71583bfa..cb62e1d9 100644 --- a/src/cai/agents/blue_teamer.py +++ b/src/cai/agents/blue_teamer.py @@ -43,7 +43,7 @@ blueteam_agent = Agent( description="""Agent that specializes in system defense and security monitoring. Expert in cybersecurity protection and incident response.""", model=OpenAIChatCompletionsModel( - model=os.getenv('CAI_MODEL', "qwen2.5:14b"), + model=os.getenv('CAI_MODEL', "alias0"), openai_client=AsyncOpenAI(), ), tools=tools, diff --git a/src/cai/agents/bug_bounter.py b/src/cai/agents/bug_bounter.py index d01b42fc..bf22f50e 100644 --- a/src/cai/agents/bug_bounter.py +++ b/src/cai/agents/bug_bounter.py @@ -45,7 +45,7 @@ bug_bounter_agent = Agent( Expert in web security, API testing, and responsible disclosure.""", tools=tools, model=OpenAIChatCompletionsModel( - model=os.getenv('CAI_MODEL', "qwen2.5:14b"), + model=os.getenv('CAI_MODEL', "alias0"), openai_client=AsyncOpenAI(), ) diff --git a/src/cai/agents/codeagent.py b/src/cai/agents/codeagent.py index bd384744..88535c9f 100644 --- a/src/cai/agents/codeagent.py +++ b/src/cai/agents/codeagent.py @@ -184,7 +184,7 @@ class CodeAgent(Agent): def __init__( # pylint: disable=too-many-arguments,too-many-locals # noqa: E501 self, name: str = "CodeAgent", - model: str = "qwen2.5:14b", + model: str = "alias0", instructions: Union[str, Callable[[], str]] = None, tools: List[Callable] = None, additional_authorized_imports: Optional[List[str]] = None, diff --git a/src/cai/agents/dfir.py b/src/cai/agents/dfir.py index b2272539..e930a259 100644 --- a/src/cai/agents/dfir.py +++ b/src/cai/agents/dfir.py @@ -62,7 +62,7 @@ dfir_agent = Agent( description="""Agent that specializes in Digital Forensics and Incident Response. Expert in investigation and analysis of digital evidence.""", model=OpenAIChatCompletionsModel( - model=os.getenv('CAI_MODEL', "qwen2.5:14b"), + model=os.getenv('CAI_MODEL', "alias0"), openai_client=AsyncOpenAI(), ), tools=tools, diff --git a/src/cai/agents/flag_discriminator.py b/src/cai/agents/flag_discriminator.py index f1228810..ce95924c 100644 --- a/src/cai/agents/flag_discriminator.py +++ b/src/cai/agents/flag_discriminator.py @@ -6,7 +6,7 @@ from cai.sdk.agents import Agent, OpenAIChatCompletionsModel, handoff from openai import AsyncOpenAI from cai.agents.one_tool import one_tool_agent -model = os.getenv('CAI_MODEL', "qwen2.5:14b") +model = os.getenv('CAI_MODEL', "alias0") # Create OpenAI client with fallback API key to prevent initialization errors # The actual API key should be set in environment variables or .env file @@ -22,7 +22,7 @@ flag_discriminator = Agent( 4. If you do not find a flag, call `ctf_agent` to continue investigating. """, model=OpenAIChatCompletionsModel( - model="qwen2.5:14b" if os.getenv('CAI_MODEL') == "o3-mini" else model, + model="alias0" if os.getenv('CAI_MODEL') == "o3-mini" else model, openai_client=AsyncOpenAI(api_key=api_key), ), handoffs=[ diff --git a/src/cai/agents/mail.py b/src/cai/agents/mail.py index 88939c7a..7b8833bb 100644 --- a/src/cai/agents/mail.py +++ b/src/cai/agents/mail.py @@ -115,7 +115,7 @@ dns_smtp_agent = Agent( ), tools=[check_mail_spoofing_vulnerability, execute_cli_command], model=OpenAIChatCompletionsModel( - model=os.getenv('CAI_MODEL', "qwen2.5:14b"), + model=os.getenv('CAI_MODEL', "alias0"), openai_client=AsyncOpenAI(), ) ) diff --git a/src/cai/agents/memory.py b/src/cai/agents/memory.py index e1f4b6bd..e81fbb04 100644 --- a/src/cai/agents/memory.py +++ b/src/cai/agents/memory.py @@ -87,7 +87,7 @@ from cai.tools.misc.rag import add_to_memory_semantic, add_to_memory_episodic from cai.rag.vector_db import get_previous_memory # Get model from environment or use default -model = os.getenv('CAI_MODEL', "qwen2.5:14b") +model = os.getenv('CAI_MODEL', "alias0") def get_previous_steps(query: str) -> str: diff --git a/src/cai/agents/network_traffic_analyzer.py b/src/cai/agents/network_traffic_analyzer.py index 7a2cb037..85b10be1 100644 --- a/src/cai/agents/network_traffic_analyzer.py +++ b/src/cai/agents/network_traffic_analyzer.py @@ -76,7 +76,7 @@ network_security_analyzer_agent = Agent( description="""Agent that specializes in network security analysis. Expert in monitoring, capturing, and analyzing network communications for security threats.""", model=OpenAIChatCompletionsModel( - model=os.getenv('CAI_MODEL', "qwen2.5:14b"), + model=os.getenv('CAI_MODEL', "alias0"), openai_client=AsyncOpenAI(), ), tools=tools, diff --git a/src/cai/agents/one_tool.py b/src/cai/agents/one_tool.py index bc9f4c58..6948d2bf 100644 --- a/src/cai/agents/one_tool.py +++ b/src/cai/agents/one_tool.py @@ -7,7 +7,7 @@ from cai.tools.reconnaissance.generic_linux_command import generic_linux_command from openai import AsyncOpenAI # Get model from environment or use default -model_name = os.getenv('CAI_MODEL', "qwen2.5:14b") +model_name = os.getenv('CAI_MODEL', "alias0") # NOTE: This is needed when using LiteLLM Proxy Server # diff --git a/src/cai/agents/red_teamer.py b/src/cai/agents/red_teamer.py index 69184e2e..01e7cb06 100644 --- a/src/cai/agents/red_teamer.py +++ b/src/cai/agents/red_teamer.py @@ -20,7 +20,7 @@ from cai.tools.reconnaissance.exec_code import ( # pylint: disable=import-error from cai.util import load_prompt_template load_dotenv() -model_name = os.getenv("CAI_MODEL", "qwen2.5:14b") +model_name = os.getenv("CAI_MODEL", "alias0") # Prompts redteam_agent_system_prompt = load_prompt_template("prompts/system_red_team_agent.md") # Define tools list based on available API keys diff --git a/src/cai/agents/replay_attack_agent.py b/src/cai/agents/replay_attack_agent.py index c94a8b01..1538d65d 100644 --- a/src/cai/agents/replay_attack_agent.py +++ b/src/cai/agents/replay_attack_agent.py @@ -68,7 +68,7 @@ replay_attack_agent = Agent( description="""Agent that specializes in network replay attacks and counteroffensive techniques. Expert in packet manipulation, traffic replay, and protocol exploitation.""", model=OpenAIChatCompletionsModel( - model=os.getenv('CAI_MODEL', "qwen2.5:14b"), + model=os.getenv('CAI_MODEL', "alias0"), openai_client=AsyncOpenAI(), ), tools=tools, diff --git a/src/cai/agents/retester.py b/src/cai/agents/retester.py index 1fafd31b..130859b6 100644 --- a/src/cai/agents/retester.py +++ b/src/cai/agents/retester.py @@ -36,7 +36,7 @@ retester_agent = Agent( eliminating false positives.""", tools=tools, model=OpenAIChatCompletionsModel( - model=os.getenv('CAI_MODEL', "qwen2.5:14b"), + model=os.getenv('CAI_MODEL', "alias0"), openai_client=AsyncOpenAI(), ) ) diff --git a/src/cai/agents/thought.py b/src/cai/agents/thought.py index 14888296..ccd609de 100644 --- a/src/cai/agents/thought.py +++ b/src/cai/agents/thought.py @@ -17,7 +17,7 @@ thought_agent_system_prompt = load_prompt_template("prompts/system_thought_route thought_agent = Agent( name="ThoughtAgent", model=OpenAIChatCompletionsModel( - model=os.getenv('CAI_MODEL', "qwen2.5:14b"), + model=os.getenv('CAI_MODEL', "alias0"), openai_client=AsyncOpenAI(), ), description="""Agent focused on analyzing and planning the next steps diff --git a/src/cai/cli.py b/src/cai/cli.py index 6c2c3646..3820a8aa 100644 --- a/src/cai/cli.py +++ b/src/cai/cli.py @@ -20,7 +20,7 @@ Environment Variables within container (default: "true") CAI_MODEL: Model to use for agents - (default: "qwen2.5:14b") + (default: "alias0") CAI_DEBUG: Set debug output level (default: "1") - 0: Only tool outputs - 1: Verbose debug output @@ -182,7 +182,7 @@ set_tracing_disabled(True) # llm_model=os.getenv('LLM_MODEL', 'gpt-4o-mini') # # llm_model=os.getenv('LLM_MODEL', 'claude-3-7') -llm_model=os.getenv('LLM_MODEL', 'qwen2.5:14b') +llm_model=os.getenv('LLM_MODEL', 'alias0') # For Qwen models, we need to skip system instructions as they're not supported @@ -271,7 +271,7 @@ def run_cai_cli(starting_agent, context_variables=None, max_turns=float('inf'), turn_count = 0 idle_time = 0 console = Console() - last_model = os.getenv('CAI_MODEL', 'qwen2.5:14b') + last_model = os.getenv('CAI_MODEL', 'alias0') last_agent_type = os.getenv('CAI_AGENT_TYPE', 'one_tool_agent') parallel_count = int(os.getenv('CAI_PARALLEL', '1')) @@ -351,7 +351,7 @@ def run_cai_cli(starting_agent, context_variables=None, max_turns=float('inf'), idle_start_time = time.time() # Check if model has changed and update if needed - current_model = os.getenv('CAI_MODEL', 'qwen2.5:14b') + current_model = os.getenv('CAI_MODEL', 'alias0') if current_model != last_model and hasattr(agent, 'model'): # Update the model recursively for the agent and all handoff agents update_agent_models_recursively(agent, current_model) @@ -926,7 +926,7 @@ def main(): agent.model.suppress_final_output = False # Changed to False to show all agent messages # Ensure the agent and all its handoff agents use the current model - current_model = os.getenv('CAI_MODEL', 'qwen2.5:14b') + current_model = os.getenv('CAI_MODEL', 'alias0') update_agent_models_recursively(agent, current_model) # Run the CLI with the selected agent diff --git a/src/cai/repl/commands/config.py b/src/cai/repl/commands/config.py index e9f1d970..27a8c31b 100644 --- a/src/cai/repl/commands/config.py +++ b/src/cai/repl/commands/config.py @@ -46,7 +46,7 @@ ENV_VARS = { 6: { "name": "CAI_MODEL", "description": "Model to use for agents", - "default": "qwen2.5:14b" + "default": "alias0" }, 7: { "name": "CAI_DEBUG", diff --git a/src/cai/repl/commands/flush.py b/src/cai/repl/commands/flush.py index 9cee48df..d969dd79 100644 --- a/src/cai/repl/commands/flush.py +++ b/src/cai/repl/commands/flush.py @@ -51,7 +51,7 @@ class FlushCommand(Command): if client and hasattr(client, 'interaction_input_tokens') and hasattr( client, 'total_input_tokens'): - model = os.getenv('CAI_MODEL', "qwen2.5:14b") + model = os.getenv('CAI_MODEL', "alias0") input_tokens = client.interaction_input_tokens if hasattr( client, 'interaction_input_tokens') else 0 total_tokens = client.total_input_tokens if hasattr( diff --git a/src/cai/repl/ui/banner.py b/src/cai/repl/ui/banner.py index 1c52de87..c040a7ba 100644 --- a/src/cai/repl/ui/banner.py +++ b/src/cai/repl/ui/banner.py @@ -290,7 +290,7 @@ def display_quick_guide(console: Console): ) # Get current environment variable values - current_model = os.getenv('CAI_MODEL', "qwen2.5:14b") + current_model = os.getenv('CAI_MODEL', "alias0") current_agent_type = os.getenv('CAI_AGENT_TYPE', "one_tool_agent") config_text = Text.assemble( @@ -330,16 +330,23 @@ def display_quick_guide(console: Console): ) context_tip = Panel( - "As security exercises progress, LLM quality may\n" - "degrade, especially if progress stalls.\n\n" - "It's often better to clear the context window\n" - "or restart CAI rather than waiting until\n" - "context usage reaches 100%.\n\n" - "When context exceeds 80%, follow these steps:\n" - "1. CAI> Dump your memory and findings in current scenario in findings.txt\n" - "2. CAI> /flush\n" - "3. CAI> Analyze findings.txt, and continue exercise with target: ...", - title="[bold yellow]Performance Tip[/bold yellow]", + Text.assemble( + "For optimal cybersecurity AI performance, use\n", + ("alias0", "bold green"), + " - specifically designed for cybersecurity\n" + "tasks with superior domain knowledge.\n\n", + ("alias0", "bold green"), + " outperforms general-purpose models in:\n", + "• Vulnerability assessment\n", + "• Penetration testing and bug bounty\n", + "• Security analysis\n", + "• Threat detection\n\n", + "Learn more about ", + ("alias0", "bold green"), + " and its privacy-first approach:\n", + ("https://news.aliasrobotics.com/alias0-a-privacy-first-cybersecurity-ai/", "blue underline") + ), + title="[bold yellow]Cybersecurity Model Tip[/bold yellow]", border_style="yellow", padding=(1, 2), title_align="center" diff --git a/src/cai/sdk/agents/models/openai_chatcompletions.py b/src/cai/sdk/agents/models/openai_chatcompletions.py index e3fe3772..879b8cc1 100644 --- a/src/cai/sdk/agents/models/openai_chatcompletions.py +++ b/src/cai/sdk/agents/models/openai_chatcompletions.py @@ -2236,7 +2236,7 @@ class OpenAIChatCompletionsModel(Model): elif "gemini" in model_str: kwargs.pop("parallel_tool_calls", None) elif "qwen" in model_str or ":" in model_str: - # Handle Ollama-served models with custom formats (e.g., qwen2.5:14b) + # Handle Ollama-served models with custom formats (e.g., alias0) # These typically need the Ollama provider litellm.drop_params = True kwargs.pop("parallel_tool_calls", None) diff --git a/src/cai/util.py b/src/cai/util.py index 68d60f22..28de3802 100644 --- a/src/cai/util.py +++ b/src/cai/util.py @@ -1805,7 +1805,7 @@ def update_agent_streaming_content(context, text_delta, token_stats=None): footer_stats.append(f"${session_total_cost:.4f}", style="bold magenta") # Add context usage indicator - model_name = context.get("model", os.environ.get('CAI_MODEL', 'qwen2.5:14b')) + model_name = context.get("model", os.environ.get('CAI_MODEL', 'alias0')) context_pct = input_tokens / get_model_input_tokens(model_name) * 100 if context_pct < 50: indicator = "🟩" @@ -3109,7 +3109,7 @@ def finish_tool_streaming(tool_name, args, output, call_id, execution_info=None, # Calculate cost if not provided if not interaction_cost and input_tokens > 0: - model_name = token_info.get('model', os.environ.get('CAI_MODEL', 'qwen2.5:14b')) + model_name = token_info.get('model', os.environ.get('CAI_MODEL', 'alias0')) interaction_cost = calculate_model_cost(model_name, input_tokens, output_tokens) # Add compact token info to output