aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md14
1 files changed, 12 insertions, 2 deletions
diff --git a/README.md b/README.md
index 9c30af7..0293439 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,7 @@ This project implements a simple autonomous coding agent that can interact with
- `mypy`: Run static type checking on a Python file.
- `webgrep`: Search for keywords within the markdownified content of a URL.
- **Reasoning Loop**: Uses a recursive loop to process tasks, analyze results, and determine the next step until a final response is reached.
+- **Context Management**: Estimates the token count of the conversation and automatically squashes (summarizes) older history when it approaches the model's context size limit, keeping the most recent messages intact.
- **Logging**: Logs interactions to `thoughts.log` for debugging and analysis.
## Requirements
@@ -30,6 +31,12 @@ This project implements a simple autonomous coding agent that can interact with
```bash
export LLM_API_KEY="your_api_key_here"
```
+ Optionally, you can also configure the endpoint, model, and context size via environment variables:
+ ```bash
+ export LLM_API_ENDPOINT="https://llm-gateway.k8s.aalto.fi/api/v1"
+ export LLM_MODEL="zai-org/GLM-5.3-Flash"
+ export LLM_CONTEXT_SIZE=1048576
+ ```
2. **Run the Agent**:
Execute the script using Python:
@@ -43,9 +50,11 @@ This project implements a simple autonomous coding agent that can interact with
```bash
python3 llm.py --workdir /path/to/your/project
```
-- `--endpoint URL`: The API endpoint for the LLM (defaults to `https://llm-gateway.k8s.aalto.fi/api/v1`).
+- `--endpoint URL`: The API endpoint for the LLM (defaults to `LLM_API_ENDPOINT`, or `https://llm-gateway.k8s.aalto.fi/api/v1`).
- `--key KEY`: The API key for the LLM endpoint (defaults to `LLM_API_KEY` environment variable).
-- `--model MODEL`: The model name to use (defaults to `RedHatAI/gemma-4-31B-it-FP8-Dynamic`).
+- `--model MODEL`: The model name to use (defaults to `LLM_MODEL`, or `zai-org/GLM-5.3-Flash`).
+- `--min-history N`: Minimum amount of most recent messages to keep intact when summarising the history to keep the context short enough (default: 3).
+- `--model-context-size N`: Context size supported by the model (defaults to `LLM_CONTEXT_SIZE`, or 1048576).
- `--trust-level LEVEL`: The trust level of the agent (defaults to 2). Determines which actions require manual approval.
## How it Works
@@ -57,6 +66,7 @@ This project implements a simple autonomous coding agent that can interact with
- The script executes the action (interacting with the file system, shell, or web).
- The result of the action is fed back into the LLM as a new observation.
- This repeats until the agent provides a final natural language response.
+3. **History Squashing**: When the estimated token count of the conversation exceeds a threshold of the model's context size, the older history is summarized by the LLM into a compact "Previous history summary" message, while the most recent `--min-history` messages are preserved.
## Security and Permissions