Observed since 20 Oct, 22:27 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
AI Agent Utilities - Powerful toolkit for building AI agents with LLM integration and decorators
A powerful Python toolkit for building AI agents with LLM integration, decorators for easy function calling, and utility functions.
pip install agentils
.env.example to .env and fill in your credentialspython setup_dev.py
⚠️ Security Note: Never commit credentials to version control!
# Publish to both PyPI and private repo
python publish.py
# Publish to PyPI only
python publish.py --target pypi
# Publish to private repo only
python publish.py --target repoflow
# Windows users
publish.bat both
.env file# From PyPI (public)
pip install agentils
# From private repository
pip install agentils --index-url https://api.repoflow.io/pypi/eric-4092/erpy/simple/
from agentils import AgentsUtils
import os
# Set your API key
os.environ['GOOGLE_API_KEY'] = 'your-api-key-here'
# Simple text generation
@AgentsUtils.execute_llm(output="text")
def generate_story():
return "Write a short story about a robot learning to paint."
story = generate_story()
print(story)
@AgentsUtils.execute_llm(output="json")
def analyze_sentiment():
return """
Analyze the sentiment of this text and return JSON with 'sentiment' and 'confidence':
"I love this new AI assistant!"
"""
result = analyze_sentiment()
print(result) # {'sentiment': 'positive', 'confidence': 0.95}
def get_weather(location: str) -> str:
"""Get the current weather for a location."""
return f"The weather in {location} is sunny and 72°F"
@AgentsUtils.execute_llm_with_tools(
tools=[get_weather], # Pass Python functions directly!
automatic_function_calling=True
)
def weather_assistant():
return "What's the weather like in San Francisco?"
response = weather_assistant()
print(response)
@AgentsUtils.execute_llm_with_tools(
model_name="gemini-2.0-flash-001",
temperature=0.7,
max_output_tokens=1000,
system_instruction="You are a helpful coding assistant",
tools=[get_weather],
output="json"
)
def advanced_task():
return "Help me plan a coding project with weather considerations"
# Create a chat session for multi-turn conversations
chat = AgentsUtils.create_chat_session(
system_instruction="You are a helpful assistant",
tools=[get_weather]
)
response1 = chat.send_message("Hello!")
response2 = chat.send_message("What's the weather in Tokyo?")
from agentils import Utils
# JSON operations
data = Utils.string_to_dict('{"key": "value"}')
json_str = Utils.dict_to_string({"key": "value"})
# File operations
Utils.save_dict_to_file(data, "data.json")
loaded_data = Utils.load_dict_from_file("data.json")
execute_llm(**kwargs)Simple decorator for LLM calls without tools.
Parameters:
model_name (str): Model to use (default: "gemini-2.0-flash-001")output (str): "json" or "text"api_key (str, optional): API key (uses GOOGLE_API_KEY env var)system_instruction (str, optional): System instructiontemperature (float, optional): Temperature settingmax_output_tokens (int, optional): Max output tokensexecute_llm_with_tools(**kwargs)Advanced decorator with tools support.
Additional Parameters:
tools (list): List of Python functions or Tool objectsautomatic_function_calling (bool): Enable automatic function callingmax_function_calls (int): Maximum number of function callscreate_chat_session(**kwargs)Create a chat session for multi-turn conversations.
string_to_dict(s: str) -> dictConvert JSON string to dictionary.
dict_to_string(d: dict) -> strConvert dictionary to JSON string.
save_dict_to_file(d: dict, filename: str)Save dictionary to JSON file.
load_dict_from_file(filename: str) -> dictLoad dictionary from JSON file.
GOOGLE_API_KEY: Your Google AI API key (required)GEMINI_API_KEY: Alternative API key variable nameMIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues or have questions, please open an issue on GitHub.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 16 Aug 2025 | 7 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:27 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:1e4ba938698d51df820f314a65bba8fd0536736be3271af948acee7a02f50f0f