DEV Community

Pavel Koryagin
Pavel Koryagin

Posted on

Flow vs. Crew: The clash of CrewAI templates

Welcome to the least informative post of the whole series! 😁 Just a small heads-up. The really complex topic is for tomorrow.

ℹ️ This post is part of the “Crew AI Caveats” series, which I create to fill in the gaps left by official courses and to help you master CrewAI faster and easier.

These two commands create entry points that are structured very differently:

  • crewai create crew <name>
  • crewai create flow <name>

create crew version main.py:

def run():
    ...

def train():
    ...

def replay():
    ...

def test():
    ...

# No `if __name__ == "__main__"` statement at all
Enter fullscreen mode Exit fullscreen mode

create flow version main.py:

def kickoff():
    poem_flow = PoemFlow()
    poem_flow.kickoff()

def plot():
    poem_flow = PoemFlow()
    poem_flow.plot()

if __name__ == "__main__":
    kickoff()
Enter fullscreen mode Exit fullscreen mode

The difference is that the flow version is structured as a script entry point and the crew version is nonfunctional without the crewai run command.

Additionally, the crew version exports some interesting entrypoints, while the flow version does not. Not sure why—maybe because they design that the crews should be trained independently.

Stay tuned

In the next post: CrewAI hurts TDD fans! Let’s invent a cure.

API Trace View

Struggling with slow API calls?

Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay