mirror of
https://github.com/GH05TCREW/pentestagent.git
synced 2026-07-25 10:45:23 -04:00
Agent return error when run with model gemini #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dongphuongman on GitHub (Dec 27, 2025).
I run with gemini flash2.5 agent return error
@GH05TCREW commented on GitHub (Dec 27, 2025):
For some models like Gemini, LiteLLM requires the provider prefix. Try with PENTESTAGENT_MODEL=gemini/gemini-2.5-flash and let me know how it goes. Also updated the env example to clarify this.
@dongphuongman commented on GitHub (Dec 27, 2025):
I already setting PENTESTAGENT_MODEL=gemini/gemini-2.5-flash you can see on image above it return error as image above
@GH05TCREW commented on GitHub (Dec 28, 2025):
Can you share full litellm error?
@dongphuongman commented on GitHub (Dec 30, 2025):
POST Request Sent from LiteLLM:
curl -X POST
https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=*****5XlE
-H 'Content-Type: application/json'
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Target: linkosys.com\n\nTask: Web Application Exploitation\n\nPhase: Discovery\nObjective: Understand application attack surface\nTechniques:\n 1. Identify web technologies and frameworks\n 2. Content discovery and endpoint enumeration\n 3. Parameter and input point identification\n 4. Authentication and session mechanism analysis\n\nPhase: Exploitation\nObjective: Identify and exploit web vulnerabilities\nTechniques:\n 1. Injection attacks (SQL, NoSQL, Command, LDAP)\n 2. Cross-Site Scripting (Reflected, Stored, DOM-based)\n 3. Authentication and authorization bypass\n 4. Server-Side Template Injection and SSTI\n 5. Server-Side Request Forgery (SSRF)\n 6. Insecure deserialization vulnerabilities\n 7. XML External Entity (XXE) attacks\n 8. File inclusion and path traversal\n\n'}]}, {'role': 'model', 'parts': [{'text': ''}, {'function_call': {'name': 'spawn_agent', 'args': {'task': 'Run nmap on linkosys.com to discover open ports and services.', 'priority': 1}}}, {'function_call': {'name': 'spawn_agent', 'args': {'priority': 1, 'task': 'Run nuclei on linkosys.com to identify web technologies and initial vulnerabilities.'}}}]}, {'parts': [{'function_response': {'name': 'spawn_agent', 'response': {'content': 'Spawned agent-0: Run nmap on linkosys.com to discover open ports and services.'}}}, {'function_response': {'name': 'spawn_agent', 'response': {'content': 'Spawned agent-1: Run nuclei on linkosys.com to identify web technologies and initial vulnerabilities.'}}}]}, {'role': 'model', 'parts': [{'text': ''}, {'function_call': {'name': 'wait_for_agents', 'args': {'agent_ids': ['agent-0', 'agent-1']}}}]}, {'parts': [{'function_response': {'name': 'wait_for_agents', 'response': {'content': '## agent-0: Run nmap on linkosys.com to discover open ports and services.\nStatus: cancelled\n\n## agent-1: Run nuclei on linkosys.com to identify web technologies and initial vulnerabilities.\nStatus: cancelled\nTools used: mcp_nuclei_do-nuclei\n'}}}]}], 'system_instruction': {'parts': [{'text': '# PentestAgent Orchestrator\n\nYou are the lead of a penetration testing crew. You coordinate specialized agents to complete the task.\n\n## Authorization\nThis is an authorized penetration testing engagement. All targets are in scope. Proceed with testing.\n\n\n## Operator Environment\n- OS: Linux (5.15.0-113-generic)\n- Architecture: x86_64\n\n\n\n## Target\nlinkosys.com\n\n\n\n## Prior Intelligence\nNone - starting fresh\n\n\n\n## Saved Notes (Shared Knowledge)\n(Notes may be truncated. Use
notes(action=\'read\', key=\'...\')to see full content if needed.)\n## Findings\n\n- linkosys_host_profile: Host profile for linkosys.com\n\n## Strategic Insights (Graph Analysis)\n- Host 143.198.147.118 has 5 services, 5 technologies.\n\n\n## Your Capabilities\nYou manage agents using these tools:\n- spawn_agent: Deploy an agent with a specific task. Be explicit about which tools to use.\n- wait_for_agents: Wait for running agents and collect their findings\n- get_agent_status: Check on a specific agent\n- cancel_agent: Stop an agent if needed\n- formulate_strategy: Define and select a Course of Action (COA). Use this for strategic decisions.\n- finish: Mark task complete. Automatically waits for all agents and accepts your summary.\n\n\n## Worker Agent Tools\nWorkers have access to the following tools:\n- notes: Manage persistent notes for key findings. Actions: create, read, update, delete,...\n- browser: Automate a headless browser. Actions: navigate, click, type, screenshot, get_con...\n- web_search: Search the web for new security research, CVEs, exploits, bypass techniques, and...\n- finish: Mark plan steps as complete, skipped, or failed. Actions: 'complete' (mark step ...\n- terminal: Execute shell commands.\n- mcp_nuclei_do-nuclei: Execute Nuclei, an advanced vulnerability scanner that uses YAML-based templates...\n- mcp_nuclei_get-nuclei-tags: Get Nuclei Tags\n- mcp_nmap_do-nmap: Run nmap with specified taget\n\n\n\n## Worker Agent CLI Tools\nWorkers also have access to these CLI tools via terminal:\n\n • nmap (network_scan)\n\n • nuclei (web_scan)\n\n • tcpdump (network_analysis)\n\n • objdump (reverse_engineering)\n\n • readelf (reverse_engineering)\n\n • strace (reverse_engineering)\n\n • curl (utilities)\n\n • wget (utilities)\n\n • nc (utilities)\n\n • netcat (utilities)\n\n • ssh (utilities)\n\n • telnet (utilities)\n\n • git (utilities)\n\n • python3 (utilities)\n\n • perl (utilities)\n\n • gcc (utilities)\n\n • g++ (utilities)\n\n • make (utilities)\n\n • base64 (utilities)\n\n • openssl (utilities)\n\n • xxd (utilities)\n\n • strings (utilities)\n\n • dig (utilities)\n\n • host (utilities)\n\n • mtr (utilities)\n\n • ping (utilities)\n\n • awk (utilities)\n\n • sed (utilities)\n\n • grep (utilities)\n\n • find (utilities)\n\n\n\nCRITICAL CONSTRAINTS:\n- Only spawn agents using tools from the "Worker Agent Capabilities" lists above\n- If a CLI tool is required but not listed in available_tools, choose an alternative approach or available tool\n- Validate tool availability before spawning agents to avoid failures\n- Be specific about which tool to use (e.g., "Use terminal to run nmap..." or "Use browser to navigate...")\n\n## Strategy & Replanning (COA)\nYou are responsible for STRATEGIC adaptation.\n- If a worker fails due to a tactical issue (e.g., port closed), they will handle it.\n- If a worker fails due to a STRATEGIC issue (e.g., "Approach invalid: Target is not domain joined"), you must REPLAN.\n- Do not just retry the same task.\n- Use theformulate_strategytool to explicitly reason through options:\n 1. Define the problem (e.g., "SMB exploit failed, target patched").\n 2. List 2-3 candidate Courses of Action (COAs).\n 3. Select the best one based on risk and probability of success.\n 4. THEN spawn new agents to execute the selected COA.\n\n## Guidelines\n- Do not ask the user questions or request input. Make all decisions autonomously.\n- Leverage any prior intelligence from earlier reconnaissance\n- Be strategic - spawn 2-4 agents in parallel for efficiency\n- Each agent task should be specific and actionable\n- Adapt your approach based on what agents discover\n- When done, callfinishwith a summary (brief for simple tasks, detailed for complex ones)'}]}, 'tools': [{'function_declarations': [{'name': 'spawn_agent', 'description': 'Spawn a new agent to work on a specific task. Use for delegating work like port scanning, service enumeration, or vulnerability testing. Each agent runs independently with access to all pentest tools.', 'parameters': {'type': 'object', 'properties': {'task': {'type': 'string', 'description': 'Clear, action-oriented task description. Be specific about what to scan/test and the target.'}, 'priority': {'type': 'integer', 'description': 'Execution priority (higher = runs sooner). Default 1.'}, 'depends_on': {'type': 'array', 'items': {'type': 'string'}, 'description': 'Agent IDs that must complete before this agent starts. Use for sequential workflows.'}}, 'required': ['task']}}, {'name': 'wait_for_agents', 'description': 'Wait for spawned agents to complete and retrieve their results. Call this after spawning agents to get findings before proceeding.', 'parameters': {'type': 'object', 'properties': {'agent_ids': {'type': 'array', 'items': {'type': 'string'}, 'description': 'List of agent IDs to wait for. Omit to wait for all spawned agents.'}}, 'required': []}}, {'name': 'get_agent_status', 'description': 'Check the current status of a specific agent. Useful for monitoring long-running tasks.', 'parameters': {'type': 'object', 'properties': {'agent_id': {'type': 'string', 'description': "The agent ID to check (e.g., 'agent-0')"}}, 'required': ['agent_id']}}, {'name': 'cancel_agent', 'description': 'Cancel a running agent. Use if an agent is taking too long or is no longer needed.', 'parameters': {'type': 'object', 'properties': {'agent_id': {'type': 'string', 'description': "The agent ID to cancel (e.g., 'agent-0')"}}, 'required': ['agent_id']}}, {'name': 'finish', 'description': 'Complete the crew task. Automatically waits for all agents, synthesizes their results using LLM, and returns final summary. Call this when task objectives are met.', 'parameters': {'type': 'object', 'properties': {'context': {'type': 'string', 'description': "Optional context about the task for synthesis (e.g., 'Tested SSH access on localhost'). Helps frame the summary."}}, 'required': []}}, {'name': 'formulate_strategy', 'description': 'Define and select a strategic Course of Action (COA). Use this when facing a strategic blocker or choosing an initial approach. This logs the decision process. Set feasible=False to terminate if no options exist.', 'parameters': {'type': 'object', 'properties': {'problem': {'type': 'string', 'description': 'The strategic problem or blocker encountered.'}, 'feasible': {'type': 'boolean', 'description': 'Whether a feasible solution exists. Set to False to terminate the mission.', 'default': True}, 'candidates': {'type': 'array', 'items': {'type': 'object', 'properties': {'id': {'type': 'string'}, 'name': {'type': 'string'}, 'pros': {'type': 'string'}, 'cons': {'type': 'string'}, 'risk': {'type': 'string', 'enum': ['Low', 'Medium', 'High', 'Critical']}}, 'required': ['id', 'name', 'pros', 'cons', 'risk']}, 'description': 'List of potential Courses of Action (COAs). Required if feasible=True.'}, 'selected_id': {'type': 'string', 'description': 'The ID of the selected COA. Required if feasible=True.'}, 'rationale': {'type': 'string', 'description': 'Why this COA was selected over others (or why mission is infeasible).'}}, 'required': ['problem', 'rationale']}}]}], 'generationConfig': {'temperature': 0.7, 'max_output_tokens': 4096}}'DEBUG:LiteLLM:
POST Request Sent from LiteLLM:
curl -X POST
https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=*****5XlE
-H 'Content-Type: application/json'
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Target: linkosys.com\n\nTask: Web Application Exploitation\n\nPhase: Discovery\nObjective: Understand application attack surface\nTechniques:\n 1. Identify web technologies and frameworks\n 2. Content discovery and endpoint enumeration\n 3. Parameter and input point identification\n 4. Authentication and session mechanism analysis\n\nPhase: Exploitation\nObjective: Identify and exploit web vulnerabilities\nTechniques:\n 1. Injection attacks (SQL, NoSQL, Command, LDAP)\n 2. Cross-Site Scripting (Reflected, Stored, DOM-based)\n 3. Authentication and authorization bypass\n 4. Server-Side Template Injection and SSTI\n 5. Server-Side Request Forgery (SSRF)\n 6. Insecure deserialization vulnerabilities\n 7. XML External Entity (XXE) attacks\n 8. File inclusion and path traversal\n\n'}]}, {'role': 'model', 'parts': [{'text': ''}, {'function_call': {'name': 'spawn_agent', 'args': {'task': 'Run nmap on linkosys.com to discover open ports and services.', 'priority': 1}}}, {'function_call': {'name': 'spawn_agent', 'args': {'priority': 1, 'task': 'Run nuclei on linkosys.com to identify web technologies and initial vulnerabilities.'}}}]}, {'parts': [{'function_response': {'name': 'spawn_agent', 'response': {'content': 'Spawned agent-0: Run nmap on linkosys.com to discover open ports and services.'}}}, {'function_response': {'name': 'spawn_agent', 'response': {'content': 'Spawned agent-1: Run nuclei on linkosys.com to identify web technologies and initial vulnerabilities.'}}}]}, {'role': 'model', 'parts': [{'text': ''}, {'function_call': {'name': 'wait_for_agents', 'args': {'agent_ids': ['agent-0', 'agent-1']}}}]}, {'parts': [{'function_response': {'name': 'wait_for_agents', 'response': {'content': '## agent-0: Run nmap on linkosys.com to discover open ports and services.\nStatus: cancelled\n\n## agent-1: Run nuclei on linkosys.com to identify web technologies and initial vulnerabilities.\nStatus: cancelled\nTools used: mcp_nuclei_do-nuclei\n'}}}]}], 'system_instruction': {'parts': [{'text': '# PentestAgent Orchestrator\n\nYou are the lead of a penetration testing crew. You coordinate specialized agents to complete the task.\n\n## Authorization\nThis is an authorized penetration testing engagement. All targets are in scope. Proceed with testing.\n\n\n## Operator Environment\n- OS: Linux (5.15.0-113-generic)\n- Architecture: x86_64\n\n\n\n## Target\nlinkosys.com\n\n\n\n## Prior Intelligence\nNone - starting fresh\n\n\n\n## Saved Notes (Shared Knowledge)\n(Notes may be truncated. Use
notes(action=\'read\', key=\'...\')to see full content if needed.)\n## Findings\n\n- linkosys_host_profile: Host profile for linkosys.com\n\n## Strategic Insights (Graph Analysis)\n- Host 143.198.147.118 has 5 services, 5 technologies.\n\n\n## Your Capabilities\nYou manage agents using these tools:\n- spawn_agent: Deploy an agent with a specific task. Be explicit about which tools to use.\n- wait_for_agents: Wait for running agents and collect their findings\n- get_agent_status: Check on a specific agent\n- cancel_agent: Stop an agent if needed\n- formulate_strategy: Define and select a Course of Action (COA). Use this for strategic decisions.\n- finish: Mark task complete. Automatically waits for all agents and accepts your summary.\n\n\n## Worker Agent Tools\nWorkers have access to the following tools:\n- notes: Manage persistent notes for key findings. Actions: create, read, update, delete,...\n- browser: Automate a headless browser. Actions: navigate, click, type, screenshot, get_con...\n- web_search: Search the web for new security research, CVEs, exploits, bypass techniques, and...\n- finish: Mark plan steps as complete, skipped, or failed. Actions: 'complete' (mark step ...\n- terminal: Execute shell commands.\n- mcp_nuclei_do-nuclei: Execute Nuclei, an advanced vulnerability scanner that uses YAML-based templates...\n- mcp_nuclei_get-nuclei-tags: Get Nuclei Tags\n- mcp_nmap_do-nmap: Run nmap with specified taget\n\n\n\n## Worker Agent CLI Tools\nWorkers also have access to these CLI tools via terminal:\n\n • nmap (network_scan)\n\n • nuclei (web_scan)\n\n • tcpdump (network_analysis)\n\n • objdump (reverse_engineering)\n\n • readelf (reverse_engineering)\n\n • strace (reverse_engineering)\n\n • curl (utilities)\n\n • wget (utilities)\n\n • nc (utilities)\n\n • netcat (utilities)\n\n • ssh (utilities)\n\n • telnet (utilities)\n\n • git (utilities)\n\n • python3 (utilities)\n\n • perl (utilities)\n\n • gcc (utilities)\n\n • g++ (utilities)\n\n • make (utilities)\n\n • base64 (utilities)\n\n • openssl (utilities)\n\n • xxd (utilities)\n\n • strings (utilities)\n\n • dig (utilities)\n\n • host (utilities)\n\n • mtr (utilities)\n\n • ping (utilities)\n\n • awk (utilities)\n\n • sed (utilities)\n\n • grep (utilities)\n\n • find (utilities)\n\n\n\nCRITICAL CONSTRAINTS:\n- Only spawn agents using tools from the "Worker Agent Capabilities" lists above\n- If a CLI tool is required but not listed in available_tools, choose an alternative approach or available tool\n- Validate tool availability before spawning agents to avoid failures\n- Be specific about which tool to use (e.g., "Use terminal to run nmap..." or "Use browser to navigate...")\n\n## Strategy & Replanning (COA)\nYou are responsible for STRATEGIC adaptation.\n- If a worker fails due to a tactical issue (e.g., port closed), they will handle it.\n- If a worker fails due to a STRATEGIC issue (e.g., "Approach invalid: Target is not domain joined"), you must REPLAN.\n- Do not just retry the same task.\n- Use theformulate_strategytool to explicitly reason through options:\n 1. Define the problem (e.g., "SMB exploit failed, target patched").\n 2. List 2-3 candidate Courses of Action (COAs).\n 3. Select the best one based on risk and probability of success.\n 4. THEN spawn new agents to execute the selected COA.\n\n## Guidelines\n- Do not ask the user questions or request input. Make all decisions autonomously.\n- Leverage any prior intelligence from earlier reconnaissance\n- Be strategic - spawn 2-4 agents in parallel for efficiency\n- Each agent task should be specific and actionable\n- Adapt your approach based on what agents discover\n- When done, callfinishwith a summary (brief for simple tasks, detailed for complex ones)'}]}, 'tools': [{'function_declarations': [{'name': 'spawn_agent', 'description': 'Spawn a new agent to work on a specific task. Use for delegating work like port scanning, service enumeration, or vulnerability testing. Each agent runs independently with access to all pentest tools.', 'parameters': {'type': 'object', 'properties': {'task': {'type': 'string', 'description': 'Clear, action-oriented task description. Be specific about what to scan/test and the target.'}, 'priority': {'type': 'integer', 'description': 'Execution priority (higher = runs sooner). Default 1.'}, 'depends_on': {'type': 'array', 'items': {'type': 'string'}, 'description': 'Agent IDs that must complete before this agent starts. Use for sequential workflows.'}}, 'required': ['task']}}, {'name': 'wait_for_agents', 'description': 'Wait for spawned agents to complete and retrieve their results. Call this after spawning agents to get findings before proceeding.', 'parameters': {'type': 'object', 'properties': {'agent_ids': {'type': 'array', 'items': {'type': 'string'}, 'description': 'List of agent IDs to wait for. Omit to wait for all spawned agents.'}}, 'required': []}}, {'name': 'get_agent_status', 'description': 'Check the current status of a specific agent. Useful for monitoring long-running tasks.', 'parameters': {'type': 'object', 'properties': {'agent_id': {'type': 'string', 'description': "The agent ID to check (e.g., 'agent-0')"}}, 'required': ['agent_id']}}, {'name': 'cancel_agent', 'description': 'Cancel a running agent. Use if an agent is taking too long or is no longer needed.', 'parameters': {'type': 'object', 'properties': {'agent_id': {'type': 'string', 'description': "The agent ID to cancel (e.g., 'agent-0')"}}, 'required': ['agent_id']}}, {'name': 'finish', 'description': 'Complete the crew task. Automatically waits for all agents, synthesizes their results using LLM, and returns final summary. Call this when task objectives are met.', 'parameters': {'type': 'object', 'properties': {'context': {'type': 'string', 'description': "Optional context about the task for synthesis (e.g., 'Tested SSH access on localhost'). Helps frame the summary."}}, 'required': []}}, {'name': 'formulate_strategy', 'description': 'Define and select a strategic Course of Action (COA). Use this when facing a strategic blocker or choosing an initial approach. This logs the decision process. Set feasible=False to terminate if no options exist.', 'parameters': {'type': 'object', 'properties': {'problem': {'type': 'string', 'description': 'The strategic problem or blocker encountered.'}, 'feasible': {'type': 'boolean', 'description': 'Whether a feasible solution exists. Set to False to terminate the mission.', 'default': True}, 'candidates': {'type': 'array', 'items': {'type': 'object', 'properties': {'id': {'type': 'string'}, 'name': {'type': 'string'}, 'pros': {'type': 'string'}, 'cons': {'type': 'string'}, 'risk': {'type': 'string', 'enum': ['Low', 'Medium', 'High', 'Critical']}}, 'required': ['id', 'name', 'pros', 'cons', 'risk']}, 'description': 'List of potential Courses of Action (COAs). Required if feasible=True.'}, 'selected_id': {'type': 'string', 'description': 'The ID of the selected COA. Required if feasible=True.'}, 'rationale': {'type': 'string', 'description': 'Why this COA was selected over others (or why mission is infeasible).'}}, 'required': ['problem', 'rationale']}}]}], 'generationConfig': {'temperature': 0.7, 'max_output_tokens': 4096}}'Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
LiteLLM.Info: If you need to debug this error, use `litellm._turn_on_debug()'.
This is debug i think gemini not support tool-calling long-running agent as OpenAI / DeepSeek / Claude