LocalDiplomacy

LocalDiplomacy is a Bannerlord singleplayer mod experiment that keeps the AI roleplay and diplomacy loop outside the game process.

See docs/LocalDiplomacy_PLAN.md for the architecture.

Agent Quick Start

From src/LocalDiplomacy.Agent:

Copy-Item config.example.yaml config.yaml
# Put koboldcpp.exe and model.gguf in this directory.
uv sync --extra test
uv run uvicorn localdiplomacy_agent.app:app --host 127.0.0.1 --port 8766

The agent will launch koboldcpp.exe --model .\model.gguf --port 5001 --contextsize 8192 --jinjatools when koboldcpp.autostart is enabled.

Mock Game Client

Use the mock connector to test the same commands the Bannerlord mod will send without launching the game:

cd src\LocalDiplomacy.Agent
uv run python -m localdiplomacy_agent.mock_game --mock-agent say "Can we make peace with Battania?"
uv run python -m localdiplomacy_agent.mock_game --mock-agent tick --day 12.5

Drop --mock-agent to send the same requests to a running agent at http://127.0.0.1:8766.

Bannerlord Build Notes

Install a .NET SDK that can target net472, then set BANNERLORD_REFERENCES to Bannerlord's bin\Win64_Shipping_Client directory before building:

$env:BANNERLORD_REFERENCES="C:\Program Files (x86)\Steam\steamapps\common\Mount & Blade II Bannerlord\bin\Win64_Shipping_Client"
dotnet build src\LocalDiplomacy\LocalDiplomacy.csproj
S
Description
A banner lord AI mod that uses local, small, tool calling AI for bannerlord
Readme 280 KiB
Languages
Python 87.5%
C# 12.5%