Repository navigation
LLM Agents
PentestAI uses JSON structured output by default, so almost any model that can
emit valid JSON can drive the loop. Native tool calling is also available for
Anthropic and OpenAI via complete_with_tools() (PENTESTAI_NATIVE_TOOLS=1,
the default); other providers fall back to the JSON plan.
ReActAgent._reason()
→ send REACT_SYSTEM prompt + observations to the LLM
→ LLM returns JSON: {action, action_args, reasoning, risk_level, ...}
→ parse JSON → execute action → observe → repeat
The model does not need to support tool calling. What is required: consistent JSON output and adequate security knowledge.
PentestAI automatically selects a model based on task complexity:
| Tier | Used for | Model criteria |
|---|---|---|
complex |
Attack planning, exploit reasoning, ReAct loop | High JSON consistency, good security knowledge |
medium |
Vulnerability assessment, finding triage | Moderate JSON, adequate reasoning |
simple |
Parse output, classify findings, quick lookup | Fast, cheap, basic JSON |
all |
All tasks (override, gateway) | Routing delegated to the provider |
| Provider | Default Model | Setup | JSON | Security |
|---|---|---|---|---|
| Anthropic | claude-sonnet-4-6 |
ANTHROPIC_API_KEY=sk-ant-... |
★★★★★ | ★★★★★ |
| OpenAI | gpt-4o |
OPENAI_API_KEY=sk-... |
★★★★★ | ★★★★★ |
| xAI Grok | grok-3 |
XAI_API_KEY=... |
★★★★☆ | ★★★★☆ |
| Azure OpenAI |
gpt-4o (enterprise) |
AZURE_OPENAI_API_KEY + AZURE_OPENAI_ENDPOINT
|
★★★★★ | ★★★★★ |
| Provider | Default Model | Setup | JSON | Security |
|---|---|---|---|---|
| DeepSeek | deepseek-chat |
DEEPSEEK_API_KEY=... |
★★★★★ | ★★★★☆ |
| Mistral | mistral-large-latest |
MISTRAL_API_KEY=... |
★★★★☆ | ★★★★☆ |
| Cohere | command-r-plus |
COHERE_API_KEY=... |
★★★★☆ | ★★★☆☆ |
| Provider | Default Model | Setup | JSON | Security |
|---|---|---|---|---|
| Groq | llama-3.3-70b-versatile |
GROQ_API_KEY=gsk_... |
★★★★☆ | ★★★★☆ |
| Google Gemini | gemini-2.0-flash |
GOOGLE_API_KEY=... |
★★★★☆ | ★★★☆☆ |
| Perplexity | sonar-large-online |
PERPLEXITY_API_KEY=... |
★★★★☆ | ★★★☆☆ |
| Together AI | Llama-3-70b-chat-hf |
TOGETHER_API_KEY=... |
★★★☆☆ | ★★★☆☆ |
| Provider | Description | Setup |
|---|---|---|
| OpenRouter | 100+ models via a single key | OPENROUTER_API_KEY=... |
| 9router | Local gateway, 40+ providers | Install: npm i -g 9router && 9router
|
| Tool | Auto-detect | Manual setup |
|---|---|---|
| Ollama | ✅ Auto if running on localhost:11434 | ollama serve && ollama pull llama3.2 |
| LM Studio | Via custom | CUSTOM_LLM_BASE_URL=http://localhost:1234/v1 |
| vLLM | Via custom | CUSTOM_LLM_BASE_URL=http://localhost:8000/v1 |
| llama.cpp server | Via custom | CUSTOM_LLM_BASE_URL=http://localhost:8080/v1 |
| LiteLLM proxy | Via custom | CUSTOM_LLM_BASE_URL=http://localhost:4000 |
| Jan.ai | Via custom | CUSTOM_LLM_BASE_URL=http://localhost:1337/v1 |
Recommended models for local use:
- Reasoning:
qwen2.5:72b,deepseek-r1:32b,llama3.1:70b - Fast:
llama3.2:3b,qwen2.5:7b,mistral:7b
For any endpoint not listed above:
export CUSTOM_LLM_BASE_URL=https://api.workbuddy.ai/v1
export CUSTOM_LLM_API_KEY=<key>
export CUSTOM_LLM_MODEL=<model-name>
export CUSTOM_LLM_NAME=WorkBuddy
export CUSTOM_LLM_TIER=complexRequirement: the endpoint must be compatible with OpenAI's POST /v1/chat/completions format.
Test compatibility:
curl -X POST $CUSTOM_LLM_BASE_URL/chat/completions \
-H "Authorization: Bearer $CUSTOM_LLM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"'$CUSTOM_LLM_MODEL'","messages":[{"role":"user","content":"Reply with: OK"}],"max_tokens":5}'If the response is: {"choices":[{"message":{"content":"OK"}}]} → compatible ✅
| Model | Reason |
|---|---|
| Models with non-JSON output | The ReAct loop requires valid JSON on every iteration |
| Models < 7B parameters | Usually not reliable for complex JSON schemas |
| Embedding-only models | Cannot generate text |
| Image-only models | Not relevant for pentesting |
export ANTHROPIC_API_KEY=sk-ant-... # complex: ReAct loop
export GROQ_API_KEY=gsk_... # simple: output parsing (free tier)export AZURE_OPENAI_API_KEY=...
export AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
export ANTHROPIC_API_KEY=... # fallbackollama pull qwen2.5:72b
# PentestAI auto-detects Ollamaexport CUSTOM_LLM_BASE_URL=https://api.workbuddy.ai/v1
export CUSTOM_LLM_API_KEY=<key>
export CUSTOM_LLM_MODEL=<model>
export CUSTOM_LLM_NAME=WorkBuddyPentestAI> llm # view active models
PentestAI> llm add # add a new model
PentestAI> llm tier gpt-4o simple # change tier
PentestAI> llm routing off # use a single model for everything
PentestAI> llm test # test all connections
The mode can be changed at any time without a restart.