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.

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.1.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.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stigmergy_crewai-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 b12a784b10565e80bc2d60d4f159f906587434d485d84ce3b6edd9c78ec5db60
MD5 20b63dc3824ab7017187646255f6d0b8
BLAKE2b-256 7aeeb7773a8e982a72e447b2a4c3e16d50e07fa0ccac9cf42d8a520ee19c3a0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for stigmergy_crewai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3eff95357e40884398bccca3ab4fbde7fdfe89dc56c85931028ea4b9076702b6
MD5 4ccf6df77ed9a0885aff16eaab5089fa
BLAKE2b-256 51a4317eb9e400bd2d87bcbf6e756b26dafca041a77adf93fb8f944b43436430

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