Skip to content

[BUG] Wrong code in document #5378

@woodliu

Description

@woodliu

Description

Here is the result of the code

➜  crewai_test uv run python main.py

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🌊 Flow Execution ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Starting Flow Execution                                                                                                                                                                                                                                      │
│  Name: PersistentCounterFlow                                                                                                                                                                                                                                  │
│  ID: 8d6df07d-9cbd-4ea3-a1f3-5b186981032f                                                                                                                                                                                                                     │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🌊 Flow Started ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Flow Started                                                                                                                                                                                                                                                 │
│  Name: PersistentCounterFlow                                                                                                                                                                                                                                  │
│  ID: 8d6df07d-9cbd-4ea3-a1f3-5b186981032f                                                                                                                                                                                                                     │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Flow started with ID: 8d6df07d-9cbd-4ea3-a1f3-5b186981032f
Incremented to 1
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🔄 Flow Method Running ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Method: increment                                                                                                                                                                                                                                            │
│  Status: Running                                                                                                                                                                                                                                              │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✅ Flow Method Completed ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Method: increment                                                                                                                                                                                                                                            │
│  Status: Completed                                                                                                                                                                                                                                            │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Doubled to 2

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🔄 Flow Method Running ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Method: double                                                                                                                                                                                                                                               │
│  Status: Running                                                                                                                                                                                                                                              │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✅ Flow Method Completed ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Method: double                                                                                                                                                                                                                                               │
│  Status: Completed                                                                                                                                                                                                                                            │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✅ Flow Completion ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Flow Execution Completed                                                                                                                                                                                                                                     │
│  Name: PersistentCounterFlow                                                                                                                                                                                                                                  │
│  ID: 8d6df07d-9cbd-4ea3-a1f3-5b186981032f                                                                                                                                                                                                                     │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

First run result: 2
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🌊 Flow Execution ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Starting Flow Execution                                                                                                                                                                                                                                      │
│  Name: PersistentCounterFlow                                                                                                                                                                                                                                  │
│  ID: 8c95e24a-a64c-4146-a52e-ec49440806f5                                                                                                                                                                                                                     │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🌊 Flow Started ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Flow Started                                                                                                                                                                                                                                                 │
│  Name: PersistentCounterFlow                                                                                                                                                                                                                                  │
│  ID: 8c95e24a-a64c-4146-a52e-ec49440806f5                                                                                                                                                                                                                     │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Flow started with ID: 8c95e24a-a64c-4146-a52e-ec49440806f5
Incremented to 1
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🔄 Flow Method Running ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Method: increment                                                                                                                                                                                                                                            │
│  Status: Running                                                                                                                                                                                                                                              │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✅ Flow Method Completed ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Method: increment                                                                                                                                                                                                                                            │
│  Status: Completed                                                                                                                                                                                                                                            │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Doubled to 2

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🔄 Flow Method Running ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Method: double                                                                                                                                                                                                                                               │
│  Status: Running                                                                                                                                                                                                                                              │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✅ Flow Method Completed ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Method: double                                                                                                                                                                                                                                               │
│  Status: Completed                                                                                                                                                                                                                                            │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✅ Flow Completion ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                               │
│  Flow Execution Completed                                                                                                                                                                                                                                     │
│  Name: PersistentCounterFlow                                                                                                                                                                                                                                  │
│  ID: 8c95e24a-a64c-4146-a52e-ec49440806f5                                                                                                                                                                                                                     │
│                                                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Second run result: 2



Steps to Reproduce

Just run the code locally

Expected behavior

The result should double of the first result, but it didn't

Screenshots/Code snippets

Check the doc

Operating System

macOS Sonoma

Python Version

3.12

crewAI Version

1.14.1 and 1.12.2

crewAI Tools Version

NA

Virtual Environment

Venv

Evidence

NA

Possible Solution

NA

Additional context

System: macos M2 26.3.1 (25D2128)
Python: 3.13.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions