diff --git a/README.md b/README.md index 3850565e..954c98b4 100644 --- a/README.md +++ b/README.md @@ -376,7 +376,7 @@ At its core, CAI abstracts its cybersecurity behavior via `Agents` and agentic ` ```python -from cai.types import Agent +from cai.sdk.agents import Agent from cai.core import CAI ctf_agent = Agent( name="CTF Agent", @@ -399,7 +399,7 @@ response = client.run(agent=ctf_agent, `Tools` let cybersecurity agents take actions by providing interfaces to execute system commands, run security scans, analyze vulnerabilities, and interact with target systems and APIs - they are the core capabilities that enable CAI agents to perform security tasks effectively; in CAI, tools include built-in cybersecurity utilities (like LinuxCmd for command execution, WebSearch for OSINT gathering, Code for dynamic script execution, and SSHTunnel for secure remote access), function calling mechanisms that allow integration of any Python function as a security tool, and agent-as-tool functionality that enables specialized security agents (such as reconnaissance or exploit agents) to be used by other agents, creating powerful collaborative security workflows without requiring formal handoffs between agents. ```python -from cai.types import Agent +from cai.sdk.agents import Agent from cai.tools.common import run_command from cai.core import CAI @@ -450,7 +450,7 @@ You may find different [tools](cai/tools). They are grouped in 6 major categorie ```python -from cai.types import Agent +from cai.sdk.agents import Agent from cai.core import CAI ctf_agent = Agent( diff --git a/src/cai/agents/codeagent.py b/src/cai/agents/codeagent.py index 88535c9f..8f4c926f 100644 --- a/src/cai/agents/codeagent.py +++ b/src/cai/agents/codeagent.py @@ -244,7 +244,7 @@ class CodeAgent(Agent): model=model, description=description, instructions=instructions, - functions=functions or [], + tools=functions or [], reasoning_effort=reasoning_effort, temperature=0.2, # Lower temperature for predictable code ) diff --git a/src/cai/agents/memory_analysis_agent.py b/src/cai/agents/memory_analysis_agent.py index 3ea1574c..1448e979 100644 --- a/src/cai/agents/memory_analysis_agent.py +++ b/src/cai/agents/memory_analysis_agent.py @@ -1,6 +1,6 @@ """Memory Analysis and Manipulation Agent""" import os -from cai.types import Agent # pylint: disable=import-error +from cai.sdk.agents import Agent # pylint: disable=import-error from cai.util import load_prompt_template # Add this import from cai.tools.command_and_control.sshpass import ( # pylint: disable=import-error # noqa: E501 run_ssh_command_with_credentials @@ -39,6 +39,6 @@ memory_analysis_agent = Agent( Specializes in process memory examination, monitoring, and modification for security assessment, vulnerability discovery, and runtime behavior analysis.""", model=os.getenv('CAI_MODEL', "qwen2.5:14b"), - functions=functions, - parallel_tool_calls=False, + tools=functions, + ) diff --git a/src/cai/agents/reporter.py b/src/cai/agents/reporter.py index 25c4231b..cad39dbc 100644 --- a/src/cai/agents/reporter.py +++ b/src/cai/agents/reporter.py @@ -1,6 +1,6 @@ """Reporter Agent - Creates professional security assessment reports""" import os -from cai.types import Agent # pylint: disable=import-error +from cai.sdk.agents import Agent # pylint: disable=import-error from cai.util import load_prompt_template # Add this import from cai.tools.reconnaissance.generic_linux_command import ( # pylint: disable=import-error # noqa: E501 @@ -27,6 +27,6 @@ reporting_agent = Agent( instructions=reporting_agent_system_prompt, description="""Agent that generates reports in html.""", model=os.getenv('CAI_MODEL', "qwen2.5:14b"), - functions=functions, - parallel_tool_calls=False, + tools=functions, + ) diff --git a/src/cai/agents/reverse_engineering_agent.py b/src/cai/agents/reverse_engineering_agent.py index 79c17301..4ecf9051 100644 --- a/src/cai/agents/reverse_engineering_agent.py +++ b/src/cai/agents/reverse_engineering_agent.py @@ -1,6 +1,6 @@ """Reverse Engineering and Binary Analysis Agent""" import os -from cai.types import Agent # pylint: disable=import-error +from cai.sdk.agents import Agent # pylint: disable=import-error from cai.util import load_prompt_template # Add this import from cai.tools.command_and_control.sshpass import ( # pylint: disable=import-error # noqa: E501 run_ssh_command_with_credentials @@ -40,6 +40,6 @@ reverse_engineering_agent = Agent( decompilation, and vulnerability discovery using tools like Ghidra, Binwalk, and various binary analysis utilities.""", model=os.getenv('CAI_MODEL', "qwen2.5:14b"), - functions=functions, - parallel_tool_calls=False, + tools=functions, + ) diff --git a/src/cai/agents/subghz_sdr_agent.py b/src/cai/agents/subghz_sdr_agent.py index c5ee1ec9..96b89404 100644 --- a/src/cai/agents/subghz_sdr_agent.py +++ b/src/cai/agents/subghz_sdr_agent.py @@ -1,6 +1,6 @@ """Sub-GHz Radio Frequency Analysis Agent using HackRF One""" import os -from cai.types import Agent # pylint: disable=import-error +from cai.sdk.agents import Agent # pylint: disable=import-error from cai.util import load_prompt_template # Add this import from cai.tools.command_and_control.sshpass import ( # pylint: disable=import-error # noqa: E501 run_ssh_command_with_credentials @@ -39,6 +39,6 @@ subghz_sdr_agent = Agent( Specializes in signal capture, replay, and protocol analysis for IoT, automotive, industrial, and wireless security applications.""", model=os.getenv('CAI_MODEL', "qwen2.5:14b"), - functions=functions, - parallel_tool_calls=False, + tools=functions, + ) diff --git a/src/cai/agents/wifi_security_tester.py b/src/cai/agents/wifi_security_tester.py index c2cbd4bd..535ba5f6 100644 --- a/src/cai/agents/wifi_security_tester.py +++ b/src/cai/agents/wifi_security_tester.py @@ -1,6 +1,6 @@ """Wi-Fi Security Testing Agent""" import os -from cai.types import Agent # pylint: disable=import-error +from cai.sdk.agents import Agent # pylint: disable=import-error from cai.util import load_prompt_template # Add this import from cai.tools.command_and_control.sshpass import ( # pylint: disable=import-error # noqa: E501 run_ssh_command_with_credentials @@ -38,6 +38,6 @@ wifi_security_agent = Agent( description="""Agent for Wi-Fi network security testing and penetration. Specializes in wireless attacks, password recovery, and communication disruption.""", model=os.getenv('CAI_MODEL', "qwen2.5:14b"), - functions=functions, - parallel_tool_calls=False, + tools=functions, + ) diff --git a/src/cai/sdk/agents/_run_impl.py b/src/cai/sdk/agents/_run_impl.py index 9b635653..1a215df4 100644 --- a/src/cai/sdk/agents/_run_impl.py +++ b/src/cai/sdk/agents/_run_impl.py @@ -493,7 +493,7 @@ class RunImpl: return ProcessedResponse( new_items=items, handoffs=run_handoffs, - functions=functions, + tools=functions, computer_actions=computer_actions, tools_used=tools_used, ) diff --git a/tests/core/test_openai_chatcompletions_stream.py b/tests/core/test_openai_chatcompletions_stream.py index f17606b9..6ae94df1 100644 --- a/tests/core/test_openai_chatcompletions_stream.py +++ b/tests/core/test_openai_chatcompletions_stream.py @@ -66,7 +66,7 @@ async def test_stream_response_yields_events_for_text_content(monkeypatch) -> No output=[], tool_choice="none", tools=[], - parallel_tool_calls=False, + ) return resp, fake_stream() @@ -155,7 +155,7 @@ async def test_stream_response_yields_events_for_refusal_content(monkeypatch) -> output=[], tool_choice="none", tools=[], - parallel_tool_calls=False, + ) return resp, fake_stream() @@ -242,7 +242,7 @@ async def test_stream_response_yields_events_for_tool_call(monkeypatch) -> None: output=[], tool_choice="none", tools=[], - parallel_tool_calls=False, + ) return resp, fake_stream() diff --git a/tests/fake_model.py b/tests/fake_model.py index a5cff359..d3fcf6fb 100644 --- a/tests/fake_model.py +++ b/tests/fake_model.py @@ -124,5 +124,5 @@ def get_response_obj(output: list[TResponseOutputItem], response_id: str | None tool_choice="none", tools=[], top_p=None, - parallel_tool_calls=False, + )