GraphCanon updated 1w · GitHub synced 1w
Decision brief
llm_agents is a Python library enabling users to build simple agents directed by large language models, featuring functions like executing Python code and using Google search.
Good fit when
- Use llm_agents when you require a lightweight solution for building agents controlled by LLMs with specific tools such as Python REPL execution or Hacker News search.
- Opt for this library when aiming to understand the underlying mechanisms of agent functions through simplified, concise code, ideal for educational purposes or prototyping.
Avoid when
- Avoid llm_agents if you need a more robust and feature-rich product for complex tasks that require extensive integration capabilities beyond Python REPL, Google search, and Hacker News.
- Do not choose it when you are looking for advanced abstraction layers like those found in LangChain, as llm_agents aims to remain simple with fewer files and a straightforward core.
- Requirements:
- Min 1 GB RAM; Requires the installation of requirements specified by running `pip install -r requirements.txt` followed by `pip install -e .`.; Dependencies include setting up environment variables for `OPENAI_API_KEY` to use OpenAI API and optionally `SERPAPI_API_KEY` if Google search tool is utilized.
Observed Jul 14, 2026 · Source: enrich:decision_facts
Verify the decision
Maintenance and security
Full trust report- Maintenance
- Dormant (418d since push)
- As of 1w
- Provenance
- Not a fork · Personal account
- As of 1w
- Security (OSV)
- 32 low (32 low)
- As of 1mo
Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.
Install
pip install llm_agents PyPISimilar tools
Same-category neighbours. No typed graph edges are catalogued for this tool yet.
Evidence and technical details
Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.
Overview
A Python library for building simple agents that are directed by large language models (LLMs). Features include executing Python code, using Google search, and searching Hacker News. The agent operates in a loop of Thought, Action, Observation.
Capability facts
- CLI
- CLI entrypoint
Source: pyproject.toml:[project.scripts] · Aug 15, 2026
- Languages
- python
Source: github.language+pyproject.toml · Aug 15, 2026
Categories
Compatibility
Sourced claims from the README excerpt - not unsourced marketing copy.
Source: README excerpt (regex_v1, Aug 15, 2026)
odels (LLMs) which is heavily inspired by <a href="https://github.com/hwchase17/langchain/" target="_blank">langchain</a>.Source link
Source: README excerpt (regex_v1, Aug 15, 2026)
* `OPENAI_API_KEY` to use the OpenAI API (obtainable at: https://platform.openai.com/account/api-keys)Source link
Source: README excerpt (regex_v1, Aug 15, 2026)
* So far, I've implemented the ability to execute Python code in a REPL, to use the Google search and to search on Hacker NewsSource link
Tags
README
LLM Agents
Small library to build agents which are controlled by large language models (LLMs) which is heavily inspired by langchain.
The goal was to get a better grasp of how such an agent works and understand it all in very few lines of code.
Langchain is great, but it already has a few more files and abstraction layers, so I thought it would be nice to build the most important parts of a simple agent from scratch.
Some more infos are in this Hacker News discussion from April 5th 2023 and the related blog post.
How it works
The agent works like this:
- It gets instructed by a prompt which tells it the basic way to solve a task using tools
- Tools are custom build components which the agent can use
- So far, I've implemented the ability to execute Python code in a REPL, to use the Google search and to search on Hacker News
- The agent runs in a loop of Thought, Action, Observation, Thought, ...
- The Thought and Action (with the Action Input to the action) are the parts which are generated by an LLM
- The Observation is generated by using a tool (for example the print outputs of Python or the text result of a Google search)
- The LLM gets the new information appended to the prompt in each loop cycle and thus can act on that information
- Once the agent has enough information it provides the final answer
For more details on how it works, check out this blog post
How to use it
You can install this library locally by running:
pip install -r requirements.txt
pip install -e .
inside it's directory after cloning it.
You also need to provide the following env variables:
OPENAI_API_KEYto use the OpenAI API (obtainable at: https://platform.openai.com/account/api-keys)SERPAPI_API_KEYto use the Google Search in case you use that tool (obtainable at: https://serpapi.com/)
You can simply export them in bash like: export OPENAI_API_KEY='sh-lsdf....'
Then you can run the script python run_agent.py and ask your question.
To construct your own agent do it like this:
from llm_agents import Agent, ChatLLM, PythonREPLTool, HackerNewsSearchTool, SerpAPITool
agent = Agent(llm=ChatLLM(), tools=[PythonREPLTool(), SerpAPITool(), HackerNewsSearchTool()])
result = agent.run("Your question to the agent")
print(f"Final answer is {result}")
Of course, you can also build your custom tools or omit tools, for exmaple if you don't want to create a SERPAPI key.
For agents
This page has a .md twin and JSON over the API.