Agent Packaging Strategy
Date: 2025-11-02
Overview
Section titled “Overview”As agents become more complex and function-specific, they should be developed as independent packages/repositories. This allows for:
- Specialized development teams per agent
- Independent versioning and release cycles
- Complex dependencies isolated from core system
- Community contributions to specific agents
- Mix-and-match agent capabilities
Package Architecture
Section titled “Package Architecture”Core Package: embodied-ai-architect
Section titled “Core Package: embodied-ai-architect”Purpose: Provides the orchestration framework and agent interfaces
Contains:
- Orchestrator class
- BaseAgent abstract class
- AgentResult and message schemas
- Agent registry and discovery
- Workflow management
Minimal dependencies:
- pydantic (for data models)
- Basic Python stdlib
Agent Packages: Independent Repositories
Section titled “Agent Packages: Independent Repositories”Each agent is a separate Python package following the naming convention:
embodied-ai-architect-{agent-name}
Example agent packages:
embodied-ai-architect-model-analyzer- Model analysis capabilitiesembodied-ai-architect-benchmark- Benchmarking and profilingembodied-ai-architect-hardware-profile- Hardware knowledge baseembodied-ai-architect-transpiler-cpp- C++ code generationembodied-ai-architect-transpiler-rust- Rust code generationembodied-ai-architect-validator- Accuracy/robustness validation
Agent Package Structure
Section titled “Agent Package Structure”embodied-ai-architect-benchmark/├── pyproject.toml├── README.md├── src/│ └── embodied_ai_architect_benchmark/│ ├── __init__.py│ ├── agent.py # Main BenchmarkAgent class│ ├── backends/ # Execution backends│ │ ├── __init__.py│ │ ├── base.py # Backend interface│ │ ├── local_cpu.py│ │ ├── local_gpu.py│ │ └── remote.py│ ├── profilers/ # Specialized profilers│ │ ├── latency.py│ │ ├── throughput.py│ │ ├── memory.py│ │ └── energy.py│ └── utils/├── tests/└── examples/Backend Plugin Architecture
Section titled “Backend Plugin Architecture”Agents that need to dispatch work (like benchmarking) should use a backend plugin pattern:
# Backend interfaceclass BenchmarkBackend(ABC): @abstractmethod def execute_benchmark(self, model, config) -> BenchmarkResult: pass
@abstractmethod def is_available(self) -> bool: pass
# Specific backends can be separate sub-packagesclass LocalCPUBackend(BenchmarkBackend): """Simple local CPU execution""" pass
class RemoteClusterBackend(BenchmarkBackend): """Dispatch to Kubernetes cluster""" pass
class RobotBackend(BenchmarkBackend): """Deploy to physical robot for real-world testing""" passInstallation Patterns
Section titled “Installation Patterns”Basic Installation
Section titled “Basic Installation”pip install embodied-ai-architectpip install embodied-ai-architect-model-analyzerpip install embodied-ai-architect-benchmarkWith Extras
Section titled “With Extras”# Install benchmark agent with all backendspip install embodied-ai-architect-benchmark[remote,robot,gpu]
# Install only core + local CPU benchmarkingpip install embodied-ai-architect-benchmarkMonorepo Alternative (Development)
Section titled “Monorepo Alternative (Development)”For development, you can use a monorepo structure:
embodied-ai-architect/├── packages/│ ├── core/│ ├── agent-model-analyzer/│ ├── agent-benchmark/│ ├── agent-hardware-profile/│ └── agent-transpiler-cpp/Agent Discovery & Registration
Section titled “Agent Discovery & Registration”Manual Registration
Section titled “Manual Registration”from embodied_ai_architect import Orchestratorfrom embodied_ai_architect_benchmark import BenchmarkAgentfrom embodied_ai_architect_model_analyzer import ModelAnalyzerAgent
orchestrator = Orchestrator()orchestrator.register_agent(ModelAnalyzerAgent())orchestrator.register_agent(BenchmarkAgent(backend="local_cpu"))Auto-discovery (Future)
Section titled “Auto-discovery (Future)”# Agents register themselves via entry points in pyproject.tomlorchestrator = Orchestrator()orchestrator.discover_agents() # Finds all installed agent packagesAgent Interface Contract
Section titled “Agent Interface Contract”All agents must:
- Inherit from
BaseAgent(from core package) - Implement
execute(input_data: Dict) -> AgentResult - Define clear input/output schemas using Pydantic
- Provide
is_available()method to check if dependencies are met - Include comprehensive tests
Dependency Management
Section titled “Dependency Management”Core Package Dependencies
Section titled “Core Package Dependencies”- Minimal dependencies only
- No ML framework dependencies (PyTorch, TensorFlow, etc.)
Agent Package Dependencies
Section titled “Agent Package Dependencies”- Can have heavy dependencies (PyTorch, CUDA, vendor SDKs)
- Must declare all dependencies in pyproject.toml
- Use extras for optional features
Version Compatibility
Section titled “Version Compatibility”Agents declare compatible core versions:
[project]name = "embodied-ai-architect-benchmark"dependencies = [ "embodied-ai-architect>=0.1.0,<1.0.0"]Benefits of This Architecture
Section titled “Benefits of This Architecture”- Modularity: Install only what you need
- Scalability: Agents can have complex internal architectures
- Independence: Different teams can maintain different agents
- Flexibility: Mix agents from different sources
- Testing: Test agents independently
- Distribution: Share agents via PyPI or private registries
Example: Complex Benchmark Agent
Section titled “Example: Complex Benchmark Agent”The benchmark agent is a good example of complex functionality:
Internal Architecture:
- Agent Core: Coordinates benchmarking workflow
- Backends: Local, remote cluster, edge device, robot
- Profilers: Latency, throughput, memory, energy, thermal
- Result Aggregators: Statistical analysis, visualization
- Remote Communication: gRPC, REST APIs, ROS2 messages
- Hardware Interfaces: CUDA, ROCm, Intel oneAPI, vendor SDKs
This complexity justifies a separate repository with:
- Dedicated documentation
- Backend-specific examples
- Integration tests with real hardware
- CI/CD for multiple platforms
Migration Path
Section titled “Migration Path”Phase 1: Monorepo (current)
- All agents in single repo
- Rapid prototyping
- Easier to iterate on interfaces
Phase 2: Split critical agents
- Extract benchmark agent to separate repo
- Extract transpiler agents (complex dependencies)
- Keep simple agents in core
Phase 3: Full plugin ecosystem
- All agents as separate packages
- Auto-discovery mechanism
- Community agent marketplace