just-agents


Namejust-agents JSON
Version 0.0.5 PyPI version JSON
download
home_pageNone
SummaryJust Agents
upload_time2024-06-09 01:09:23
maintainerNone
docs_urlNone
authorAlex Karmazin, Anton Kulaga
requires_pythonNone
licenseNone
keywords python llm science review agents ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# just-agents
LLM agents done right, no over-engineering and redundant complexity!

# Motivation

Most of the existing agentic libraries are extremely over-engineered either directly or by using over-engineered libraries under the hood, like langchain and llamaindex.
In reality, interactions with LLMs are mostly about strings, and you can write your own template by just using f-strings and python native string templates. 
There is no need in complicated chains and other abstractions, in fact popular libraries create complexity just to sell you their paid services for LLM calls monitoring because it is extremely hard to understand what exactly is sent to LLMs.

We wrote this libraries while being pissed of by high complexity and wanted something controlled and simple.
Of course, you might comment that we do not have the ecosystem like, for example, tools and loaders. In reality, most of langchain tools are just very simple functions wrapped in their classes, you can always quickly look at them and re-implement them easier.

# Installation

If you want to install as pip package use:
```
pip install just-agents
```

If you want to contribute to the project you can use micromamba or other anaconda to install the environment
```
micromamba create -f environment.yaml
micromamba activate just-agents
```
then you can edit the library. Optionaly you can install it locally with:
```
pip install -e .
```


# Warning, the library is work in progress



# How it works

We use litellm library to interact with LLMs. 

Here is a simple example of two agents talking to each other.
It is assumed that a typical agent has role, goal and the background story.

```python
from dotenv import load_dotenv

from just_agents.chat_agent import ChatAgent
from just_agents.llm_options import LLAMA3
from loguru import logger
load_dotenv()

customer: ChatAgent = ChatAgent(llm_options = LLAMA3, role = "customer at a shop",
                               goal = "Your goal is to order what you want, while speaking concisely and clearly", task="Find the best headphones!")
storekeeper: ChatAgent = ChatAgent(llm_options = LLAMA3,
                                  role = "helpful storekeeper", goal="earn profit by selling what customers need", task="sell to the customer")


exchanges: int = 3
customer.memory.add_on_message(lambda m: logger.info(f"Customer: {m}") if m.role == "user" else logger.info(f"Storekeeper: {m}"))

customer_reply = "Hi."
for _ in range(exchanges):
    storekeeper_reply = storekeeper.query(customer_reply)
    customer_reply = customer.query(storekeeper_reply)

```

All prompts that we use are stored in yaml files that you can easily overload.

The only complex (but not mandatory) dependency that we use is Mako for prompt templates

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "just-agents",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python, llm, science, review, agents, AI",
    "author": "Alex Karmazin, Anton Kulaga",
    "author_email": "antonkulaga@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8c/db/43892713f1d80a369510f2d2183a26423696cda4643a852123212f28a0c7/just-agents-0.0.5.tar.gz",
    "platform": null,
    "description": "\n# just-agents\nLLM agents done right, no over-engineering and redundant complexity!\n\n# Motivation\n\nMost of the existing agentic libraries are extremely over-engineered either directly or by using over-engineered libraries under the hood, like langchain and llamaindex.\nIn reality, interactions with LLMs are mostly about strings, and you can write your own template by just using f-strings and python native string templates. \nThere is no need in complicated chains and other abstractions, in fact popular libraries create complexity just to sell you their paid services for LLM calls monitoring because it is extremely hard to understand what exactly is sent to LLMs.\n\nWe wrote this libraries while being pissed of by high complexity and wanted something controlled and simple.\nOf course, you might comment that we do not have the ecosystem like, for example, tools and loaders. In reality, most of langchain tools are just very simple functions wrapped in their classes, you can always quickly look at them and re-implement them easier.\n\n# Installation\n\nIf you want to install as pip package use:\n```\npip install just-agents\n```\n\nIf you want to contribute to the project you can use micromamba or other anaconda to install the environment\n```\nmicromamba create -f environment.yaml\nmicromamba activate just-agents\n```\nthen you can edit the library. Optionaly you can install it locally with:\n```\npip install -e .\n```\n\n\n# Warning, the library is work in progress\n\n\n\n# How it works\n\nWe use litellm library to interact with LLMs. \n\nHere is a simple example of two agents talking to each other.\nIt is assumed that a typical agent has role, goal and the background story.\n\n```python\nfrom dotenv import load_dotenv\n\nfrom just_agents.chat_agent import ChatAgent\nfrom just_agents.llm_options import LLAMA3\nfrom loguru import logger\nload_dotenv()\n\ncustomer: ChatAgent = ChatAgent(llm_options = LLAMA3, role = \"customer at a shop\",\n                               goal = \"Your goal is to order what you want, while speaking concisely and clearly\", task=\"Find the best headphones!\")\nstorekeeper: ChatAgent = ChatAgent(llm_options = LLAMA3,\n                                  role = \"helpful storekeeper\", goal=\"earn profit by selling what customers need\", task=\"sell to the customer\")\n\n\nexchanges: int = 3\ncustomer.memory.add_on_message(lambda m: logger.info(f\"Customer: {m}\") if m.role == \"user\" else logger.info(f\"Storekeeper: {m}\"))\n\ncustomer_reply = \"Hi.\"\nfor _ in range(exchanges):\n    storekeeper_reply = storekeeper.query(customer_reply)\n    customer_reply = customer.query(storekeeper_reply)\n\n```\n\nAll prompts that we use are stored in yaml files that you can easily overload.\n\nThe only complex (but not mandatory) dependency that we use is Mako for prompt templates\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Just Agents",
    "version": "0.0.5",
    "project_urls": null,
    "split_keywords": [
        "python",
        " llm",
        " science",
        " review",
        " agents",
        " ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "51db3f0c6085ee5e3c113539aed2e68a65c7aa5b97b03f47fcaf24f7be62b436",
                "md5": "6008d9d2dac3898b6ff8e4c8d19ed27b",
                "sha256": "c57dcca1a08de3b8c78e106d374bebcec40f0eef973e1f8319ea4a00e8e014cb"
            },
            "downloads": -1,
            "filename": "just_agents-0.0.5-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6008d9d2dac3898b6ff8e4c8d19ed27b",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 3396,
            "upload_time": "2024-06-09T01:09:21",
            "upload_time_iso_8601": "2024-06-09T01:09:21.493227Z",
            "url": "https://files.pythonhosted.org/packages/51/db/3f0c6085ee5e3c113539aed2e68a65c7aa5b97b03f47fcaf24f7be62b436/just_agents-0.0.5-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8cdb43892713f1d80a369510f2d2183a26423696cda4643a852123212f28a0c7",
                "md5": "874e9220b7e48419916b2de6956ef1e3",
                "sha256": "ee5701d823b63ad9b914edc4286b5d53cd0bf640bdb3c640c5f515b1bb48982a"
            },
            "downloads": -1,
            "filename": "just-agents-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "874e9220b7e48419916b2de6956ef1e3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4183,
            "upload_time": "2024-06-09T01:09:23",
            "upload_time_iso_8601": "2024-06-09T01:09:23.038261Z",
            "url": "https://files.pythonhosted.org/packages/8c/db/43892713f1d80a369510f2d2183a26423696cda4643a852123212f28a0c7/just-agents-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-09 01:09:23",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "just-agents"
}
        
Elapsed time: 0.35190s