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) ✅ this is the product

One command, one process, one port:

pip install 'agentfactory-studio[platform]'   # or: pip install -e .
agentfactory studio                            # builds the UI if needed

Open http://localhost:8000 — that's the Studio: sign up, 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 approvals, memory, terminal, and full observability. API docs: http://localhost:8000/docs.

Step-by-step walkthrough of every feature (API + UI + tests): docs/testing.md — "Local Testing Guide"

# …or Docker (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

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 (no Studio UI)

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

⚠️ Legacy v1 flow. init / run / create-agent / list-tools are the old SDK/approval-server commands, kept for backwards compatibility. For the current platform use agentfactory studio (Option A).

See docs/quick-start.md, docs/testing.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

The command you want is agentfactory studio — it runs the whole product (API + Studio UI) on one port. The other commands below are legacy v1 SDK tooling; they still exist for backwards compatibility but you don't need them for the platform.

Command Description
agentfactory studio Run the full platform (API + UI) on http://localhost:8000 — the one command you need
agentfactory init (legacy v1) Scaffold a project + .env
agentfactory run (legacy v1) Approval server + background worker
agentfactory create-agent (legacy v1) Add an agent profile
agentfactory list-tools (legacy v1) List registered tools
agentfactory status (legacy v1) Check the approval server
agentfactory token (legacy v1) Mint a local JWT

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, opt-in encryption-at-rest (set AGENTFACTORY_ENCRYPTION_KEY to encrypt conversations, facts, plans, and approval data), validated + sandboxed custom tool execution with schema-validated tool arguments, MCP command/env allowlists, destructive-command guards, path allowlists, secret-scrubbed logs, 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.2.0.tar.gz (165.1 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.2.0-py3-none-any.whl (152.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentfactory_studio-1.2.0.tar.gz
  • Upload date:
  • Size: 165.1 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.2.0.tar.gz
Algorithm Hash digest
SHA256 3983a7a227e5b13b23355b66b63393bcc93cfc5c8d47ffaf95e4274e7f82aa1c
MD5 24c0e5c7c29b853917f95179ccd589a9
BLAKE2b-256 81fa6f09298d9b4b6cdbb09e55b49c1e462d8a7d0ae49ba1b4f3c62b9a92abd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentfactory_studio-1.2.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.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentfactory_studio-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8cd666d58098873df6f9d1dd156dee8ffaf7837bf2e18d0b19b0ba89d4fbd61e
MD5 4553a6a1a5bbcab600ebae3eaec21a06
BLAKE2b-256 f2bd5f071d82ae772440e6172a543c75abab313c6f7edc1dd0b3ec6e9c5c38be

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentfactory_studio-1.2.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

This release

1.2.0 This release

2 files

1.1.0

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