Skip to main content

Reusable tools and utilities for Universal Agent stack

Project description

Universal Agent Tools

Reusable tools and utilities extracted from the Universal Agent Nexus examples.

Overview

This package contains production-ready, reusable components for:

  • Ollama + Tools Integration - Working pattern for Ollama LLMs with MCP tools
  • Code Chunking - Multi-format intelligent chunking (Python, YAML, Markdown, JSON)
  • MCP Server Framework - Base classes for creating MCP-compliant servers
  • Tool Registry - Centralized tool discovery and management
  • Codebase Analyzer - AST parsing, dependency graphs, PageRank scoring
  • GitHub Integration - CLI-based GitHub operations
  • Document Generator - Structured document generation
  • Sync State Management - Generic sync state tracking

Installation

pip install universal-agent-tools

Or install with optional dependencies:

# With Qdrant support
pip install universal-agent-tools[qdrant]

# With GitHub API support
pip install universal-agent-tools[github]

# Development dependencies
pip install universal-agent-tools[dev]

Quick Start

Ollama + Tools

from universal_agent_tools.ollama_tools import (
    MCPToolLoader,
    create_llm_with_tools
)

# Load tools from MCP server
tools = MCPToolLoader.load_from_server("http://localhost:8000/mcp")

# Create LLM with tools
llm, tools = create_llm_with_tools(tools, model="qwen2.5-coder:14b")

Code Chunking

from universal_agent_tools.code_chunking import chunk_content

# Chunk any file type
chunks = chunk_content(content, "example.py")

# Each chunk has: type, name, content, line_start, line_end, docstring
for chunk in chunks:
    print(f"{chunk['type']}: {chunk['name']} (lines {chunk['line_start']}-{chunk['line_end']})")

Tool Registry

from universal_agent_tools.tool_registry import get_registry

registry = get_registry()
registry.register_server("filesystem", "http://localhost:8000/mcp")
tools = registry.discover_tools()

for tool in registry.list_tools():
    print(f"{tool.name}: {tool.description}")

Architecture

This package follows SOLID design principles:

  • Single Responsibility - Each module has one clear purpose
  • Open/Closed - Extensible without modification (e.g., custom chunkers)
  • Liskov Substitution - Protocols/interfaces ensure substitutability
  • Interface Segregation - Focused, minimal interfaces
  • Dependency Inversion - Depend on abstractions, not concretions

Components

Priority 1 (Production-Ready)

  1. ollama_tools/ - Ollama + LangChain + MCP integration
  2. code_chunking/ - Multi-format chunking system
  3. mcp_framework/ - MCP server framework

Priority 2 (Well-Tested)

  1. tool_registry/ - Tool discovery system
  2. codebase_analyzer/ - AST analysis and dependency graphs
  3. github_tools/ - GitHub CLI integration

Priority 3 (Useful Patterns)

  1. document_generator/ - Structured document generation
  2. sync_state/ - Generic sync state tracking

Testing

# Run all tests
pytest

# With coverage
pytest --cov=universal_agent_tools

# Specific component
pytest tests/test_chunking.py

License

MIT License

Contributing

This package is extracted from universal_agent_nexus_examples. See REFACTORING_ANALYSIS.md in the examples repo for extraction details.

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

universal_agent_tools-1.1.1.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

universal_agent_tools-1.1.1-py3-none-any.whl (53.4 kB view details)

Uploaded Python 3

File details

Details for the file universal_agent_tools-1.1.1.tar.gz.

File metadata

  • Download URL: universal_agent_tools-1.1.1.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for universal_agent_tools-1.1.1.tar.gz
Algorithm Hash digest
SHA256 d0443d741ec5fbb5c182c4fa5f7a73afbabcda2d1521e3c656bf0ee5b42135c0
MD5 93120f6d5fd941786e41f52bc20b875a
BLAKE2b-256 8f3d0562bdd99a6bf5cc676f65c4f0d36b511b5b693b47eba2408cb616206dc8

See more details on using hashes here.

File details

Details for the file universal_agent_tools-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for universal_agent_tools-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e40e6f54366d58924ce0a2a501fbe6bb98cbb341499b1d28be868b4a0103c0c
MD5 189fdf7638c6e1f81637923947b4ed1d
BLAKE2b-256 4f4adba5abf79e52400ac101ee5ff562504c18bcb284faf4d2b031b7180e32b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page