Skip to main content

AgentAmi

AgentAmi is a flexible agentic framework built using LangGraph, designed to scale with large numbers of tools and intelligently select the most relevant ones for a given user query. It helps with decreasing token size significantly.

It supports:

  • Dynamic tool selection via inbuilt runtime RAG (very efficient) with an option to easily replace it with your own tool_selector.
  • Pruner to limit context length and improve performance (it's inbuilt, you don't have to do anything).

Quick start

Refer the main.py file for a complete sample usage.

pip install agentami
from agentami import AgentAmi
from langchain.chat_models import ChatOpenAI
from langgraph.checkpoint.memory import InMemorySaver
from agentami.agents.ami import AgentAmi

# Replace ... (ellipsis) with the commented instructions

tools = [...]  # List of LangChain-compatible tools
agent = AgentAmi(
    model=ChatOpenAI(model="gpt-4o"),
    tools=tools,  # List of LangChain-compatible tools
    checkpointer=InMemorySaver(),  # Optional. No persistence if omitted.

    # Optional parameters:
    tool_selector=...,  # Custom function to select relevant tools. Defaults to internal tool_selector.
    top_k=...,  # Number of top tools to use. Defaults to 3.
    context_size=...,  # Number of past user prompts to retain. Defaults to 7.
    disable_pruner=...,  # If True, disables pruning & will increase token usage. Defaults to False
    prompt_template=...  # Custom prompt template. Defaults to a generic bot template.
)
agent_ami = agent.graph # Your regular langgraph's graph.

Things you should be aware about:

  • Running for the first time will take time as it installs the dependencies (models used by internal tool_selector).
  • Your first agent_ami.invoke() or agent_agent_ami.astream() may take time if you have hundreds of tools, because it initialises a vector store and embeds the tool descriptions at runtime for each AgentAmi() object
  • Your eventual prompts' response time would be fine.
  • Checkout ROADMAP.md file for future features.

How to integrate your own tool selector?

Just make a function that accepts (query: str, top_k: int) and parameters and returns List[str] #List of tool names.

from typing import List


# function template:
def my_own_tool_selector(query: str, top_k: int) -> List[str]:
    # Your logic to select tools based on the query
    return ["tool1", "tool2", "tool3"]  # Return top_k selected tool names

AgentAmi

Release files for agentami 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentami 1.0.1
File Size Uploaded
agentami-1.0.1.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentami 1.0.1
File Interpreter ABI Platform
agentami-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / agentami-1.0.1.tar.gz

Download URL agentami-1.0.1.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b79b6e72975070dd9f0f5e0c82e8b20f46af0c4c941ccab22c2f1a99b029dc13
BLAKE2b-256 checksum
How to use checksums
daa27c18e8d2b701ca582e9983228165c565596fb5067699d7f64c44b9be3b27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / agentami-1.0.1-py3-none-any.whl

Download URL agentami-1.0.1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fd2e5607c3fed53a8d40b03988a5b5ddbc3a4182872922ed112c1caab2023d6
BLAKE2b-256 checksum
How to use checksums
51e827eeeccea5ed9cc47cdce0ebd6c12ad1083e54881b22df0ecaabc5a6c526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page