6.6 KiB
OLLAMA is giving me 404 errors
Ollama's API in OpenAI mode uses /v1/chat/completions whereas the openai library uses base_url + /chat/completions.
We adopt the latter for overall alignment with the gen AI community and empower the former by allowing users to add the v1 themselves via:
OLLAMA_API_BASE=http://IP:PORT/v1
See the following issues that treat this topic in more detail:
Where are all the caiextensions?
Currently, the extensions are not available as they have been (largely) integrated or are in the process of being integrated into the core architecture. We aim to have everything converge in next version. Coming soon!How do I set up SSH access for Gitlab?
Generate a new SSH key
ssh-keygen -t ed25519
Add the key to the SSH agent
ssh-add ~/.ssh/id_ed25519
Add the public key to Gitlab Copy the key and add it to Gitlab under https://gitlab.com/-/user_settings/ssh_keys
cat ~/.ssh/id_ed25519.pub
To verify it:
ssh -T git@gitlab.com
Welcome to GitLab, @vmayoral!
How do I clear Python cache?
find . -name "*.pyc" -delete && find . -name "__pycache__" -delete
If host networking is not working with ollama check whether it has been disabled in Docker because you are not signed in
Docker in OS X behaves funny sometimes. Check if the following message has shown up:
Host networking has been disabled because you are not signed in. Please sign in to enable it.
Make sure this has been addressed and also that the Dev Container is not forwarding the 8000 port (click on x, if necessary in the ports section).
To verify connection, from within the VSCode devcontainer:
curl -v http://host.docker.internal:8000/api/version
Run CAI against any target
The starting user prompt in this case is: Target IP: 192.168.2.10, perform a full network scan.
The agent started performing a nmap scan. You could either interact with the agent and give it more instructions, or let it run to see what it explores next.
How do I interact with the agent? Type twice CTRL + C
If you want to use the HITL mode, you can do it by presssing twice Ctrl + C.
This will allow you to interact (prompt) with the agent whenever you want. The agent will not lose the previous context, as it is stored in the history variable, which is passed to it and any agent that is called. This enables any agent to use the previous information and be more accurate and efficient.
How can I trace the whole execution?
The environment variable `CAI_TRACING` allows the user to set it to `CAI_TRACING=true` to enable tracing, or `CAI_TRACING=false` to disable it. When CAI is prompted by the first time, the user is provided with two paths, the execution log, and the tracing log.Can I expand CAI capabilities using previous run logs?
Absolutely! The memory extension allows you to use a previously sucessful runs ( the log object is stored as a .jsonl file in the log folder ) in a new run against the same target. The user is also given the path highlighted in orange as shown below.
How to make use of this functionality?
- Run CAI against the target. Let's assume the target name is:
target001. - Get the log file path, something like:
logs/cai_20250408_111856.jsonl - Generate the memory using any model of your preference:
shell JSONL_FILE_PATH="logs/cai_20250408_111856.jsonl" CTF_INSIDE="false" CAI_MEMORY_COLLECTION="target001" CAI_MEMORY="episodic" CAI_MODEL="claude-3-5-sonnet-20241022" python3 tools/2_jsonl_to_memory.py
The script tools/2_jsonl_to_memory.py will generate a memory collection file with the most relevant steps. The quality of the memory collection will depend on the model you use.
- Use the generated memory collection and execute a new run:
shell CAI_MEMORY="episodic" CAI_MODEL="gpt-4o" CAI_MEMORY_COLLECTION="target001" CAI_TRACING=false python3 cai/cli.py
Can I expand CAI capabilities using scripts or extra information?
Currently, CAI supports text based information. You can add any extra information on the target you are facing by copy-pasting it directly into the system or user prompt.
How? By adding it to the system (system_master_template.md) or the user prompt (user_master_template.md). You can always directly prompt the path to the model, and it will cat it.
How do I run the documentation locally?
To view and edit the documentation locally, you can use MkDocs, which is a static site generator for project documentation.
Steps:
-
Install MkDocs and the Material theme:
pip install mkdocs mkdocs-material -
Serve the documentation locally:
python -m mkdocs serveThis will start a local server (usually at http://127.0.0.1:8000) where you can view the docs in your browser.
-
Build the static site (optional):
mkdocs buildThis will generate a
site/directory with the static HTML files.
For more details, see the MkDocs documentation.






