Swival — A coding agent for open models
Description: Swival connects to LM Studio or HuggingFace Inference API, sends your task, and runs an autonomous tool loop until it produces an answer. A few thousand lines of Python, no framework.

# A coding agent for open models

Swival connects to LM Studio or HuggingFace Inference API, sends your task, and runs an autonomous tool loop until it produces an answer. With LM Studio it auto-discovers your loaded model, so there's nothing to configure. A few thousand lines of Python, no framework.

$ uv tool install swival
$ swival "Refactor the error handling in src/api.py"

## Why Swival

### Your models, your way

Auto-discovers your LM Studio model, or point it at any HuggingFace model or dedicated endpoint. You pick the model and the infrastructure.

### Small and hackable

A few thousand lines of Python, no framework. Read the whole agent in an afternoon. Modify it to fit your workflow.

### Batteries included

Works out of the box with no configuration. Point it at a model and start working. File editing, search, web fetch, and structured thinking are all built in.

### Built for benchmarking

JSON evaluation reports capture timing, tool usage, and context events. Compare models systematically on real coding tasks.

## Quickstart

### LM Studio

1. Install LM Studio and load a model with tool-calling support. Recommended first model: qwen3-coder-next (great quality/speed tradeoff on local hardware). Start the server.
2. Install Swival:

       uv tool install swival

3. Run:

       swival "Refactor the error handling in src/api.py"

### HuggingFace

    export HF_TOKEN=hf_...
    uv tool install swival
    swival "Refactor the error handling in src/api.py" \
        --provider huggingface --model meta-llama/Llama-3.3-70B-Instruct

For interactive sessions, use `swival --repl`.