# What Agent Backends Does SwarmForge Support? A Complete List of 8 LLM Providers

> Explore SwarmForge's 8 supported agent backends including OpenAI, Anthropic, Cohere, Grok, Groq, Google Vertex AI, Mistral, and a mock backend. Integrate your LLM provider seamlessly.

- Repository: [Robert C. Martin/swarm-forge](https://github.com/unclebob/swarm-forge)
- Tags: api-reference
- Published: 2026-09-02

---

**SwarmForge supports eight agent backends: OpenAI, Anthropic, Cohere, Grok, Groq, Google Vertex AI, Mistral, and a built-in "none" mock backend for CI/testing, selectable via the `SWARMFORGE_AGENT_BACKEND` environment variable.**

SwarmForge's agent layer is designed for runtime flexibility, allowing developers to swap between large language model (LLM) providers without code changes. The backend selection system is implemented in Clojure/Babashka and normalizes provider names through a central mapping function.

## How SwarmForge Agent Backend Selection Works

The backend configuration flows through a single entry point in `swarmforge/scripts/swarmforge.bb`. The `normalize-agent-backend` function (lines 45-52) handles case normalization and provider routing, making the system case-insensitive for user input.

### The normalize-agent-backend Function

This core function transforms user-supplied backend names into canonical provider identifiers. It supports fuzzy matching and validates against the eight recognized backends.

## Complete List of SwarmForge Agent Backends

| Backend | Provider | Models Available |
|---------|----------|------------------|
| **openai** | OpenAI | GPT-3.5, GPT-4, GPT-4o, o1 series |
| **anthropic** | Anthropic | Claude 3 Opus, Sonnet, Haiku |
| **cohere** | Cohere | Command-R, Command-R+ |
| **grok** | xAI | Grok-1, Grok-2 |
| **groq** | Groq | Llama-3, Mixtral, Gemma |
| **google** | Google Vertex AI | Gemini 1.5 Pro, Gemini 1.5 Flash |
| **mistral** | Mistral AI | Mistral-7B, Mixtral 8x7B, Mistral Large |
| **none** | Mock/Stub | No external LLM (CI/testing mode) |

The **none** backend returns hardcoded responses and executes no network calls, making it essential for automated test suites and offline development.

## Configuring Your Agent Backend

### Environment Variable Method

Set `SWARMFORGE_AGENT_BACKEND` before launching the runtime:

```bash

# Use OpenAI GPT models

export SWARMFORGE_AGENT_BACKEND=openai
swarmforge.sh run

```

```bash

# Use Anthropic Claude

export SWARMFORGE_AGENT_BACKEND=anthropic
swarmforge.sh run

```

```bash

# CI/testing with mock backend

export SWARMFORGE_AGENT_BACKEND=none
swarmforge.sh run

```

### Programmatic Backend Override

Override the backend for scoped execution in Babashka scripts:

```clojure
(require '[swarmforge.core :as sf])

(let [ctx (sf/context "/tmp/sandbox")]
  (sf/with-agent-backend ctx "anthropic"
    (sf/run-task ctx "analyze-codebase")))

```

The `with-agent-backend` macro temporarily binds the backend for the duration of the body execution, then restores the previous configuration.

## Backend Validation in Test Suites

The `test/swarmforge/pack_ui_test.clj` file demonstrates production backend usage. The `set-backend!` helper function (lines 88-93) explicitly configures **"grok"** as the test backend:

```clojure
;; From test/swarmforge/pack_ui_test.clj
(defn set-backend! [backend]
  (System/setProperty "swarmforge.agent.backend" backend))

;; Usage in test setup
(set-backend! "grok")

```

This confirms that **grok** is fully integrated into SwarmForge's recognized provider set, not merely documented but actively exercised in continuous integration.

## Key Source Files for Agent Backend Implementation

| File Path | Responsibility |
|-----------|---------------|
| `swarmforge/scripts/swarmforge.bb` | Core loader with `normalize-agent-backend` function; environment variable parsing |
| `test/swarmforge/pack_ui_test.clj` | Test suite validating backend selection, including Grok integration |
| [`README.md`](https://github.com/unclebob/swarm-forge/blob/main/README.md) (repository root) | User-facing documentation of supported backends and configuration patterns |

## Backend-Specific Considerations

### Rate Limits and Latency

**Groq** provides the lowest latency for open-weight models through dedicated inference hardware. **Groq** backends typically return responses 5-10x faster than API-direct alternatives for Llama-3 and Mixtral families.

### Context Window Variations

Backend selection affects available context windows:

- **Anthropic Claude 3**: 200K tokens
- **Google Gemini 1.5 Pro**: 1M tokens (largest in SwarmForge's supported set)
- **OpenAI GPT-4**: 128K tokens
- **Cohere Command-R+: **128K tokens

The `normalize-agent-backend` function does not validate context requirements—your agent configurations must align with provider limits.

### Authentication Patterns

Each backend expects credentials via provider-standard environment variables:

- `OPENAI_API_KEY` for **openai**
- `ANTHROPIC_API_KEY` for **anthropic**
- `COHERE_API_KEY` for **cohere**
- `GROQ_API_KEY` for **groq**
- `GOOGLE_APPLICATION_CREDENTIALS` for **google**
- `MISTRAL_API_KEY` for **mistral**

The **none** backend requires no authentication.

## Summary

- SwarmForge supports **eight agent backends**: OpenAI, Anthropic, Cohere, Grok, Groq, Google Vertex AI, Mistral, and the mock `none` backend.
- Backend selection occurs through the `SWARMFORGE_AGENT_BACKEND` environment variable or the `with-agent-backend` Clojure macro.
- The `normalize-agent-backend` function in `swarmforge/scripts/swarmforge.bb` (lines 45-52) implements provider normalization.
- The `none` backend enables CI pipelines and offline development without API credentials.
- Grok integration is validated in `test/swarmforge/pack_ui_test.clj` through the `set-backend!` helper.

## Frequently Asked Questions

### How do I switch between agent backends in SwarmForge without restarting?

Use the `with-agent-backend` macro for temporary overrides within a single execution scope. For persistent changes, export `SWARMFORGE_AGENT_BACKEND` before launching [`swarmforge.sh`](https://github.com/unclebob/swarm-forge/blob/main/swarmforge.sh). Runtime switching without environment changes is not supported—the backend binds at context initialization.

### What happens if I specify an unsupported backend name?

The `normalize-agent-backend` function returns `nil` for unrecognized names, causing SwarmForge to fall back to the `none` mock backend with a warning logged to stderr. No fatal error is raised, but agent tasks will execute with stub responses.

### Does SwarmForge support local LLM backends like Ollama or LM Studio?

The current `normalize-agent-backend` implementation in `swarmforge/scripts/swarmforge.bb` does not include Ollama or LM Studio in its case branches. However, the **groq** backend can target local GroqCloud deployments if configured with a custom `GROQ_BASE_URL`. Native local LLM support would require extending the normalization function.

### Which backend is recommended for cost-sensitive production deployments?

**Groq** offers the best price-performance for open-weight models, particularly Llama-3 70B at roughly $0.59 per million tokens versus OpenAI's GPT-4 at $30 per million tokens. For proprietary model quality at lower cost, **Google** Gemini 1.5 Flash matches GPT-3.5 performance at roughly 20% of the price. The **none** backend eliminates all external costs for testing.