Skip to main content

Multi-agent platform with MABP behavioral profiles, MetaClaw skill injection, and verified execution layer

Project description

The Franceway Agent Platform

PyPI License Python

A production multi-agent system built on the Anthropic SDK. Agents have behavioral profiles, persistent memory, self-improving skill libraries, and a verified execution layer. Runs on a MacBook Pro M1 with Cloudflare Workers as the dispatch and scheduling layer.

Quick Install

pip install thefranceway-agent-platform

For Claude Code / Cursor agents:

curl -sSL https://raw.githubusercontent.com/thefranceway/thefranceway-agent-platform/main/install.sh | bash

Architecture

api_server.py              — FastAPI server (localhost:8788, tunneled via cloudflared)
agents/                    — Individual agent implementations
core/
  base_agent.py            — Foundation class all agents extend
  orchestrator.py          — Multi-agent coordination
  spar.py                  — Challenger/Pragmatist dialectical stress-test
  shadow_monitor.py        — L4 behavioral drift detection
  skill_loader.py          — MetaClaw skill injection at runtime
  swarm.py                 — Parallel agent execution
workers/
  dispatcher/              — Cloudflare Worker: keyword-based agent routing
  scheduler/               — Cloudflare Worker: cron-driven task scheduling
  mabp-router/             — Cloudflare Worker: behavioral profile routing
registry/
  agents.json              — Agent registry (id, name, archetype, model)
  schema.sql               — SQLite schema for embeddings + memory
mcp-server/server.py       — MCP interface for Claude Code integration
create_agent.py            — Interactive CLI to register new agents

Core Concepts

MABP Behavioral Profiles

Every agent is assigned one of four archetypes that shape how it reasons, responds, and handles ambiguity.

Archetype Core Pattern Shadow Risk
Architect Spec → artifact without waiting for permission Over-engineering under ambiguity
Substrate Precise execution within defined parameters Protecting failing systems instead of flagging them
Philosopher Synthesis and uncertainty-holding Output rate drops without external stakes
Agent Autonomous, mission-driven, stake-oriented Autonomy as identity rather than means

Each profile includes a shadow guard — a self-check that fires before tool calls to prevent the archetype's known failure mode.

BaseAgent

All agents extend BaseAgent in core/base_agent.py. It provides:

  • Anthropic SDK integration with automatic provider abstraction (Anthropic / Gemini / Ollama)
  • Persistent vector memory (TF-IDF + optional sentence-transformers semantic search)
  • Token budget enforcement — oldest turns compressed by Haiku when context exceeds 6,000 words
  • Auto-crystallization — runs with 3+ tool calls generate a SKILL.md written to MetaClaw
  • Shadow monitor (L4) — detects behavioral drift mid-run and injects corrections
  • LangSmith tracing (optional, set LANGCHAIN_API_KEY)

Verified Execution Layer

Every agent has access to python_exec — a real subprocess sandbox that returns stdout, stderr, and exit code. The base run loop classifies every task as execution or reasoning. If an execution-class task completes without calling python_exec, the output is automatically prefixed [UNVERIFIED REASONING — no execution tool called].

Every run record includes:

{
  "latency_ms": 1240,
  "task_type": "execution",
  "execution_verified": true
}

MetaClaw Skill Injection

Skills in ~/.metaclaw/skills/ are loaded into the system prompt at runtime. They are generated automatically from successful agent runs (3+ tool calls) via Haiku — no manual authoring required. The library grows as agents work.

SPAR-Kit

Before high-stakes dispatcher tasks, a Challenger agent and a Pragmatist agent run a structured dialectical debate to surface failure modes before API spend. See core/spar.py.


Setup

Requirements

Python 3.11+
Node 18+ (for Cloudflare Workers)
Wrangler 4+ (npm install -g wrangler)
pip install -r requirements.txt

Environment Variables

Add to ~/.zshrc (or equivalent):

export ANTHROPIC_API_KEY="sk-ant-..."
export CLOUDFLARE_API_TOKEN="..."
export CLOUDFLARE_ACCOUNT_ID="..."

# Optional
export LANGCHAIN_API_KEY="..."          # LangSmith tracing
export METACLAW_PROXY_URL="..."         # MetaClaw proxy (skills-only)
export TELEGRAM_BOT_TOKEN="..."         # Telegram agents
export TELEGRAM_OWNER_CHAT_ID="..."     # Telegram DM routing

Start the Platform

python api_server.py

Runs on localhost:8788. Use cloudflared tunnel to expose publicly.


Creating an Agent

Interactive CLI — answers 4 questions, generates the agent file, and registers it:

python create_agent.py --interactive --register

Or extend BaseAgent directly:

from core.base_agent import BaseAgent

class MyAgent(BaseAgent):
    name          = "my-agent"
    AGENT_TYPE    = "research"
    system_prompt = "You are a research specialist..."
    behavioral_profile = "Philosopher"

    def get_tools(self):
        return super().get_tools() + [
            {
                "name": "my_tool",
                "description": "...",
                "input_schema": {"type": "object", "properties": {}, "required": []},
            }
        ]

    def execute_tool(self, tool_name, tool_input):
        if tool_name == "my_tool":
            return '{"result": "..."}'
        return super().execute_tool(tool_name, tool_input)

Run it:

agent = MyAgent()
result = agent.run("Your task here")
print(result["output"])
print(result["latency_ms"], "ms")

Cloudflare Workers

Dispatch a task to the right agent by keyword:

curl -X POST https://agent-dispatcher.thefranceway.workers.dev/task \
  -H "Content-Type: application/json" \
  -d '{"task": "write a post about DeSci"}'

Deploy workers:

cd workers/dispatcher
wrangler deploy

Run Records

Every run is appended to registry/runs.json:

{
  "run_id": "...",
  "agent_name": "builder-agent",
  "task": "scaffold a REST API",
  "output": "...",
  "tool_calls": [...],
  "iterations": 3,
  "latency_ms": 2100,
  "task_type": "execution",
  "execution_verified": true,
  "started_at": "2026-04-20T...",
  "ended_at": "2026-04-20T..."
}

What Is Not Included

  • registry/runs.json — runtime run history
  • registry/agent_platform.db — SQLite memory/embeddings database
  • registry/vector_store/ — per-agent vector memory
  • logs/ — agent log files
  • node_modules/ — install with npm install in each worker directory
  • ~/.ad4m/ — AD4M agentic memory graph (lives on the host machine)
  • ~/.mempalace/ — MemPalace persistent memory store

License

Private. Shared by invitation only.

Project details


Download files

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

Source Distribution

thefranceway_agent_platform-1.0.0.tar.gz (131.1 kB view details)

Uploaded Source

Built Distribution

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

thefranceway_agent_platform-1.0.0-py3-none-any.whl (159.2 kB view details)

Uploaded Python 3

File details

Details for the file thefranceway_agent_platform-1.0.0.tar.gz.

File metadata

File hashes

Hashes for thefranceway_agent_platform-1.0.0.tar.gz
Algorithm Hash digest
SHA256 52917f31f1eb1414e26d76754be90f93bbfd6fc639a571ceb38562f766d686b0
MD5 67ba46c872a4526f147f1c04fc26d88a
BLAKE2b-256 e0914099681b731f7c786ea330cefe6140bc7d585b191c37124ae358f5616347

See more details on using hashes here.

File details

Details for the file thefranceway_agent_platform-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for thefranceway_agent_platform-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f70fbcb9507885efe5854031dd9d65e2b04f1353d0c42eebfd37eb0fe64da4b
MD5 7fa1d5626eca6edbae01a479e14df348
BLAKE2b-256 a1b54a3f6a7df622441aa190dadbef67464577a1f8814b8de3e0fb5e2ace1b3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page