You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A nano, minimalistic, and lightweight library for building ReACT-based AI agents that use tools to solve tasks.
📦 Installation
pip install nanoagents
🕹️ Usage
fromnanoagentsimportAgentfromgroqimportGroq# You can define a function to make any llm call, it should take a string as input.defcall_llm(prompt: str) ->str:
api_key="$YOUR_API_KEY"client=Groq(api_key=api_key)
messages= [{"role": "user", "content": prompt}]
response=client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=messages
)
returnresponse.choices[0].message.contentagent=Agent(llm=call_llm)
@agent.tool("add") # Create a tool named "add"defadd(a: int, b: int) ->int:
"""Add two numbers."""returna+bresult=agent.run("Calculate 2 + 3")
print(result)
⚠️This is still a work in progress, feel free to contribute!