{"data":{"slug":"mpaepper-llm-agents","name":"llm_agents","tagline":"Library to build agents controlled by LLMs","github_url":"https://github.com/mpaepper/llm_agents","owner":"mpaepper","repo":"llm_agents","owner_avatar_url":"https://avatars.githubusercontent.com/u/4135790?v=4","primary_language":"Python","stars":1054,"forks":86,"topics":["deep-learning","langchain","llms","machine-learning"],"archived":false,"github_pushed_at":"2025-06-23T14:01:18+00:00","maintenance_label":"Dormant","stars_delta_30d":1,"url":"https://www.graphcanon.com/tools/mpaepper-llm-agents","markdown_url":"https://www.graphcanon.com/tools/mpaepper-llm-agents.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/mpaepper-llm-agents","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=mpaepper-llm-agents","description":"Build agents which are controlled by LLMs","homepage_url":"https://www.paepper.com/blog/posts/intelligent-agents-guided-by-llms/","license":"MIT","open_issues":4,"watchers":9,"ai_summary":"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.","readme_excerpt":"## LLM Agents\n\nSmall library to build agents which are controlled by large language models (LLMs) which is heavily inspired by <a href=\"https://github.com/hwchase17/langchain/\" target=\"_blank\">langchain</a>.\n\nThe goal was to get a better grasp of how such an agent works and understand it all in very few lines of code.\n\nLangchain 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.\n\nSome more infos are in <a href=\"https://news.ycombinator.com/item?id=35446171\">this Hacker News discussion from April 5th 2023</a> and the <a href=\"https://www.paepper.com/blog/posts/intelligent-agents-guided-by-llms/\">related blog post</a>.\n\n### How it works\n\nThe agent works like this:\n\n* It gets instructed by a prompt which tells it the basic way to solve a task using tools\n* Tools are custom build components which the agent can use\n    * 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\n* The agent runs in a loop of Thought, Action, Observation, Thought, ...\n    * The Thought and Action (with the Action Input to the action) are the parts which are generated by an LLM\n    * The Observation is generated by using a tool (for example the print outputs of Python or the text result of a Google search)\n* The LLM gets the new information appended to the prompt in each loop cycle and thus can act on that information\n* Once the agent has enough information it provides the final answer\n\nFor more details on how it works, check out <a href=\"https://www.paepper.com/blog/posts/intelligent-agents-guided-by-llms/\">this blog post</a>\n\n### How to use it\n\nYou can install this library locally by running: \n\n```\npip install -r requirements.txt\npip install -e .\n```\n\ninside it's directory after cloning it.\n\nYou also need to provide the following env variables:\n\n* `OPENAI_API_KEY` to use the OpenAI API (obtainable at: https://platform.openai.com/account/api-keys)\n* `SERPAPI_API_KEY` to use the Google Search in case you use that tool (obtainable at: https://serpapi.com/)\n\nYou can simply export them in bash like: `export OPENAI_API_KEY='sh-lsdf....'`\n\nThen you can run the script `python run_agent.py` and ask your question.\n\nTo construct your own agent do it like this:\n\n```python\nfrom llm_agents import Agent, ChatLLM, PythonREPLTool, HackerNewsSearchTool, SerpAPITool\n\nagent = Agent(llm=ChatLLM(), tools=[PythonREPLTool(), SerpAPITool(), HackerNewsSearchTool()])\nresult = agent.run(\"Your question to the agent\")\n\nprint(f\"Final answer is {result}\")\n```\n\nOf course, you can also build your custom tools or omit tools, for exmaple if you don't want to create a SERPAPI key.","github_created_at":"2023-04-04T21:25:35+00:00","created_at":"2026-07-11T10:53:24.464997+00:00","updated_at":"2026-09-20T05:31:27.233419+00:00","categories":[{"slug":"ai-agents","name":"AI Agents","url":"https://www.graphcanon.com/categories/ai-agents","markdown_url":"https://www.graphcanon.com/categories/ai-agents.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/ai-agents"}],"tags":[{"slug":"deep-learning","name":"deep-learning"},{"slug":"langchain","name":"langchain"},{"slug":"llms","name":"llms"},{"slug":"machine-learning","name":"machine-learning"}],"trust":{"provenance":{"is_fork":false,"github_id":623679404,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-09-20T05:31:24.752Z","maintenance":{"label":"Dormant","score":18,"methodology":"github_public_v1","releases_90d":0,"days_since_push":453,"last_release_at":null,"stars_delta_30d":1,"open_issues_delta_30d":1},"security_summary":{"status":"findings","scanner":"osv@v1","low_count":32,"high_count":0,"last_scan_at":"2026-07-11T10:53:32.820Z","medium_count":0,"scan_profile":"deps","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-09-20T05:31:25.805Z"},"has_cli":{"value":true,"source":"pyproject.toml:[project.scripts]","observed_at":"2026-09-20T05:31:25.805Z"},"languages":{"value":["python"],"source":"github.language+pyproject.toml","observed_at":"2026-09-20T05:31:25.805Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-09-20T05:31:25.805Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":{"notes":["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."],"min_ram_gb":1,"requires_docker":false},"constraints":{"min_ram_gb":1,"requires_docker":false},"when_to_use":["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."],"when_not_to_use":["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."],"source":"enrich:decision_facts","observed_at":"2026-07-14T21:21:51.389Z"},"constraint_facets":{"min_ram_gb":1,"requires_docker":false},"decision_summary":[{"label":"Requirements","value":"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."},{"label":"Adopt for","value":"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."}]}}