MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

Team serialization may fail when the program exits abnormally

Open Terrdi opened this issue 10 months ago • 3 comments

Bug description When I tried to run the Werewolf example, the model call failed due to platform flow restrictions. At this time, the program failed to serialize when it tried to write the current state to the storage/team.json file. After debugging, I found that the attribute special_actions in BasePlayer contained Action classes such as Speak, which caused the serialization failure

Bug solved method

I tried to add a custom serializer to Team so that it can be customized by users https://github.com/geekan/MetaGPT/pull/1688

Environment information

  • LLM type and model name: deepseek-r1
  • System version: MacOS
  • Python version: python3.9
  • MetaGPT version or branch: main
  • packages version:
  • installation method: pip install -e ".[rag,test,dev]"

Terrdi avatar Feb 11 '25 04:02 Terrdi

The PR is large.

seehi avatar Feb 13 '25 06:02 seehi

OK, I changed the target branch and submitted some new changes. The aflow example also uses json serialization to save the results. The total_cost field is numpy.int64, which cannot be serialized directly. Then I fixed this problem.

Terrdi avatar Feb 19 '25 07:02 Terrdi

This issue has no activity in the past 30 days. Please comment on the issue if you have anything to add.

github-actions[bot] avatar Mar 22 '25 00:03 github-actions[bot]

This issue was closed due to 45 days of inactivity. If you feel this issue is still relevant, please reopen the issue to continue the discussion.

github-actions[bot] avatar Apr 05 '25 00:04 github-actions[bot]