RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Fredoline Eruo
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /Courses
  5. /Custom Agent Frameworks
  6. /Ch. 21
Custom Agent Frameworks

21. Package Distribution

Chapter 21 of 24 · 20 min
KEY INSIGHT

Package distribution enables collaboration but introduces dependency management challenges. Keep agent dependencies minimal and well-documented. Large dependency trees guarantee conflicts.

Code that lives only on your machine doesn't exist. Distributing agents as packages enables reuse, version management, and collaboration.

Package Structure

# pyproject.toml for agent packages

[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "my-text-processor"
version = "0.2.1"
description = "Text processing agent for document analysis"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "numpy>=1.24.0",
    "transformers>=4.30.0",
]

[project.optional-dependencies]
dev = ["pytest>=7.0", "pytest-asyncio>=0.21", "black", "mypy"]

[project.entry-points]
"agentframework.agents" = "my_text_processor:TextProcessorAgent"

Agent Discovery via Entry Points

Let other packages discover your agent automatically:

# In your agent package's __init__.py
from importlib.metadata import entry_points

def get_available_agents() -> dict[str, type]:
    """Discover all registered agents."""
    try:
        eps = entry_points(group="agentframework.agents")
        return {ep.name: ep.load() for ep in eps}
    except TypeError:  # Python 3.9 compatibility
        eps = entry_points().get("agentframework.agents", [])
        return {ep.name: ep.load() for ep in eps}

Version Compatibility

Agents often depend on specific framework versions:

from packaging.requirements import Requirement

def check_compatibility(agent_version: str, framework_version: str) -> bool:
    """Check if an agent is compatible with the current framework."""
    requirements = [
        "agent-framework>=1.0.0,<2.0.0",  # From agent's pyproject.toml
    ]
    
    for req in requirements:
        requirement = Requirement(req)
        # Simple version check - real implementation uses packaging.version
        # This is illustrative only
        pass

Dependency Conflicts

Agents with conflicting dependencies can't run in the same process. Document this:

# In your agent's README

## Requirements

- Python 3.10 or later
- This agent requires `torch==2.0.0` specifically due to model checkpoint compatibility.
  
## Known Conflicts

- Cannot run alongside `image-generator` agent in the same process 
  (torch version mismatch). Run in separate processes or containers.

Local verification checkpoint

Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.

EXERCISE

Package an existing agent following these patterns. Publish to a private package index. Create a second project that discovers and uses the packaged agent.

← Chapter 20
Documentation
Chapter 22 →
Plugin Architecture