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

Team to support a list of messages as input to a task #4472

Closed
ekzhu opened this issue Dec 2, 2024 · 2 comments · Fixed by #4500
Closed

Team to support a list of messages as input to a task #4472

ekzhu opened this issue Dec 2, 2024 · 2 comments · Fixed by #4500
Milestone

Comments

@ekzhu
Copy link
Collaborator

ekzhu commented Dec 2, 2024

Currently a team only support a single message for task.

result = await team.run(task="...")

It should support a list of messages, to prepopulate the context of the agents.

result = await team.run(task=[TextMessage(...), TextMessage(...)])

This allows passing a previous conversation history from another team.

This is also useful for nested chats to prepopulate the team participants with messages before generating a response.

@ekzhu ekzhu added this to the 0.4.1 milestone Dec 2, 2024
@ekzhu ekzhu removed the needs-triage label Dec 2, 2024
@victordibia
Copy link
Collaborator

victordibia commented Dec 2, 2024

Interesting idea ..
This sounds like what team.load_state() does in #4100.
Also, in the above example

result = await team.run(task=[TextMessage(...), TextMessage(...)])

Does this populate the context for ALL agents or some agents etc?
In PR #4436 ,team_state has an agent_states field that is a dict and maps to each agent. This way specific list of messages are mapped to the actual agent from which they were serialized (or created for) in team.load_state()

from autogen_agentchat.state import BaseTeamState

# convert team state to dict (save to file if needed)
team_state_dict = vars(team_state)
print(team_state_dict)      

# convert back to team state object
team_state = BaseTeamState(**vars(team_state)) 

# load team state
await agent_team.load_state(team_state)
stream = agent_team.run_stream(task="What was the last line of the poem you wrote?")
await Console(stream)

@ekzhu
Copy link
Collaborator Author

ekzhu commented Dec 2, 2024

I think the list of messages as task is to allow better integration with applications. E.g., in a scenario where users might type multiple messages before the application triggering the team run, and nest chats.

The load and save states are designed for persistence and editing of agent states.

They both serve different purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants