Core principles for packaging AI agents and automations as installable software. Use when the user mentions: agent packaging, packaging principles, install funnel, agent dependencies, packaging anti-patterns, why agents are hard to install, agent distribution basics, package an agent, make agent installable, agent install UX
Traditional software has a single runtime, a known dependency tree, and a build artifact. AI agents break every assumption:
| Challenge | Traditional Software | AI Agents |
|---|---|---|
| Secrets | Maybe one DB connection string | 3-8 API keys across providers (OpenAI, Anthropic, Pinecone, etc.) |
| Model weights | No large binary blobs | 500MB-70GB model files that can't ship in a package |
| Runtime environment | One language runtime | Python + Node.js + system libs + CUDA/Metal |
| Config sprawl | One config file | .env, config.yaml, plugin.json, mcp.json, framework configs, all in different directories |
| Framework churn | Stable APIs | LangChain, CrewAI, AutoGen — breaking changes monthly |
| Hardware variance | CPU is CPU | GPU type, VRAM, quantization level all affect behavior |
| State | Database handles it | Vector stores, conversation memory, tool caches across restarts |
The result: an agent that works on the author's machine silently depends on 15 things the author forgot they installed.
# GOOD: single entry point
npx @your-org/my-agent install
npx @your-org/my-agent uninstall
# GOOD: platform package manager
brew install my-agent && brew uninstall my-agent
# BAD: multi-step scavenger hunt
git clone ... && cd ... && pip install -r ... && cp config.example.yaml ...
If your install instructions have more than one step, wrap them in a script.
# GOOD: read at runtime
OPENAI_API_KEY=sk-... my-agent start
# GOOD: .env file (gitignored)
my-agent init # creates .env template with comments
# BAD: baked into config
# config.yaml: api_key: "sk-proj-abc123..."
Ship a .env.example with every key listed, commented, and explained. Never write a real key to disk in plaintext unless the user explicitly opts in.
The author's machine has everything. Test on:
docker run -it ubuntu:24.04 bash)If you skip this, your first 50 users will file the same bug.
Show the simplest install method first. Collapse alternatives.
## Install
npm install -g my-agent
<details>
<summary>Alternative: install from source</summary>
git clone ...
</details>
<details>
<summary>Alternative: Docker</summary>
docker run ...
</details>
Every agent should have a doctor or health command:
$ my-agent doctor
[PASS] Node.js 20.11.0
[PASS] Python 3.12.1
[FAIL] ANTHROPIC_API_KEY not set
Fix: export ANTHROPIC_API_KEY=your-key-here
Get a key: https://console.anthropic.com/keys
[FAIL] chromadb not reachable at localhost:8000
Fix: docker run -d -p 8000:8000 chromadb/chroma
Never print a stack trace without a human-readable sentence above it.
Don't ask for API keys during install. Ask on first use.
$ my-agent install # no keys needed
$ my-agent run "do thing"
> This task requires an Anthropic API key.
> Get one at: https://console.anthropic.com/keys
> Enter your key (or set ANTHROPIC_API_KEY): _
Why: users abandon installs that demand credentials upfront. Let them see the tool first.
Ship sensible defaults. Only ask the user to configure what they must.
# BAD: 40-line config.yaml the user must edit before first run
# GOOD: zero config needed, everything has defaults
# config.yaml (optional overrides)
# model: claude-sonnet-4-20250514 # default: claude-sonnet-4-20250514
# max_tokens: 4096 # default: 4096
# log_level: info # default: info
Auto-detect everything you can:
# Detect OS and architecture
OS=$(uname -s) # Darwin, Linux, MINGW...
ARCH=$(uname -m) # x86_64, arm64...
# Detect shell
SHELL_NAME=$(basename "$SHELL") # bash, zsh, fish
# Detect package manager
if command -v brew &>/dev/null; then ...
elif command -v apt &>/dev/null; then ...
# Detect GPU
if command -v nvidia-smi &>/dev/null; then ... # NVIDIA
if system_profiler SPDisplaysDataType | grep -q "Metal"; then ... # Apple Silicon
Never ask "What OS are you on?" or "Do you have a GPU?"
Classify every dependency your agent needs:
| Type | Examples | Install Strategy | |---|---|---| | API-only | OpenAI, Anthropic, Tavily | No install; just need keys at runtime | | Model weights | GGUF files, LoRA adapters, embeddings | Download on first use, verify checksum, cache locally | | Runtime | Python 3.11+, Node.js 20+, Rust | Check version, link to installer, or bundle | | Framework | LangChain, CrewAI, Haystack, DSPy | Pin exact version in requirements; these break often | | Infrastructure | Redis, Postgres, ChromaDB, Qdrant | Offer Docker one-liner or cloud-hosted alternative |
Rule of thumb: API-only deps are free (just keys). Every other category adds install friction. Minimize the non-API categories ruthlessly.
Discovery 100 users find your agent
|
Install attempt 60 users try to install (40% bounce from bad README)
|
Configuration 35 users finish install (25 hit dependency errors)
|
First successful 20 users get it working (15 stuck on config/keys)
run
|
Retention 12 users keep using it (8 hit bugs on second use)
Where agents lose people:
Optimize the narrowest part of your funnel first.
# BAD
1. Clone the repo
2. Install dependencies
3. Set up your environment
4. Run the agent
The author has Python 3.11, six API keys exported, CUDA 12.1, and a running ChromaDB. None of this is mentioned.
Requiring the user to create or edit 3+ config files before first run. Merge them or generate them.
Shipping a config.yaml with api_key: "REPLACE_ME". Users will commit their real key. Use .env + .gitignore instead.
Downloading 4GB of model weights during pip install before the user knows if the agent even works. Download on first use, not on install.
Requiring a specific LangChain version that conflicts with the user's other agents. Use virtual environments or containers.
Agent installs successfully, runs without error, but silently does nothing because a vector store isn't connected. Always validate the full chain on startup.
User can't figure out what was installed or where. Always provide uninstall or document exactly what files/dirs were created.
Requiring sudo pip install or sudo npm install -g. Install to user space. If you need system access, explain exactly why.
npx skills add phazurlabs/agent-packaging-foundations下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer