The modern AI engineering landscape is experiencing severe API fatigue. The prevailing trend in multi-agent orchestration leans heavily on massive cloud dependencies, centralized vector databases, and complex state management platforms. While this infrastructure works for simple prototyping, it introduces critical bottlenecks for production-grade environments: unpredictable token budgets, data privacy exposure, and non-deterministic execution paths that are nearly impossible to debug when a pipeline fails mid-run.\To solve this, I designed and open-sourced Agent Business Factory, a local-first, file-based Python framework that automates the lifecycle from an abstract domain thesis to structured content, product ideas, and builds scaffolds with zero external API dependencies required.\By grounding agent memory and state transitions entirely within a readable, deterministic file system, developers gain total visibility into the execution tree. Here is an architectural deep dive into how the framework operates under the hood.The Handoff Architecture: Deterministic State without a DatabaseInstead of trusting an external database to track conversation state, Agent Business Factory introduces an immutable, time-stamped directory tree. Every execution cycle generates an independent run folder under artifacts/, structured as follows:artifacts/ 20260531_194000/ trends.json brief.json brief.md content.json content.md product_ideas.json approvals.json run_manifest.json\State progression is achieved through structured, progressive file handoffs handled cleanly by the core orchestrator (src/orchestrator.py):briefing-agent scans raw data configurations, compiles localized market trends, and outputs a structured brief.json and a human-readable brief.md.content-agent reads the latest matching brief.json and automatically compiles channel-ready markdown text assets (e.g., cross-platform formats for LinkedIn or X).product-agent intercepts the compiled brief and content metrics to generate structural product opportunities (product_ideas.json), scoping them down into explicit deployment targets like an ebook, prompt_pack, or micro_saas.\Because memory is localized into explicit JSON schemas (src/models.py) and rendered to flat files (src/renderers.py), the state is completely transparent. If an agent fails or a format constraint breaks, you do not have to dig through a remote cloud log; you open the latest subfolder in artifacts/ and inspect the raw file state.Abstracting Agent and Skill ContractsTo enforce modularity, the framework separates Agents (the decision-making cores) from Skills (the execution tools). This is managed through incredibly strict, lightweight Python contracts that prevent logic bleed.The Agent ContractEvery module under agents/ inherits from a unified base class (agents/base.py), forcing a simple dictionary-in, dictionary-out transaction layer:def run(self, input_data: dict) -> dict: """Processes incoming state and returns an updated data payload.""" # Local orchestration logic here passThe Skill ContractSimilarly, operational tools under skills/ (such as mock publishers and scaffold creators) must adhere to a clean execution interface:def execute(self, payload: dict) -> dict: """Executes a discrete functional task using the provided payload.""" # Core system execution logic here pass\By maintaining these simple boundaries, the framework achieves extreme plug-and-play adaptability. Replacing a local mock publisher with a live production B2B API tracking engine later requires zero changes to the underlying orchestrator.py flow—you simply drop a new skill file into place.Human-in-the-Loop Gating: The Automated Approval QueueOne of the greatest hazards of autonomous multi-agent pipelines is letting AI systems run unchecked down an expensive or inaccurate product path. Agent Business Factory handles this by implementing a hard, human-gated check directly into the CLI lifecycle using src/approvals.py and src/builds.py.\When the ideation agent runs, it assigns short, contributor-friendly IDs to pending concepts (e.g., idea_01). The system then pauses and queues these files under approvals/pending/.\The human operator retains absolute control via simple, declarative terminal commands:# View all concepts currently waiting for reviewpython -m src.main --config factory.yaml list-pending# Authorize a specific engineering scaffold to generatepython -m src.main --config factory.yaml approve idea_01# Execute the local scaffold engine for the approved assetpython -m src.main --config factory.yaml build idea_01\Once approved, the builder-agent wakes up and reads the exact validation record. It instantly outputs highly practical planning directories under builds/, tailored entirely by product type. If the target is an ebook, it scaffolds out a comprehensive table_of_contents.md and detailed chapter_summaries.md, saving weeks of manual layout organization.Testing Non-Deterministic FrameworksThe fatal flaw of 99% of AI software repositories on GitHub today is a total lack of test coverage. Because agent behaviors are inherently non-deterministic, testing their architecture requires rigorous validation of their inputs, configuration parsers, and file-writing integrity.\Agent Business Factory tackles this head-on with a comprehensive, 11-module testing architecture under tests/ powered by a dedicated pytest.ini harness.\Instead of guessing if a configuration mutation breaks the system, running a localized testing suite verifies the entire lifecycle:python -m pytest\Our test suite explicitly runs automated checks against test_orchestrator.py to ensure state transitions hold, validates local YAML parser behaviors in test_config.py, and maps boundary conditions in test_storage.py to confirm file serialization never corrupts data. This ensures the core infrastructure remains solid even as developers extend or swap out custom models.Going OpenClaw NativeTo maximize ecosystem flexibility, the architecture includes a lightweight openclaw/ integration layer that maps directly onto the local CLI core without duplicating code.\Using clear, Markdown-based agent prompt files (like briefing-agent.md) alongside distinct skill directories, a runnable runtime layer in src/openclaw_runtime.py cleanly wires the local pipeline into an enterprise-grade, cron-compatible routine. This means you can run the tool as a rapid local Python command-line utility or scale it seamlessly as an OpenClaw-compatible agent system.Explore the Architecture LiveThe entire framework is completely open-source under the MIT License and ready for community extension, contribution, and deployment.Star and Fork the Repository on GitHub: Download the codebase, view our full architecture.md breakdown, run the quickstart test harness, and build your own local-first multi-agent factories.\\