AgenticWrapper
English | 简体中文
AgenticWrapper is an extremely lightweight Python Agent framework that wraps your custom LLM function, enabling it with Agent capabilities, including tool calling, memory management, and structured output.
AgenticWrapper has no runtime dependencies.
Quick Start
Installation
pip install AgenticWrapper
Basic Usage
from AgenticWrapper import Agent
async def llm_func(messages: list[dict[str, str]]) -> str:
# Assume this is your custom LLM function
return "Hello, I'm AgenticWrapper."
agent = Agent(llm_func)
response = await agent.query("Hello")
print(response)
agent.clear_memory()
Structured Output
Use Python dataclass to define the output structure:
@dataclass
class SearchResult:
query: str
results: List[str]
total_count: int
response = await agent.query("Search for relevant content", structured_output_type=SearchResult)
assert isinstance(response, SearchResult)
Tool Calling
Define a tool function, preferably with function documentation:
async def get_weather(location: str) -> str:
"""Get weather information"""
# Simulate an API call
await asyncio.sleep(0.1)
if location.lower() == "london":
return "The weather is clear, with a temperature of 15°C."
elif location.lower() == "paris":
return "The weather is clear, with a temperature of 18°C."
else:
return f"I don't know the weather for {location}."
Use the tool in the Agent:
agent = Agent(llm_interaction_func=mock_llm_func, tools=[get_weather])
response = await agent.query("Check the weather in london")
print(response)
Tool function parameters types must be valid json types, return types must be str.
More Examples
More examples can be found in example.py.
Release files for AgenticWrapper 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agenticwrapper-0.1.2.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agenticwrapper-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.6 kB
Release files / agenticwrapper-0.1.2.tar.gz
| Download URL | agenticwrapper-0.1.2.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d26b99712af5665ca7a0d8fd2b0f6a81b95ddef0454616d15f36b050ffbd95c
|
|
BLAKE2b-256 checksum How to use checksums |
2ee803a70e7027d07474fd6ed7663c678de84e011856a4839a977a8c3d1cc063
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.7
|
Release files / agenticwrapper-0.1.2-py3-none-any.whl
| Download URL | agenticwrapper-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bb6db6be63bd326f099e384ade35cae363e1cb7da7b70e80a56cbea87eeb1af
|
|
BLAKE2b-256 checksum How to use checksums |
3a91d111ea5222e982f2a72c41b4104952c10f85dcd39c0da44035711587abc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.7
|