Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_state() not working #5034

Closed
liorbalmas opened this issue Jan 14, 2025 · 2 comments
Closed

load_state() not working #5034

liorbalmas opened this issue Jan 14, 2025 · 2 comments

Comments

@liorbalmas
Copy link

Hello,

here 's my code:

    team = RoundRobinGroupChat([primary_agent, critic_agent], termination_condition=text_termination, max_turns=max_rounds)

    if os.path.exists("./team_state.json"):
        with open("./team_state.json", "r") as f:
            team_state = json.load(f)
            team.load_state(team_state)

    result = await team.run(task=user_message)

    team_state = await team.save_state()
    with open("./team_state.json", "w") as fw:
        json.dump(team_state, fw)
    
    return result

the state file exists,
i verified using step by step debug that the team's state initialized based on persisted state

Still the team ignores the state that was loaded.

the tasks i gave the team were:

  1. the weather in NYC in january
  2. and in paris?

the response to the second question was: "Please provide more context or specify what you would like to know about Paris."

any ideas?

thank you

@ekzhu
Copy link
Collaborator

ekzhu commented Jan 14, 2025

You need to await the load_state call.

Also could you provide a runnable script to demonstrate your error or unexpected output?

@ekzhu ekzhu added the awaiting-op-response Issue or pr has been triaged or responded to and is now awaiting a reply from the original poster label Jan 14, 2025
@liorbalmas
Copy link
Author

await solved it
Thanks!

@github-actions github-actions bot removed the awaiting-op-response Issue or pr has been triaged or responded to and is now awaiting a reply from the original poster label Jan 14, 2025
@ekzhu ekzhu closed this as completed Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants