Skip to main content

AgentFactory

The universal AI agent factory — a Python SDK and a self-hosted Studio for building, running, and operating any AI agent.

PyPI version License: MIT Python 3.10+ CI Coverage Docs Code of Conduct

AgentFactory is a configuration-driven Agent OS: instead of writing a new codebase for every agent you need, you define an agent's identity, tools, and rules as data and the same engine brings it to life — a software engineer, a research analyst, a customer assistant, anything.

  • SDK — one pip install gives you LLM failover, persistent memory, native tool calling, streaming, skills, MCP, and human-in-the-loop approvals.
  • Studio — a self-hosted multi-user dashboard: sign up, build agents, install tools/skills/MCP servers, run with full observability, and operate from a built-in terminal.

Table of Contents


✨ Features

Engine

🧠 Universal agent template One engine, any agent — identity, tools, and rules are configuration, not code
🔁 LLM failover pipeline Gemini → OpenAI → Anthropic with per-call failover and USD budget control
💾 Persistent memory SQLite-backed conversation history + key-value facts, export/import bundles
Streaming output Async generators for text and tool calls
🛠️ Tool system Built-ins, @tool decorator, and validated custom Python tools in a sandbox
🧩 Skill marketplace Load skills from packages, directories, or the Studio marketplace
🔌 MCP support Model Context Protocol servers with command/env allowlists and per-tool toggles
Verifier Post-execution checks with failing-line context pruning and audit reports
📚 Feedback learning learn_from_correction() for continuous self-improvement

Studio platform

👥 Multi-user auth Signup/login (argon2id), JWT rotation, workspaces, roles
🤖 Agent studio Build agents with constitution rules and autonomy guardrails
🚀 Streaming runs SSE event stream per run, retries, per-agent daily budgets
Human-in-the-loop Gate mode, proposal inbox, Discord/Gmail/webhook notifications
🧪 Custom tools Compile + AST-validated code with per-tool env allowlists
🏪 Marketplace Curated tools/skills/MCP catalog with trust indicators + audit trail
📊 Observability Run events, cost/token dashboards, budget alerts (80% / 100%)
🖥️ Terminal In-browser PTY shell with destructive-command confirmation
🛡️ Guardrails Protected branches, path allowlists, constitutional rules

🚀 Quick Start

Option A — Self-host the Studio (full experience)

# Docker (recommended — one container serves API + UI + worker)
docker build -t agentfactory .
docker run -d -p 8000:8000 \
  -e AGENTFACTORY_JWT_SECRET="$(openssl rand -hex 32)" \
  -v agentfactory-data:/data \
  agentfactory
# …or bare metal
pip install 'agentfactory-studio[platform]'
cd web && bun install && bun run build && cd ..
AGENTFACTORY_SPA_DIR="$(pwd)/web/dist" AGENTFACTORY_JWT_SECRET="$(openssl rand -hex 32)" \
  uvicorn agentfactory.app.main:app --host 0.0.0.0 --port 8000

Open http://localhost:8000, sign up, and you're in the Studio: create an agent, add tools/skills/MCP servers and a model connection with your own API key, run a task, and watch it stream — with budget alerts and full observability.

PyPI note: the distribution publishes as agentfactory-studio because the bare agentfactory name is squatted on PyPI (placeholder 0.0.0 release by another author). The Python import package remains agentfactory. Until the first PyPI release, install from source: pip install git+https://github.com/theaaqibjavaid/agent-factory.git.

Option B — SDK only

pip install agentfactory-studio[all]   # all LLM providers
agentfactory init
agentfactory run

See docs/quick-start.md and docs/self-host.md.


🧩 SDK Usage

import asyncio
from agentfactory import AgentFactory

async def main():
    factory = AgentFactory()
    agent = factory.create_agent("Senior")
    result = await agent.run("Implement user authentication")
    print(result)

asyncio.run(main())

Custom tools, skills, MCP servers, and memory integrate through the registry — see the API reference and tool system.


🖥️ CLI Reference

Command Description
agentfactory init Scaffold a project + .env
agentfactory run Run the default agent
agentfactory create-agent Add an agent profile
agentfactory list-tools List registered tools
agentfactory status Check the approval server
agentfactory token Mint a local JWT (v1 approval server)

Full reference: docs/cli-reference.md.


🏗️ Architecture

┌────────────────────────────────────────────────────────────────┐
│                        Studio (web/)                           │
│  Dashboard · Agent editor · Tools/Skills/MCP · Terminal ·      │
│  Observability · Approvals · Settings                          │
└──────────────────────────────┬─────────────────────────────────┘
                               │ HTTP / SSE / WebSocket
┌──────────────────────────────▼─────────────────────────────────┐
│                 Platform API (agentfactory/app)                │
│  Auth · Workspaces · Agents · Runs · Proposals · Memories ·    │
│  Tools · Skills · MCP · Models · Marketplace · Terminal ·      │
│  Observability        (SQLite, argon2id, JWT rotation)         │
└──────────────────────────────┬─────────────────────────────────┘
                               │ in-process worker + run broker
┌──────────────────────────────▼─────────────────────────────────┐
│                    Runtime (agentfactory/runtime.py)            │
│  LLM failover · tool sandbox · skills · MCP attach ·           │
│  constitution · guardrails · budget alerts · notifications     │
└────────────────────────────────────────────────────────────────┘

More: docs/architecture.md, docs/design.md.


🛡️ Security

Security is a first-class concern: argon2id password hashing, JWT rotation with revocation, per-IP rate limiting on auth, validated + sandboxed custom tool execution, MCP command/env allowlists, destructive-command guards, path allowlists, and an automated security pipeline (bandit, pip-audit, mypy, coverage gate) in CI.


📚 Documentation

Full index: docs/SUMMARY.md

Area Doc
🏠 Self-hosting (Docker, env vars, TLS) docs/self-host.md
🔄 Migrating v1 → v2 docs/migration-v1-v2.md
🧠 Architecture docs/architecture.md
🚀 Quick start docs/quick-start.md
🛠️ Tools & skills docs/tools.md · docs/skills.md
🔌 MCP docs/mcp-integration.md
🔁 LLM failover docs/llm-failover.md
💾 Memory docs/memory.md
📡 API reference docs/api-reference.md
⚙️ Environment variables docs/env-vars.md

🤝 Contributing

We welcome contributions of all kinds — code, docs, issues, and feedback.

Every PR runs the full gate in CI: tests + coverage ≥ 80%, mypy, ruff, bandit, pip-audit, and the Studio build.

⭐ If AgentFactory helps you build something, star the repo — it tells us the work matters and helps others find it.


📄 License

MIT © 2026 AgentFactory Contributors

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentfactory_studio-1.1.0.tar.gz (155.2 kB view details)

Uploaded Source

Built Distribution

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

agentfactory_studio-1.1.0-py3-none-any.whl (147.0 kB view details)

Uploaded Python 3

File details

Details for the file agentfactory_studio-1.1.0.tar.gz.

File metadata

  • Download URL: agentfactory_studio-1.1.0.tar.gz
  • Upload date:
  • Size: 155.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agentfactory_studio-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8c5c7f9f7d2229ba60381570ccc64e0dfb290ce32667d26f479411a66a9c2b9c
MD5 56feae9156540fdbc7d42877485a8221
BLAKE2b-256 1247ad8df93646129a316edcf9d52ddd40cd3591b7a011fce9fa6fcc955cf5ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentfactory_studio-1.1.0.tar.gz:

Publisher: release.yml on theaaqibjavaid/agent-factory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentfactory_studio-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentfactory_studio-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ed1b40bd4f16c8d539a234636e888215472cbcf58bac3b38d91924a0de6a1f5
MD5 c5ff53cde3129302e6c14b1d47d3d7f9
BLAKE2b-256 b5914b4994b9757615401cb7b4cd12135fafd124d83dbf419286a1fdd3431f3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentfactory_studio-1.1.0-py3-none-any.whl:

Publisher: release.yml on theaaqibjavaid/agent-factory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.2.0

2 files

This release

1.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page