# llama-cpp-agent

> llama-cpp-agent is an open-source agent framework for developer tools. Python framework for function calling, structured output and RAG with local LLMs. It is available on API, Self-hosted, Linux, macOS and Windows.

- **Kind:** Agent
- **Pricing:** Open source
- **Platforms:** API, Self-hosted, Linux, macOS, Windows
- **Repository:** https://github.com/maximilian-winter/llama-cpp-agent
- **GitHub stars:** 669
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

Rather than requiring models fine-tuned for tool use, this Python library constrains generation with grammars and JSON schemas, so many smaller open-weight models can call functions and return typed objects. It wraps chat, function calling, structured output, retrieval augmented generation with ColBERT reranking, and multi-step agent chains behind a single set of classes.

Tools can be plain Python functions, Pydantic models, llama-index tools or OpenAI-style tool schemas. Prompts are formatted through a built-in set of chat templates for common open models, and custom templates can be defined with prompt markers. It connects to llama-cpp-python, the llama.cpp server, and TGI or vLLM servers.

The project is aimed at Python developers who run their own inference backends and want agent behaviour without a hosted API. The maintainer notes that the project is no longer maintained and points users to ToolAgents or other Python agent frameworks for new work.

## Features

- **Guided function calling:** Constrains model output to user-defined schemas so models not tuned for tool use can call functions.
- **Structured output:** Generates typed objects from unstructured text using Pydantic-style definitions.
- **Parallel function execution:** Runs several function calls from a single model turn concurrently.
- **Retrieval augmented generation:** Adds document retrieval with ColBERT reranking via an optional dependency.
- **Sequential and mapping chains:** Chains agents together for multi-step text processing, including per-item mapping.
- **Multiple inference backends:** Works with llama-cpp-python, the llama.cpp server, TGI and vLLM servers.

## Good for

- Adding tool calling to a local open-weight model without fine-tuning
- Extracting structured records such as book entries from raw text
- Summarising several articles into one result with a mapping chain
- Building a retrieval pipeline over local documents with reranking
- Generating multi-step campaign content through a sequential chain

## FAQ

### How do I install the optional RAG dependencies?

Run pip install llama-cpp-agent[rag], which adds the ragatouille dependency needed for the RAG reranker.

### Which inference servers does llama-cpp-agent work with?

It works with llama-cpp-python and its server, the llama.cpp server, and TGI and vLLM servers.

### Is the project still maintained?

No. The maintainer says it is no longer maintained and recommends ToolAgents or other Python agentic frameworks.

### Is llama-cpp-agent free?

Yes. llama-cpp-agent is open source, so you can use and self-host it for free.

### What are the best alternatives to llama-cpp-agent?

The closest alternatives to llama-cpp-agent are smolagents, llama-agents, DemoGPT, pydantic-ai and agentic-context-engine.

## Where this comes from

- Description: written from the project's README.

## Alternatives

- [smolagents](https://ai-powered.com/agents/smolagents): smolagents is an open-source agent framework for multi-agent frameworks.
- [llama-agents](https://ai-powered.com/agents/llama-agents): llama-agents is an open-source agent framework for multi-agent frameworks.
- [DemoGPT](https://ai-powered.com/agents/demogpt): DemoGPT is an open-source agent framework for ai models and llm tooling.
- [pydantic-ai](https://ai-powered.com/agents/pydantic-ai): pydantic-ai is an open-source agent framework for design and media.
- [agentic-context-engine](https://ai-powered.com/agents/agentic-context-engine): agentic-context-engine is an open-source agent framework for multi-agent frameworks.
- [pydantic-deepagents](https://ai-powered.com/agents/pydantic-deepagents): pydantic-deepagents is an open-source agent framework for ai models and llm tooling.
- [agency](https://ai-powered.com/agents/agency-2): agency is an open-source agent framework for developer tools.
- [voice-lab](https://ai-powered.com/agents/voice-lab): voice-lab is an open-source agent framework for ai models and llm tooling.

---
Source: https://ai-powered.com/agents/llama-cpp-agent
