Package Manager
VAgents Package Manager
Section titled “VAgents Package Manager”The VAgents Package Manager (vibe) is a powerful tool that allows you to install, manage, and execute code packages directly from git repositories. It provides a simple way to share and distribute reusable AI agent components, tools, and workflows.
Overview
Section titled “Overview”The package manager enables you to:
- Install packages from any git repository with subdirectory support
- Manage package versions and dependencies with automatic validation
- Execute packages with dynamic CLI argument parsing and pipe support
- Create and share your own packages using built-in templates
- Search and discover available packages by name, description, and tags
How it Works
Section titled “How it Works”At a high level, the manager:
- Validates package structure by reading
package.yaml|yml|json(orvagents.yaml|yml) and ensuring the entry file exists - Registers packages in a local registry (
~/.vagents/packages/registry.json) with metadata and install path - Executes the configured
entry_pointfrom the installed package directory in a sandboxed context that temporarily augmentssys.path - Supports two execution modes:
- Agent-aware: If the entry point is an
AgentModulesubclass or a function that acceptsAgentInput, the manager constructsAgentInputfrom CLI args/stdin and coerces return values toAgentOutputwhen possible - Legacy callable: If the entry point is a plain function/class, it is invoked with parsed args/kwargs; stdin is passed via common names (
input/stdin/content) when available
- Agent-aware: If the entry point is an
This enables seamless integration with AgentModule implementations while preserving compatibility with simpler callables.
Installation
Section titled “Installation”The package manager comes bundled with VAgents. Once you have VAgents installed, you can use the vibe command:
pip install v-agentsVerify installation:
vibe --helpBasic Usage
Section titled “Basic Usage”Installing Packages
Section titled “Installing Packages”Install a package from a git repository:
vibe install https://github.com/username/my-package.gitInstall a package by bare name from the default packages catalog:
vibe install code-review # resolves to https://github.com/vagents-ai/packages/code-reviewInstall from a specific branch:
vibe install https://github.com/username/my-package.git --branch developInstall from a subdirectory within the repository:
vibe install https://github.com/username/my-package.git/packages/subpackageForce reinstall (overwrite existing package):
vibe install https://github.com/username/my-package.git --forceListing Installed Packages
Section titled “Listing Installed Packages”View all installed packages:
vibe listGet output in JSON format:
vibe list --format jsonPackage Information
Section titled “Package Information”Get detailed information about a specific package:
vibe info my-packageGet help for a package’s CLI arguments:
vibe help-package my-packageUpdating Packages
Section titled “Updating Packages”Update a package to the latest version:
vibe update my-packageUpdate from a specific branch:
vibe update my-package --branch developUninstalling Packages
Section titled “Uninstalling Packages”Remove a package:
vibe uninstall my-packageExecuting Packages
Section titled “Executing Packages”Dynamic CLI Argument Parsing
Section titled “Dynamic CLI Argument Parsing”The package manager automatically parses CLI arguments based on each package’s configuration:
# Basic executionvibe run my-package
# With package-specific argumentsvibe run code-analyzer --history 5 --verbosevibe run data-processor --config analysis.json --output results.csvvibe run file-converter --input-format json --output-format yamlOutput Formats
Section titled “Output Formats”Choose from multiple output formats:
vibe run my-package --format rich # Rich formatted output (default)vibe run my-package --format plain # Plain text outputvibe run my-package --format json # JSON outputvibe run my-package --format markdown # Markdown outputPipe and Stdin Support
Section titled “Pipe and Stdin Support”Packages automatically support stdin input when used with pipes:
# Process file contentcat data.txt | vibe run text-analyzer --verbose
# Process command outputls -la | vibe run file-processor
# Chain with other commandscurl -s https://api.example.com/data | vibe run api-analyzer --config api.yaml
# Process multiple filesfind . -name "*.log" -exec cat {} \; | vibe run log-analyzer --format jsonLegacy Argument Passing (Deprecated)
Section titled “Legacy Argument Passing (Deprecated)”For backward compatibility, you can still use the legacy format:
# Pass positional argumentsvibe run-legacy my-package --args "arg1" "arg2" "arg3"
# Pass keyword arguments as JSONvibe run-legacy my-package --kwargs '{"param1": "value1", "param2": 42}'Package Manager Status
Section titled “Package Manager Status”Check the package manager status:
vibe statusThis shows:
- Base directory location (~/.vagents/packages)
- Number of installed packages
- Package summary with versions
- Total disk usage
Creating Packages
Section titled “Creating Packages”Package Template
Section titled “Package Template”Create a new package template:
vibe create-template my-new-packageCreate in a specific directory:
vibe create-template my-new-package --output-dir ./packagesThis creates a package structure with:
package.yaml- Package configurationmy-new-package.py- Main module with example implementationREADME.md- Documentation with usage examples
Package Configuration
Section titled “Package Configuration”Each package requires a package.yaml configuration file:
name: my-packageversion: 1.0.0description: A sample VAgents packageauthor: Your Namerepository_url: https://github.com/yourusername/my-package.gitentry_point: my_package.maindependencies: []python_version: ">=3.8"tags: - vagents - examplearguments: - name: verbose type: bool help: Enable verbose output short: v required: false - name: config type: str help: Configuration file path short: c required: false - name: history type: int help: Number of historical records to process default: 10 required: falseConfiguration Fields:
name: Package identifier (required)version: Semantic version string (required)description: Brief package description (required)author: Package author name (required)repository_url: Git repository URL (required)entry_point: Module.function or Module.Class to execute (required)dependencies: List of Python package dependenciespython_version: Minimum Python version requirementtags: List of tags for categorization and searcharguments: CLI argument definitions with type validation
Argument Types:
str: String valuesint: Integer valuesfloat: Float valuesbool: Boolean flags (use--flagsyntax)list: Lists of values (use--items value1 value2 value3)
Argument Properties:
name: Argument name (creates--nameCLI option)type: Value type for validationhelp: Description shown in help textshort: Single letter shortcut (creates-xoption)required: Whether argument is mandatorydefault: Default value if not providedchoices: List of allowed values
Package Entry Points
Section titled “Package Entry Points”The entry point must be a callable function or class that can accept arguments:
Function Entry Point
Section titled “Function Entry Point”def main(verbose=False, config=None, input=None, stdin=None, **kwargs): """ Main entry point for the package
Args: verbose (bool): Enable verbose output config (str): Configuration file path input (str): Input content from stdin/pipes stdin (str): Alias for input parameter **kwargs: Additional CLI arguments
Returns: Any: Result that will be displayed to the user """ # Handle stdin input (input and stdin are aliases) content = input or stdin
result = { "message": "Hello from my package!", "verbose": verbose, "config": config, "has_input": content is not None, "args": kwargs }
if verbose: print(f"Processing with config: {config}") if content: print(f"Input length: {len(content)} characters")
# Process the input content if provided if content: result["processed_input"] = { "length": len(content), "lines": len(content.splitlines()), "words": len(content.split()), "analysis": analyze_content(content) }
return result
def analyze_content(content): """Example processing function""" if "error" in content.lower(): return "Input contains error messages" elif "success" in content.lower(): return "Input contains success messages" else: return "Input analyzed successfully"Class Entry Point
Section titled “Class Entry Point”class MyPackage: def __call__(self, *args, **kwargs): return self.execute(*args, **kwargs)
def execute(self, verbose=False, config=None, **kwargs): # Implementation here return {"result": "success", "verbose": verbose}Publishing Packages
Section titled “Publishing Packages”- Create your package using the template
- Implement your functionality in the main module
- Update configuration in
package.yamlwith proper details - Test locally before publishing:
Terminal window # Test your implementationpython my_package.py --verbose --config test.jsonecho "test data" | python my_package.py --verbose - Initialize git repository:
Terminal window git initgit add .git commit -m "Initial commit"git remote add origin https://github.com/yourusername/my-package.gitgit push -u origin main - Users can install with:
Terminal window vibe install https://github.com/yourusername/my-package.git
Advanced Usage
Section titled “Advanced Usage”Debug Mode
Section titled “Debug Mode”Enable debug logging by setting the environment variable:
export LOGLEVEL=DEBUGvibe install https://github.com/username/package.gitProgrammatic Usage
Section titled “Programmatic Usage”You can also use the package manager directly in Python:
from vagents.manager.package import PackageManager
# Initialize package managerpm = PackageManager()
# Install a packagepm.install_package("https://github.com/user/package.git", branch="main", force=False)
# List installed packagespackages = pm.list_packages()print(packages)
# Execute a package with argumentsresult = pm.execute_package("package-name", verbose=True, config="myconfig.json")
# Execute with stdin inputcontent = "data to process"result = pm.execute_package("package-name", input=content, verbose=True)
# Update a packagepm.update_package("package-name", branch="main")
# Uninstall a packagepm.uninstall_package("package-name")Configuration Files
Section titled “Configuration Files”Supported Configuration Formats:
The package manager supports multiple configuration file formats:
package.yaml(preferred)package.ymlpackage.jsonvagents.yamlvagents.yml
Default Directories:
- Base directory:
~/.vagents/packages - Registry file:
~/.vagents/packages/registry.json - Package storage:
~/.vagents/packages/packages/
Custom Configuration:
# Use custom base directorypm = PackageManager(base_path="/custom/path")Security Considerations
Section titled “Security Considerations”- Trust your sources - Only install packages from trusted repositories
- Review package code - Check the source code before installation
- Use version pinning - Pin to specific versions for production use
- Regular updates - Keep packages updated for security patches
- Validate inputs - Packages run with user privileges
- Monitor execution - Watch for unexpected behavior or resource usage
Error Handling
Section titled “Error Handling”The package manager provides comprehensive error handling:
try: result = pm.execute_package("package-name") if isinstance(result, dict) and "error" in result: print(f"Package execution failed: {result['error']}")except ValueError as e: print(f"Package not found: {e}")except Exception as e: print(f"Unexpected error: {e}")Package Development Best Practices
Section titled “Package Development Best Practices”- Use descriptive names for packages and arguments
- Provide comprehensive help text for all CLI arguments
- Handle errors gracefully with meaningful error messages
- Support stdin/pipe input for data processing packages
- Return structured data (dict/list) for better formatting
- Include examples in your README
- Version your packages semantically
- Test with different input types and edge cases
- Document dependencies clearly
- Use appropriate tags for discoverability
Integration with VAgents
Section titled “Integration with VAgents”Searching and Discovering Packages
Section titled “Searching and Discovering Packages”Search locally registered packages by name, description, and tags:
vibe search --query analyzervibe search --tags ai toolsProgrammatic search:
from vagents.manager.package import PackageManager
pm = PackageManager()matches = pm.search_packages(query="analyzer", tags=["ai"])Agent-aware vs Legacy Execution
Section titled “Agent-aware vs Legacy Execution”To leverage protocol-aware execution, implement one of:
- Class entry: subclass
vagents.core.AgentModuleand implementasync forward(input: AgentInput) -> AgentOutput|dict|Any - Function entry: define a function that accepts an
AgentInputparameter
The manager will:
- Construct
AgentInputwith payload from CLI args and piped stdin - Coerce plain dict results into
AgentOutput(result=...)where applicable - Fall back to legacy invocation for simple callables, passing stdin as
input/stdin/contentwhen possible
The package manager integrates seamlessly with the VAgents framework:
# Use in VAgents modulesfrom vagents.manager.package import PackageManager
class MyVAgentsModule: def __init__(self): self.package_manager = PackageManager()
async def process_request(self, request): # Use external packages in your processing analysis_result = self.package_manager.execute_package( "data-analyzer", data=request.data, config="analysis.yaml" ) return analysis_result