Skip to main content

stigmergy-crewai

Optimal task ordering for CrewAI crews. Declare tasks with priorities and dependencies, and stigmergy computes the best execution order using pressure signals. No manual ordering required.

CrewAI runs tasks sequentially -- the order you define them is the order they run. When you have complex dependency graphs, getting that order right by hand is tedious and fragile. Stigmergy resolves the optimal order from your dependency graph automatically, and handles priority-based reordering when tasks compete.

5 lines to integrate. Works with your existing CrewAI agents.

Install

pip install stigmergy-crewai

Usage

from crewai import Agent
from stigmergy_crewai import StigmergyManager

# Create CrewAI agents
researcher = Agent(role="researcher", goal="Find information", llm=llm)
writer = Agent(role="writer", goal="Write content", llm=llm)
editor = Agent(role="editor", goal="Edit content", llm=llm)

# Create stigmergy manager with tasks and dependencies
manager = StigmergyManager(wake_threshold=0.4)
manager.add_task("research", agent=researcher, description="Research AI trends",
                 expected_output="Key findings", priority=0.8)
manager.add_task("write", agent=writer, description="Write article",
                 expected_output="Draft article", priority=0.6, deps=["research"])
manager.add_task("edit", agent=editor, description="Edit the draft",
                 expected_output="Final article", priority=0.5, deps=["write"])

# Preview execution order
print(manager.task_order)  # ['research', 'write', 'edit']

# Build and run
crew = manager.build_crew(verbose=True)
result = crew.kickoff()

How It Works

Since CrewAI's Process enum is not extensible, the StigmergyManager:

  1. Accepts tasks with priorities and dependency graphs
  2. Uses pressure signals to resolve optimal execution order
  3. Deposits completion signals that propagate to dependent tasks
  4. Builds a CrewAI Crew with tasks in the resolved order
  5. Uses CrewAI's context parameter to pass outputs between dependent tasks

Limitations

  • Cannot parallelize tasks (CrewAI sequential process limitation)
  • Cannot dynamically inject tasks mid-execution
  • Task ordering is resolved at build_crew() time, not runtime

For full dynamic scheduling, use the core stigmergy library directly.

License

MIT

Metadata

Release files for stigmergy-crewai 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stigmergy-crewai 0.2.0
File Size Uploaded
stigmergy_crewai-0.2.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stigmergy-crewai 0.2.0
File Interpreter ABI Platform
stigmergy_crewai-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / stigmergy_crewai-0.2.0.tar.gz

Download URL stigmergy_crewai-0.2.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
882b8d33c5b04e51e042323c7ec4ee19b9b1b7204cb7831d0200f443889d3906
BLAKE2b-256 checksum
How to use checksums
388d935da88f93b93ea3242e71b15638e088abe34c223bad57f73dc441ad7272
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / stigmergy_crewai-0.2.0-py3-none-any.whl

Download URL stigmergy_crewai-0.2.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1902dd8e03471a1605a1c49499738055edf1b318a3dcdea1c040b936b6b2a26b
BLAKE2b-256 checksum
How to use checksums
b7a56e1a437632b324ce80e54729759ad54e359f194cd488fff627ff5e8adc7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release 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