Shared utilities for Autourgos agents — colored logger, tool executor, and history tracking.
Project description
Autourgos Agent Utils
Essential, reusable utilities for building and managing AI agents in the Autourgos ecosystem.
Welcome to the autourgos-agent-utils package. This library provides comprehensive, high-performance utilities for colored console logging, dynamic tool execution, structured conversation history tracking, and managing context-windowed scratchpads.
Built to simplify agent infrastructure, it abstracts away the complex boilerplate of tool invocation and state tracking so you can focus on building intelligent agent logic.
Table of Contents
Installation
Install the utility package using pip:
pip install autourgos-agent-utils
Note: This package depends on
autourgos-core >= 0.1.0.
Agent Logging
AgentLogger provides enhanced, colored console logging tailored specifically for agent workflows (Thoughts, Actions, Observations, Final Answers).
from autourgos_agent_utils import create_logger
# Initialize a colored logger for a specific agent
logger = create_logger("MyAgent")
logger.info("Agent initialized successfully.")
logger.warning("Approaching token limits.")
Tool Execution
Robust dynamic tool execution components (Tool_Executor and AsyncTool_Executor) safely invoke external functions and tools, automatically handling parameter injection and error recovery.
from autourgos_agent_utils import Tool_Executor, register_tool
@register_tool
def get_weather(location: str) -> str:
"""Fetches the weather for a given location."""
return f"The weather in {location} is sunny."
tools = [get_weather]
executor = Tool_Executor(tools)
# Dynamically execute a tool by name with dictionary arguments
result = executor.execute("get_weather", {"location": "London"})
print(result) # Output: The weather in London is sunny.
Memory & History
AgentHistoryLogger
Keep track of conversational trails and reasoning steps with markdown-based history export.
from autourgos_agent_utils import AgentHistoryLogger
history = AgentHistoryLogger(agent_name="ResearchBot", enabled=True)
history.start_task("I need to find the latest documentation.")
history.log_iteration(
iteration_num=1,
thought="I should search for the latest documentation.",
tools=[{"tool": "search_web", "params": {"query": "autourgos docs"}}],
observations=[{"tool": "search_web", "result": "Found 5 documents."}]
)
history.log_final("Here are the latest docs.")
Helper Functions
The package exposes various utility functions for common agent tasks:
parse_json_object: Safely extracts and parses JSON strings embedded deep within raw LLM text responses.check_timeout: Evaluates elapsed execution time against configured limits.escape_prompt_braces: PreventsKeyErrorexceptions when utilizing.format()on prompts containing raw JSON structures.
Project details
Release history Release notifications | RSS feed
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 autourgos_agent_utils-0.1.0.tar.gz.
File metadata
- Download URL: autourgos_agent_utils-0.1.0.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee3c1b5aff3a69ad5f627954a72ad65e468f071abdb0a2b598335004fd503c2a
|
|
| MD5 |
0adf8beeb37232ecd514062f15b4ea8d
|
|
| BLAKE2b-256 |
b4876d5819dc72d81b93e7c9b63c9a1cc4b890cc995768b273bc479a88bc436d
|
File details
Details for the file autourgos_agent_utils-0.1.0-py3-none-any.whl.
File metadata
- Download URL: autourgos_agent_utils-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96bb3359bba05a9492b5c2f0dfdc682a01683aa79119b5ba0293188d08d0845b
|
|
| MD5 |
9c7f071e94d8f94634ff47dbcd1af0ac
|
|
| BLAKE2b-256 |
d10b564379b825d0f14acbc292df2006c77c5d3d18ffa921510a33d70a2b83bb
|