Skip to main content

Controlled mitosis for AI agents — dynamic, effort-scored, recursive task decomposition with regulated division.

Project description

🧬 Mitosys

Controlled mitosis for AI agents — dynamic, effort-scored, recursive task decomposition with regulated division.

Mitosys is a Python SDK and CLI that routes complex tasks through the Mitosys backend: an LLM-powered multi-agent system that breaks tasks into parallel sub-tasks, runs them concurrently, and synthesizes a final answer.

Uncontrolled division is cancer. Mitosys is controlled mitosis.

pip install mitosys

demo


Quick Start

import mitosys

# Sync — great for scripts and notebooks
result = mitosys.run("Analyze Q3 sales data across all regions")
print(result.final_answer)
print(f"Used {result.total_agents} agents across {result.max_depth} levels")
# Async
import mitosys

result = await mitosys.arun("Analyze Q3 sales data")
print(result.final_answer)
# Streaming — get live events as the lifecycle progresses
import mitosys

async for event in mitosys.astream("Write a comprehensive market report"):
    if event.type == "effort":
        print(f"Effort: {event.score}/10  →  {event.recommended_agents} agents")
    elif event.type == "spawn":
        print(f"Born: {event.agent}")
    elif event.type == "final":
        print(event.final_answer)

Configuration

Method Example
Default https://lumidoc-mitosys-backend.hf.space
Environment variable export MITOSYS_URL=http://localhost:8000
Explicit argument MitosysClient(url="http://localhost:8000")
from mitosys import MitosysClient

client = MitosysClient(
    url="https://my-self-hosted-mitosys.example.com",
    timeout=180,
)
result = await client.arun("Analyze our Q3 sales data")

Resolution order: explicit url=$MITOSYS_URL → built-in default.


Typed Result Objects

result = mitosys.run("...")

result.task             # str — the original task
result.final_answer     # str — the synthesized answer
result.sub_tasks        # list[SubTask]  — each has .subtask and .effort_hint
result.sub_results      # list[SubResult] — each has .agent, .subtask, .result
result.tree             # AgentTree — walk() yields every node depth-first
result.effort           # EffortScore — .score, .breadth, .depth, .recommended_agents
result.total_agents     # int — how many agents ran in total
result.max_depth        # int — deepest recursion level reached
result.elapsed_seconds  # float
result.raw              # dict — the original backend payload (for power users)

Framework Integration

AutoGen

from mitosys.adapters.autogen import MitosysTool
from autogen_agentchat.agents import AssistantAgent

mitosys_tool = MitosysTool()
agent = AssistantAgent(
    name="researcher",
    model_client=...,
    tools=[mitosys_tool.as_function_tool()],
)
# When the agent decides a task is too complex, it delegates to Mitosys.
pip install mitosys[autogen]

LangGraph

from mitosys.adapters.langgraph import mitosys_node
from langgraph.graph import StateGraph

graph = StateGraph(dict)
graph.add_node("delegate_complex", mitosys_node())
# State must contain "task"; result is written to "mitosys_result".
pip install mitosys[langgraph]

CrewAI

from mitosys.adapters.crewai import MitosysAgent
from crewai import Crew, Task

heavy = MitosysAgent(role="Heavy task specialist")
crew = Crew(agents=[heavy], tasks=[Task(description="...", agent=heavy)])
crew.kickoff()
pip install mitosys[crewai]

CLI

The mitosys command is included with the package and makes the whole lifecycle visible in your terminal:

# Stream the live lifecycle (default)
mitosys run "Write a comprehensive analysis of renewable energy trends"

# Wait for the full result (no streaming)
mitosys run "..." --no-stream

# Pipe the raw JSON to jq
mitosys run "..." --json | jq '.final_answer'

# Check backend health
mitosys health

# Show version + configured URL
mitosys version

Flags for run:

Flag Description
--url URL Override backend URL
--no-stream Blocking POST /run (no live events)
--json Raw JSON to stdout; lifecycle to stderr
--timeout SEC HTTP timeout (default 120)

How It Works

  1. Your task is sent to the Mitosys backend.
  2. An effort scorer evaluates breadth × depth (1–10) and recommends how many agents to spawn.
  3. The parent agent divides the task into sub-tasks.
  4. Each sub-agent self-assesses its sub-task. If it's too complex, it proposes recursive division.
  5. The regulator (parent LLM) approves or denies each proposal — keeping the tree bounded.
  6. Approved sub-agents spawn children; all leaf agents execute concurrently.
  7. Results are collected, agents are destroyed, and the parent synthesizes a final answer.

What's New in v0.3.0

  • SDK-firstimport mitosys is now the primary interface; the CLI is one entry point among many.
  • Typed result objectsMitosysResult, AgentTree, EffortScore, SubTask, SubResult with autocomplete-friendly properties.
  • Typed event streamMitosysEvent with .score, .agent, .final_answer, etc.
  • Framework adapters — AutoGen, LangGraph, CrewAI (optional extras).
  • Typed exceptionsMitosysNetworkError, MitosysBackendError; no httpx leakage.
  • Package renamed from mitosys-climitosys.

What's New in v0.2.0

  • Effort scoring, recursive division, regulator approval, agent tree — see CHANGELOG.

Roadmap

  • Rate limiting and concurrency controls
  • More framework adapters (LlamaIndex, Semantic Kernel, Haystack)
  • Self-hosted deployment guide
  • Streaming progress callback API (non-async)
  • Token usage reporting per agent

Upgrading from 0.2.0

pip uninstall mitosys-cli
pip install mitosys

The mitosys CLI command is identical. Only the Python import path changes:

# Before (v0.2.0)
from mitosys_cli.cli import app

# After (v0.3.0)
from mitosys.cli.main import app

License

MIT — see LICENSE.

Author

Built by Swapnil Bhattacharya, part of NorthCommits.

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

mitosys-0.3.0.tar.gz (343.8 kB view details)

Uploaded Source

Built Distribution

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

mitosys-0.3.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file mitosys-0.3.0.tar.gz.

File metadata

  • Download URL: mitosys-0.3.0.tar.gz
  • Upload date:
  • Size: 343.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for mitosys-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c02df9e39d8fc911a651108970e607206ac39328b8bd661796595681dee7dcfa
MD5 f642280f9b7185adb35c5c4650bf7053
BLAKE2b-256 b4a003d12d11664fca198b63acbbd9540beecdee736af8a8d5f6de47b6ca94f7

See more details on using hashes here.

File details

Details for the file mitosys-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: mitosys-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for mitosys-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84147859cbb46ff66d36cb94e8488b5378e1449c332706d2bdcd6c0bd6b664a6
MD5 7a1a348948300d0b7983a85588d6a287
BLAKE2b-256 483fcb67a94c5b62648b33ed1d6dd3916f2db3b512e929a8641b34c67764641f

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