← 开源
mpaepper

llm_agents

Build agents which are controlled by LLMs

TutorialsPython
在 GitHub 打开
增长势头
+124 小时新增 Star+0.1%
1.06k
Star
85
Fork
+2
本周
4
贡献者
创建于 2023-04-04 · 更新于 2026-10-16 · 今日第 5882 名
主要开发者
mpaepperZetaphorThingEngineer

mpaepper/llm_agents 排名第 5,882,有 1,059 个星标。

同类别比较

mpaepper/llm_agents 排名第 5,882,此处有 8 个同类条目;microsoft/lets-learn-mcp-python 排名第 5,873。

同类别比较
名称排名指标
LangChain-OpenTutorial/LangChain-OpenTutorial5,838
语言:
Jupyter Notebook
星标数:
1,117
分叉数:
347
简介:
LangChain, LangGraph Open Tutorial for everyone!
Ma-Lab-Berkeley/deep-representation-learning-book5,849
语言:
TeX
星标数:
1,097
分叉数:
118
简介:
Learning Deep Representations of Data Distributions
KalyanKS-NLP/LLM-Interview-Questions-and-Answers-Hub5,861
星标数:
1,082
分叉数:
174
简介:
100+ LLM interview questions with answers.
microsoft/lets-learn-mcp-python5,873
语言:
Python
星标数:
1,070
分叉数:
198
简介:
MCP Python Tutorial
PacktPublishing/Deep-Learning-with-Keras5,894
语言:
Jupyter Notebook
星标数:
1,048
分叉数:
697
简介:
Code repository for Deep Learning with Keras published by Packt
mryab/efficient-dl-systems5,899
语言:
Jupyter Notebook
星标数:
1,042
分叉数:
151
简介:
Efficient Deep Learning Systems course materials
junfanz1/Awesome-Senior-Engineer-Algorithms-Review5,911
星标数:
1,032
分叉数:
263
简介:
Data Structure Algorithms, (GenAI/ML) System Design, Machine Learning, DevOps coding interview practices
datawhalechina/machine-learning-toy-code5,917
语言:
Jupyter Notebook
星标数:
1,025
分叉数:
200
简介:
《机器学习》(西瓜书)代码实战
关键参数与规格
关键参数与规格
参数值
语言Python
类别Tutorials
星标数1,059
分叉数85
贡献者4
创建日期2023-04-04
更新日期2026-10-16
1 天星标数1
7 天星标数2
排名5,882
上次排名11,757
排名变化5,875
7 天星标排名8,268
上次 7 天星标排名7,116
7 天星标排名变化-1,152
总星标排名10,675
上次总星标排名10,674
总星标排名变化-1
国家Germany
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 The agent runs in a loop of Thought, Action, Observation, Thought, . 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: inside it's directory after cloning it. You also need to provide the following env variables: to use the OpenAI API (obtainable at: to use the Google Search in case you use that tool (obtainable at: You can simply export them in

bash like: Then you can run the script and ask your question. To construct your own agent do it like this: Of course, you can also build your custom tools or omit tools, for exmaple if you don't want to create a SERPAPI key.

常见问题

记录了多少星标和分叉?

mpaepper/llm_agents 有 1,059 个星标和 85 个分叉。

仓库排名是多少?

mpaepper/llm_agents 排名第 5,882。

记录的语言和类别是什么?

mpaepper/llm_agents 有 1,059 个星标,语言为 Python,类别为 Tutorials。

哪个仓库排名最接近?

mpaepper/llm_agents 与 microsoft/lets-learn-mcp-python 比较,后者排名第 5,873,有 1,070 个星标。

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:

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.

排名相邻
同类项目