Skip to main content

Stigmergy pressure-field scheduling adapter for CrewAI

Project description

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

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

stigmergy_crewai-0.2.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

stigmergy_crewai-0.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file stigmergy_crewai-0.2.0.tar.gz.

File metadata

  • Download URL: stigmergy_crewai-0.2.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for stigmergy_crewai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 882b8d33c5b04e51e042323c7ec4ee19b9b1b7204cb7831d0200f443889d3906
MD5 ffb89bdc0d334a1c6c3ed990d15e9558
BLAKE2b-256 388d935da88f93b93ea3242e71b15638e088abe34c223bad57f73dc441ad7272

See more details on using hashes here.

File details

Details for the file stigmergy_crewai-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for stigmergy_crewai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1902dd8e03471a1605a1c49499738055edf1b318a3dcdea1c040b936b6b2a26b
MD5 52fa457a279a823e8d753fdb33a139c8
BLAKE2b-256 b7a56e1a437632b324ce80e54729759ad54e359f194cd488fff627ff5e8adc7a

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