---
title: "Open-source LLMs as LangChain Agents"
description: "Open-source LLMs can now serve as reasoning engines for tool-using ReAct agents, with Mixtral-8x7B outperforming GPT-3.5 out of the box on a mixed benchmark drawn from HotpotQA, GSM8K and GAIA, graded by GPT-4-as-a-judge."
url: "https://swe.quest/articles/open-source-llms-as-langchain-agents-e2163a289958a319"
canonical: "https://huggingface.co/blog/open-source-llms-as-agents"
source: "Hugging Face"
published: "2024-01-24"
difficulty: "medium"
kind: "Research"
reading_minutes: 10
tags: ["ai-agents","llms","evals","python"]
---

# Open-source LLMs as LangChain Agents

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2024-01-24, 10 min read, Research. Original: [https://huggingface.co/blog/open-source-llms-as-agents](https://huggingface.co/blog/open-source-llms-as-agents)

## Summary

Open-source LLMs can now serve as reasoning engines for tool-using ReAct agents, with Mixtral-8x7B outperforming GPT-3.5 out of the box on a mixed benchmark drawn from HotpotQA, GSM8K and GAIA, graded by GPT-4-as-a-judge. The ReAct loop works by prompting for a Thought plus a JSON tool call or a Final Answer, then parsing the output, running the tool and appending the Observation to the prompt. Agents are built in LangChain with the new ChatHuggingFace wrapper. Llama2-70b and Zephyr-7b perform poorly. About 10% of Mixtral's GAIA failures come from malformed tool arguments, so fine-tuning for function calling is the recommended next step. Giving models a calculator lifts zero-shot GSM8K scores, though only 20 questions were tested.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- LLM prompting basics ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- Python ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- LangChain basics

## Keywords

LangChain, ReAct, Mixtral-8x7B, ChatHuggingFace, GAIA, GSM8K, HotpotQA, GPT-3.5

## Related posts

- [License to Call: Introducing Transformers Agents 2.0](https://swe.quest/articles/license-to-call-introducing-transformers-agents-2-0-dad436258e67a17b.md): Hugging Face · 2024-05-13 · Medium · 15 min read · AI agents, LLMs, RAG & retrieval, Python
  Transformers Agents 2.0 adds two iterative ReAct-style agents, ReactCodeAgent and ReactJsonAgent, which loop through thought, action and observation, alongside the existing single-shot CodeAgent.
- [Open-source DeepResearch – Freeing our search agents](https://swe.quest/articles/open-source-deepresearch-freeing-our-search-agents-72a8cc1624888c05.md): Hugging Face · 2025-02-04 · Medium · 17 min read · AI agents, LLMs, Evaluation, Open source
  Hugging Face reproduced OpenAI's Deep Research agent in about 24 hours using the open smolagents framework and reached 55.15% on the GAIA validation set, up from roughly 46% for the previous open state of the art (Magentic-One).
- [Open Models have crossed a threshold](https://swe.quest/articles/open-models-have-crossed-a-threshold-c54376af892bf600.md): LangChain · 2026-10-13 · Medium · 7 min read · Evaluation, LLMs, AI agents, Cost optimization
  Open-weight models GLM-5 and MiniMax M2.7 now score close to closed frontier models on core agent tasks in LangChain's Deep Agents eval suite.
- [Building Deep Research: How we Achieved State of the Art](https://swe.quest/articles/building-deep-research-how-we-achieved-state-of-the-art-414ffb743a73bb80.md): Hugging Face · 2025-11-24 · Medium · 7 min read · AI agents, LLMs, Evaluation
  Tavily's deep research agent reached state of the art on DeepResearch Bench while using 66% fewer tokens than LangChain's Open Deep Research, mainly through context engineering.
- [Beat GPT-4o at Python by searching with 100 dumb LLaMAs](https://swe.quest/articles/beat-gpt-4o-at-python-by-searching-with-100-dumb-llamas-907f6997678a8d61.md): Modal · 2024-08-05 · Medium · 7 min read · LLMs, Inference & serving, Evaluation, AI for coding, Serverless
  Sampling LLaMA 3.1 8B Instruct many times and checking each candidate against HumanEval's unit tests raises pass@k from 66.4% at k=1 to 90.5% at k=100, matching GPT-4o's reported 90.2% pass@1, and to 95.1% at k=1000.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
