A lightweight framework for building AI agents with XML-style tool calls
Project description
microAgents Framework
A lightweight framework for building AI agents with XML-style tool calls.
Features
- XML-style tool calling format for clear parameter structure
- Support for OpenAI-compatible LLM APIs
- Simple message history management
- Type-safe tool parameter handling
- Easy-to-use agent configuration
Installation
pip install microAgents
Quick Start
from microAgents.core import MicroAgent, Tool, MessageStore
from microAgents.llm import LLM
# Define a tool
def add_numbers(a: float, b: float) -> float:
return a + b
# Create an agent
llm = LLM(base_url="https://api.openai.com/v1")
agent = MicroAgent(
llm=llm,
prompt="You are a math assistant",
toolsList=[Tool("add", "Add two numbers", add_numbers)]
)
# Use the agent
message_store = MessageStore()
response = agent.execute_agent("What is 5 plus 3?", message_store)
print(response)
Tool Call Format
Tool use is formatted using XML-style tags. The tool name is enclosed in opening and closing tags, and each parameter is similarly enclosed within its own set of tags:
<TOOL_CALLS_NEEDED>
<tool_name>
<param1>value1</param1>
<param2>value2</param2>
</tool_name>
</TOOL_CALLS_NEEDED>
Multiple tool calls can be included:
<TOOL_CALLS_NEEDED>
<add>
<a>5</a>
<b>3</b>
</add>
<multiply>
<a>4</a>
<b>2</b>
</multiply>
</TOOL_CALLS_NEEDED>
Examples
Check out the examples/ directory for complete examples:
math_demo.py: Basic math operations using tool calls
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file microagents-0.1.0.tar.gz.
File metadata
- Download URL: microagents-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27e38c963d6df705be1ca4627a336cf30e671f36712b91de1a5a366f4040fad2
|
|
| MD5 |
1d9a3944f5f1b0fb4021f2f646428608
|
|
| BLAKE2b-256 |
992d154fcd6c9d71ad7299de714f45f682523384bdc5761251f8c0eca5c652af
|
File details
Details for the file microagents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: microagents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdda01e5a3dd05e4a7da40892b1ccf1b56e00468b580417a7798f5c0c17986ab
|
|
| MD5 |
db4425027b9a2fa13225e9a734565e5a
|
|
| BLAKE2b-256 |
5a7413461f328a1da95b4b25edaf247235721d9f7c54f78ae9086027e46b7bea
|