Fix bad imports and bad arguments in agents

This commit is contained in:
luijait 2025-06-17 17:44:27 +02:00
parent 66ba204720
commit 9c7205c0c1
10 changed files with 24 additions and 24 deletions

View File

@ -359,7 +359,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",
@ -382,7 +382,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
@ -433,7 +433,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(

View File

@ -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
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -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,
)

View File

@ -414,7 +414,7 @@ class RunImpl:
return ProcessedResponse(
new_items=items,
handoffs=run_handoffs,
functions=functions,
tools=functions,
computer_actions=computer_actions,
tools_used=tools_used,
)

View File

@ -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()

View File

@ -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,
)