A programming framework for agentic AI
In Add required termination condition and missing agent_e (#6809)
Dave Howardf45adde638f1
diff --git a/python/docs/src/user-guide/agentchat-user-guide/graph-flow.ipynb b/python/docs/src/user-guide/agentchat-user-guide/graph-flow.ipynbindex d267257b4..34063ed78 100644--- a/python/docs/src/user-guide/agentchat-user-guide/graph-flow.ipynb+++ b/python/docs/src/user-guide/agentchat-user-guide/graph-flow.ipynb@@ -414,7 +414,7 @@},{"cell_type": "code",- "execution_count": 1,+ "execution_count": 2,"id": "af297db2","metadata": {},"outputs": [@@ -425,102 +425,104 @@"---------- TextMessage (user) ----------\n","Brainstorm ways to reduce plastic waste.\n","---------- TextMessage (generator) ----------\n",- "1. **Refill Stations**: Set up refill stations for common household products such as laundry detergent, shampoo, and cleaning supplies in grocery stores and public spaces.\n",+ "Here are some creative ideas to help reduce plastic waste:\n","\n",- "2. **Bulk Buying Incentives**: Create incentives for consumers to buy in bulk, reducing the amount of packaging waste.\n",+ "1. **Refill Stations**: Create refill stations for common household liquids (like soaps, shampoos, and detergents) where people can bring their own containers to fill up.\n","\n",- "3. **Eco-friendly Packaging**: Encourage companies to develop biodegradable or compostable packaging for their products.\n",+ "2. **DIY Kits**: Offer DIY kits for making eco-friendly products, such as beeswax wraps, reusable bags, or natural cleaning solutions.\n","\n",- "4. **Upcycling Workshops**: Organize community workshops that teach people how to repurpose plastic items into practical or decorative objects.\n",+ "3. **Community Swap Events**: Organize swap events where people can bring unwanted items, including clothing and household products, to exchange instead of purchasing new items.\n","\n",- "5. **Community Clean-Up Events**: Host regular community clean-up events focused on collecting plastic waste from parks, beaches, and roadsides.\n",+ "4. **Plastic-Free Challenge**: Launch a community-wide challenge encouraging residents to go plastic-free for a month, sharing tips and experiences on social media.\n","\n",- "6. **Education Campaigns**: Launch educational campaigns in schools and communities about the impact of plastic waste and sustainable alternatives.\n",+ "5. **Incentivize Businesses**: Create incentives for local businesses that implement sustainable practices, like providing discounts to customers who bring their own containers or bags.\n","\n",- "7. **Plastic-Free Challenges**: Initiate a monthly plastic-free challenge encouraging individuals and families to reduce their plastic consumption.\n",+ "6. **Educational Campaigns**: Partner with schools to educate children about the impact of plastic waste and encourage them to take home messages to their families.\n","\n",- "8. **Support Local Artisan Products**: Promote local artisans who create products from recycled materials, fostering a circular economy.\n",+ "7. **Plastic-Free Shopping Zones**: Designate certain areas in town as plastic-free zones where businesses agree to eliminate single-use plastics.\n","\n",- "9. **Rewards Programs**: Develop a rewards program for individuals and businesses who actively reduce their plastic usage, such as discounts or points for using reusable bags and containers.\n",+ "8. **Upcycling Workshops**: Host workshops teaching people how to upcycle plastic waste into art, furniture, or home decor.\n","\n",- "10. **Zero-Waste Grocery Stores**: Support the establishment of zero-waste grocery stores where customers can bring their own containers and buy loose, unpackaged products.\n",+ "9. **Composting Competition**: Encourage households to compost food waste and offer a competition for the best composting garden to foster eco-awareness.\n","\n",- "11. **Legislation and Policy Changes**: Advocate for policies that ban single-use plastics and promote alternatives in both public and private sectors.\n",+ "10. **Zero-Waste Stores**: Support or start zero-waste stores that sell bulk goods, allowing customers to shop with their own containers.\n","\n",- "12. **Environmentally Friendly Innovations**: Invest in and promote innovations in materials science that create alternatives to plastic from natural materials.\n",+ "11. **Mobile Recycling Units**: Implement mobile recycling units that visit neighborhoods to educate residents on recycling properly and collect recyclables.\n","\n",- "13. **Plastic Bank Initiatives**: Start or support initiatives that allow people to exchange plastic waste for products or services, incentivizing recycling.\n",+ "12. **Plastic Offset Programs**: Create programs that allow individuals and companies to offset their plastic usage through donations to initiatives that remove plastic from oceans.\n","\n",- "14. **DIY Tutorials**: Create and share DIY tutorials for making your own household products to reduce reliance on plastic-packaged goods.\n",+ "13. **Collaboration with Influencers**: Partner with social media influencers to spread the message about reducing plastic waste and promote sustainable alternatives.\n","\n",- "15. **Corporate Sustainability Partnerships**: Encourage collaboration between businesses to share best practices in reducing plastic use and waste.\n",+ "14. **Sustainable Product Market**: Organize a market dedicated exclusively to sustainable products and services, showcasing local vendors who prioritize eco-friendly practices.\n","\n",- "16. **Public Art Installations**: Organize public art projects using collected plastic waste to raise awareness and promote discussions on plastic pollution.\n",+ "15. **Plastic Waste Art Installations**: Collaborate with artists to create public installations made from recycled plastic, raising awareness of the plastic problem in a visually impactful way.\n","\n",- "17. **Sustainable Fashion Initiatives**: Promote clothing and accessories made from recycled plastics, highlighting those companies that commit to eco-friendly practices.\n",+ "16. **Interactive Apps**: Develop apps that track plastic usage and provide personalized tips for reducing plastic consumption based on user habits.\n","\n",- "18. **Digital Outreach**: Use social media and digital platforms to raise awareness about the impact of plastic waste and promote sustainable lifestyle choices.\n",+ "17. **Corporate Partnerships**: Work with businesses to develop corporate responsibility programs focused on reducing plastic use in their operations and packaging.\n","\n",- "19. **Composting Services**: Establish services that help compost food waste and other biodegradable materials, reducing reliance on plastic bags for disposal.\n",+ "18. **Legislation Advocacy**: Promote local policies that restrict single-use plastics or support more effective recycling programs.\n","\n",- "20. **Sustainable Event Planning**: Collaborate with event planners to create guidelines for low-plastic events, encouraging the use of sustainable materials and practices.\n",- "---------- TextMessage (reviewer) ----------\n",- "These ideas provide a comprehensive approach to reducing plastic waste, addressing various aspects such as consumer behavior, community involvement, and corporate responsibility. Here are some feedbacks and suggestions for improvement:\n",+ "19. **Public Transportation Awareness**: Encourage public transportation usage by providing eco-friendly incentives for those who walk, bike, or use buses instead of cars.\n",+ "\n",+ "20. **Create a Local Plastic Waste Repository**: Start a community hub where individuals and artists can drop off plastic waste for reuse in projects or art pieces.\n","\n",- "1. **Refill Stations**: Provide clear labeling and education about the environmental benefits of using refill stations to encourage more participation.\n",+ "By implementing these ideas, communities can take significant steps toward reducing plastic waste and fostering a sustainable future.\n",+ "---------- TextMessage (reviewer) ----------\n",+ "These ideas present a comprehensive and practical approach to reducing plastic waste within communities. Here’s some feedback and considerations for each suggestion:\n","\n",- "2. **Bulk Buying Incentives**: Consider incorporating a loyalty program that rewards frequent bulk buyers with additional discounts or promotions.\n",+ "1. **Refill Stations**: Great idea; consider partnering with local health and wellness shops for broader adoption.\n",+ " \n",+ "2. **DIY Kits**: Ensure kits include clear instructions and safety guidance to promote user-friendliness.\n","\n",- "3. **Eco-friendly Packaging**: Collaborate with universities and research institutions to foster innovation in eco-friendly packaging designs.\n",+ "3. **Community Swap Events**: Promote these as regular events to build a sense of community and reinforce sustainable habits.\n","\n",- "4. **Upcycling Workshops**: Expand on this idea by partnering with local artists who can lead sessions, making it more appealing and engaging for the community.\n",+ "4. **Plastic-Free Challenge**: Consider creating a dedicated hashtag to track participants’ journeys and foster engagement online.\n","\n",- "5. **Community Clean-Up Events**: Provide incentive programs for participants, such as raffle entries or recognition awards, to boost engagement.\n",+ "5. **Incentivize Businesses**: Work on a simple certification system for sustainable businesses to encourage participation and recognition.\n","\n",- "6. **Education Campaigns**: Tailor campaigns for different age groups, using age-appropriate messaging and methods to enhance understanding and retention.\n",+ "6. **Educational Campaigns**: Tailor content to different age groups to maximize impact across the community.\n","\n",- "7. **Plastic-Free Challenges**: Involve local businesses by offering discounts or promotions to participants, creating a community effort with tangible rewards.\n",+ "7. **Plastic-Free Shopping Zones**: Consider involving local government for support and promotion, which can increase visibility and compliance.\n","\n",- "8. **Support Local Artisan Products**: Connect artisans with online marketplaces to broaden their reach and sales, promoting a circular economy.\n",+ "8. **Upcycling Workshops**: Source materials locally for workshops to decrease transportation emissions and support local businesses.\n","\n",- "9. **Rewards Programs**: Build a mobile app dedicated to tracking individuals' sustainable habits, providing insights and rewards for achievements.\n",+ "9. **Composting Competition**: Collaborate with gardening clubs for expert insights and to broaden participation in community gardening.\n","\n",- "10. **Zero-Waste Grocery Stores**: Consider including workshops in these stores to educate customers on zero-waste practices and encourage community engagement.\n",+ "10. **Zero-Waste Stores**: Explore online sales options to enhance accessibility while retaining the focus on zero-waste practices.\n","\n",- "11. **Legislation and Policy Changes**: Engage with policymakers and present real data on plastic waste reduction impacts to advocate for meaningful changes.\n",+ "11. **Mobile Recycling Units**: Train volunteers for effective community engagement and education during visits.\n","\n",- "12. **Environmentally Friendly Innovations**: Host hackathons or competitions to stimulate creativity and collaboration in developing sustainable alternatives.\n",+ "12. **Plastic Offset Programs**: Emphasize transparency in how donations are used to build trust within the community.\n","\n",- "13. **Plastic Bank Initiatives**: Collaborate with local businesses to create a network where people can exchange more types of waste for various community services.\n",+ "13. **Collaboration with Influencers**: Ensure influencers have a genuine commitment to sustainability to ensure credible messaging.\n","\n",- "14. **DIY Tutorials**: Offer a platform where community members can share their own tutorials and experiences, fostering a supportive network for sustainable living.\n",+ "14. **Sustainable Product Market**: Regularly invite new vendors to keep the market fresh and encourage innovation in sustainable products.\n","\n",- "15. **Corporate Sustainability Partnerships**: Encourage companies to share their sustainability stories, motivating others while boosting their brand image.\n",+ "15. **Plastic Waste Art Installations**: Consider educational plaques accompanying installations that inform viewers about the issues of plastic waste.\n","\n",- "16. **Public Art Installations**: Use social media campaigns to further engage the public in these projects, encouraging them to participate and share their own creations.\n",+ "16. **Interactive Apps**: Include gamification elements to encourage increased user engagement and sharing among friends.\n","\n",- "17. **Sustainable Fashion Initiatives**: Create pop-up shops or fashion shows featuring sustainable lines, helping to raise awareness in a fun and engaging way.\n",+ "17. **Corporate Partnerships**: Develop case studies or success stories to showcase the benefits of reduced plastic use for businesses.\n","\n",- "18. **Digital Outreach**: Utilize influencers or local celebrities to amplify your message and reach wider audiences, particularly younger populations.\n",+ "18. **Legislation Advocacy**: Mobilize community members to become advocates themselves, creating a grass-roots effort for policy change.\n","\n",- "19. **Composting Services**: Develop an educational program on composting benefits to accompany the service, helping customers understand its environmental importance.\n",+ "19. **Public Transportation Awareness**: Explore partnerships with public transit systems for eco-friendly promotions.\n","\n",- "20. **Sustainable Event Planning**: Include a checklist for event planners detailing low-plastic options and provide resources to make the transition easier.\n",+ "20. **Create a Local Plastic Waste Repository**: Establish partnerships with local craft schools or organizations to enhance creativity and use of the repository.\n","\n",- "Overall, these ideas are solid and can significantly contribute to reducing plastic waste, but implementing them effectively will require collaboration, education, and community involvement. Great job! APPROVE.\n",+ "Overall, these ideas have high potential for impactful implementation. Emphasizing community engagement, education, and ongoing support will help ensure their success. **APPROVE**.\n","---------- TextMessage (summary) ----------\n",- "The user requested brainstorming ideas to reduce plastic waste. The final feedback provided by the reviewer highlighted that the ideas were comprehensive, covering various facets such as consumer behavior, community involvement, and corporate responsibility. Specific suggestions for improvement included enhancing refill stations with clear labeling, incentivizing bulk buying through loyalty programs, collaborating on eco-friendly packaging, expanding upcycling workshops with local artists, and engaging in educational campaigns tailored to different age groups. The reviewer approved the ideas overall, noting the importance of collaboration, education, and community involvement in effective implementation.\n",- "---------- StopMessage (DiGraphStopAgent) ----------\n",- "Digraph execution is complete\n"+ "The user requested brainstorming ideas to reduce plastic waste, looking for practical and impactful solutions. The reviewer provided detailed feedback on each suggested idea, indicating strengths and considerations for improvement, such as involving local businesses, enhancing community engagement, and promoting educational initiatives. The final feedback indicates that the suggestions have great potential and emphasizes the importance of community involvement and education for successful implementation, culminating in an overall approval of the ideas presented.\n"]},{"data": {"text/plain": [- "TaskResult(messages=[TextMessage(source='user', models_usage=None, metadata={}, created_at=datetime.datetime(2025, 6, 5, 4, 16, 39, 836409, tzinfo=datetime.timezone.utc), content='Brainstorm ways to reduce plastic waste.', type='TextMessage'), TextMessage(source='generator', models_usage=RequestUsage(prompt_tokens=27, completion_tokens=555), metadata={}, created_at=datetime.datetime(2025, 6, 5, 4, 16, 48, 788854, tzinfo=datetime.timezone.utc), content='1. **Refill Stations**: Set up refill stations for common household products such as laundry detergent, shampoo, and cleaning supplies in grocery stores and public spaces.\\n\\n2. **Bulk Buying Incentives**: Create incentives for consumers to buy in bulk, reducing the amount of packaging waste.\\n\\n3. **Eco-friendly Packaging**: Encourage companies to develop biodegradable or compostable packaging for their products.\\n\\n4. **Upcycling Workshops**: Organize community workshops that teach people how to repurpose plastic items into practical or decorative objects.\\n\\n5. **Community Clean-Up Events**: Host regular community clean-up events focused on collecting plastic waste from parks, beaches, and roadsides.\\n\\n6. **Education Campaigns**: Launch educational campaigns in schools and communities about the impact of plastic waste and sustainable alternatives.\\n\\n7. **Plastic-Free Challenges**: Initiate a monthly plastic-free challenge encouraging individuals and families to reduce their plastic consumption.\\n\\n8. **Support Local Artisan Products**: Promote local artisans who create products from recycled materials, fostering a circular economy.\\n\\n9. **Rewards Programs**: Develop a rewards program for individuals and businesses who actively reduce their plastic usage, such as discounts or points for using reusable bags and containers.\\n\\n10. **Zero-Waste Grocery Stores**: Support the establishment of zero-waste grocery stores where customers can bring their own containers and buy loose, unpackaged products.\\n\\n11. **Legislation and Policy Changes**: Advocate for policies that ban single-use plastics and promote alternatives in both public and private sectors.\\n\\n12. **Environmentally Friendly Innovations**: Invest in and promote innovations in materials science that create alternatives to plastic from natural materials.\\n\\n13. **Plastic Bank Initiatives**: Start or support initiatives that allow people to exchange plastic waste for products or services, incentivizing recycling.\\n\\n14. **DIY Tutorials**: Create and share DIY tutorials for making your own household products to reduce reliance on plastic-packaged goods.\\n\\n15. **Corporate Sustainability Partnerships**: Encourage collaboration between businesses to share best practices in reducing plastic use and waste.\\n\\n16. **Public Art Installations**: Organize public art projects using collected plastic waste to raise awareness and promote discussions on plastic pollution.\\n\\n17. **Sustainable Fashion Initiatives**: Promote clothing and accessories made from recycled plastics, highlighting those companies that commit to eco-friendly practices.\\n\\n18. **Digital Outreach**: Use social media and digital platforms to raise awareness about the impact of plastic waste and promote sustainable lifestyle choices.\\n\\n19. **Composting Services**: Establish services that help compost food waste and other biodegradable materials, reducing reliance on plastic bags for disposal.\\n\\n20. **Sustainable Event Planning**: Collaborate with event planners to create guidelines for low-plastic events, encouraging the use of sustainable materials and practices.', type='TextMessage'), TextMessage(source='reviewer', models_usage=RequestUsage(prompt_tokens=599, completion_tokens=625), metadata={}, created_at=datetime.datetime(2025, 6, 5, 4, 16, 58, 552656, tzinfo=datetime.timezone.utc), content=\"These ideas provide a comprehensive approach to reducing plastic waste, addressing various aspects such as consumer behavior, community involvement, and corporate responsibility. Here are some feedbacks and suggestions for improvement:\\n\\n1. **Refill Stations**: Provide clear labeling and education about the environmental benefits of using refill stations to encourage more participation.\\n\\n2. **Bulk Buying Incentives**: Consider incorporating a loyalty program that rewards frequent bulk buyers with additional discounts or promotions.\\n\\n3. **Eco-friendly Packaging**: Collaborate with universities and research institutions to foster innovation in eco-friendly packaging designs.\\n\\n4. **Upcycling Workshops**: Expand on this idea by partnering with local artists who can lead sessions, making it more appealing and engaging for the community.\\n\\n5. **Community Clean-Up Events**: Provide incentive programs for participants, such as raffle entries or recognition awards, to boost engagement.\\n\\n6. **Education Campaigns**: Tailor campaigns for different age groups, using age-appropriate messaging and methods to enhance understanding and retention.\\n\\n7. **Plastic-Free Challenges**: Involve local businesses by offering discounts or promotions to participants, creating a community effort with tangible rewards.\\n\\n8. **Support Local Artisan Products**: Connect artisans with online marketplaces to broaden their reach and sales, promoting a circular economy.\\n\\n9. **Rewards Programs**: Build a mobile app dedicated to tracking individuals' sustainable habits, providing insights and rewards for achievements.\\n\\n10. **Zero-Waste Grocery Stores**: Consider including workshops in these stores to educate customers on zero-waste practices and encourage community engagement.\\n\\n11. **Legislation and Policy Changes**: Engage with policymakers and present real data on plastic waste reduction impacts to advocate for meaningful changes.\\n\\n12. **Environmentally Friendly Innovations**: Host hackathons or competitions to stimulate creativity and collaboration in developing sustainable alternatives.\\n\\n13. **Plastic Bank Initiatives**: Collaborate with local businesses to create a network where people can exchange more types of waste for various community services.\\n\\n14. **DIY Tutorials**: Offer a platform where community members can share their own tutorials and experiences, fostering a supportive network for sustainable living.\\n\\n15. **Corporate Sustainability Partnerships**: Encourage companies to share their sustainability stories, motivating others while boosting their brand image.\\n\\n16. **Public Art Installations**: Use social media campaigns to further engage the public in these projects, encouraging them to participate and share their own creations.\\n\\n17. **Sustainable Fashion Initiatives**: Create pop-up shops or fashion shows featuring sustainable lines, helping to raise awareness in a fun and engaging way.\\n\\n18. **Digital Outreach**: Utilize influencers or local celebrities to amplify your message and reach wider audiences, particularly younger populations.\\n\\n19. **Composting Services**: Develop an educational program on composting benefits to accompany the service, helping customers understand its environmental importance.\\n\\n20. **Sustainable Event Planning**: Include a checklist for event planners detailing low-plastic options and provide resources to make the transition easier.\\n\\nOverall, these ideas are solid and can significantly contribute to reducing plastic waste, but implementing them effectively will require collaboration, education, and community involvement. Great job! APPROVE.\", type='TextMessage'), TextMessage(source='summary', models_usage=RequestUsage(prompt_tokens=663, completion_tokens=106), metadata={}, created_at=datetime.datetime(2025, 6, 5, 4, 17, 0, 865057, tzinfo=datetime.timezone.utc), content='The user requested brainstorming ideas to reduce plastic waste. The final feedback provided by the reviewer highlighted that the ideas were comprehensive, covering various facets such as consumer behavior, community involvement, and corporate responsibility. Specific suggestions for improvement included enhancing refill stations with clear labeling, incentivizing bulk buying through loyalty programs, collaborating on eco-friendly packaging, expanding upcycling workshops with local artists, and engaging in educational campaigns tailored to different age groups. The reviewer approved the ideas overall, noting the importance of collaboration, education, and community involvement in effective implementation.', type='TextMessage'), StopMessage(source='DiGraphStopAgent', models_usage=None, metadata={}, created_at=datetime.datetime(2025, 6, 5, 4, 17, 0, 866337, tzinfo=datetime.timezone.utc), content='Digraph execution is complete', type='StopMessage')], stop_reason='Stop message received')"+ "TaskResult(messages=[TextMessage(id='eca90b4f-a8cc-4f06-9b42-d8387caf338e', source='user', models_usage=None, metadata={}, created_at=datetime.datetime(2025, 7, 15, 1, 48, 51, 648989, tzinfo=datetime.timezone.utc), content='Brainstorm ways to reduce plastic waste.', type='TextMessage'), TextMessage(id='29767cbd-ae8d-4dfb-be57-7f982aaddc4b', source='generator', models_usage=RequestUsage(prompt_tokens=27, completion_tokens=627), metadata={}, created_at=datetime.datetime(2025, 7, 15, 1, 49, 6, 788238, tzinfo=datetime.timezone.utc), content='Here are some creative ideas to help reduce plastic waste:\\n\\n1. **Refill Stations**: Create refill stations for common household liquids (like soaps, shampoos, and detergents) where people can bring their own containers to fill up.\\n\\n2. **DIY Kits**: Offer DIY kits for making eco-friendly products, such as beeswax wraps, reusable bags, or natural cleaning solutions.\\n\\n3. **Community Swap Events**: Organize swap events where people can bring unwanted items, including clothing and household products, to exchange instead of purchasing new items.\\n\\n4. **Plastic-Free Challenge**: Launch a community-wide challenge encouraging residents to go plastic-free for a month, sharing tips and experiences on social media.\\n\\n5. **Incentivize Businesses**: Create incentives for local businesses that implement sustainable practices, like providing discounts to customers who bring their own containers or bags.\\n\\n6. **Educational Campaigns**: Partner with schools to educate children about the impact of plastic waste and encourage them to take home messages to their families.\\n\\n7. **Plastic-Free Shopping Zones**: Designate certain areas in town as plastic-free zones where businesses agree to eliminate single-use plastics.\\n\\n8. **Upcycling Workshops**: Host workshops teaching people how to upcycle plastic waste into art, furniture, or home decor.\\n\\n9. **Composting Competition**: Encourage households to compost food waste and offer a competition for the best composting garden to foster eco-awareness.\\n\\n10. **Zero-Waste Stores**: Support or start zero-waste stores that sell bulk goods, allowing customers to shop with their own containers.\\n\\n11. **Mobile Recycling Units**: Implement mobile recycling units that visit neighborhoods to educate residents on recycling properly and collect recyclables.\\n\\n12. **Plastic Offset Programs**: Create programs that allow individuals and companies to offset their plastic usage through donations to initiatives that remove plastic from oceans.\\n\\n13. **Collaboration with Influencers**: Partner with social media influencers to spread the message about reducing plastic waste and promote sustainable alternatives.\\n\\n14. **Sustainable Product Market**: Organize a market dedicated exclusively to sustainable products and services, showcasing local vendors who prioritize eco-friendly practices.\\n\\n15. **Plastic Waste Art Installations**: Collaborate with artists to create public installations made from recycled plastic, raising awareness of the plastic problem in a visually impactful way.\\n\\n16. **Interactive Apps**: Develop apps that track plastic usage and provide personalized tips for reducing plastic consumption based on user habits.\\n\\n17. **Corporate Partnerships**: Work with businesses to develop corporate responsibility programs focused on reducing plastic use in their operations and packaging.\\n\\n18. **Legislation Advocacy**: Promote local policies that restrict single-use plastics or support more effective recycling programs.\\n\\n19. **Public Transportation Awareness**: Encourage public transportation usage by providing eco-friendly incentives for those who walk, bike, or use buses instead of cars.\\n\\n20. **Create a Local Plastic Waste Repository**: Start a community hub where individuals and artists can drop off plastic waste for reuse in projects or art pieces.\\n\\nBy implementing these ideas, communities can take significant steps toward reducing plastic waste and fostering a sustainable future.', type='TextMessage'), TextMessage(id='54e02028-0239-4809-8163-af60745e6b9d', source='reviewer', models_usage=RequestUsage(prompt_tokens=671, completion_tokens=532), metadata={}, created_at=datetime.datetime(2025, 7, 15, 1, 49, 17, 327641, tzinfo=datetime.timezone.utc), content='These ideas present a comprehensive and practical approach to reducing plastic waste within communities. Here’s some feedback and considerations for each suggestion:\\n\\n1. **Refill Stations**: Great idea; consider partnering with local health and wellness shops for broader adoption.\\n \\n2. **DIY Kits**: Ensure kits include clear instructions and safety guidance to promote user-friendliness.\\n\\n3. **Community Swap Events**: Promote these as regular events to build a sense of community and reinforce sustainable habits.\\n\\n4. **Plastic-Free Challenge**: Consider creating a dedicated hashtag to track participants’ journeys and foster engagement online.\\n\\n5. **Incentivize Businesses**: Work on a simple certification system for sustainable businesses to encourage participation and recognition.\\n\\n6. **Educational Campaigns**: Tailor content to different age groups to maximize impact across the community.\\n\\n7. **Plastic-Free Shopping Zones**: Consider involving local government for support and promotion, which can increase visibility and compliance.\\n\\n8. **Upcycling Workshops**: Source materials locally for workshops to decrease transportation emissions and support local businesses.\\n\\n9. **Composting Competition**: Collaborate with gardening clubs for expert insights and to broaden participation in community gardening.\\n\\n10. **Zero-Waste Stores**: Explore online sales options to enhance accessibility while retaining the focus on zero-waste practices.\\n\\n11. **Mobile Recycling Units**: Train volunteers for effective community engagement and education during visits.\\n\\n12. **Plastic Offset Programs**: Emphasize transparency in how donations are used to build trust within the community.\\n\\n13. **Collaboration with Influencers**: Ensure influencers have a genuine commitment to sustainability to ensure credible messaging.\\n\\n14. **Sustainable Product Market**: Regularly invite new vendors to keep the market fresh and encourage innovation in sustainable products.\\n\\n15. **Plastic Waste Art Installations**: Consider educational plaques accompanying installations that inform viewers about the issues of plastic waste.\\n\\n16. **Interactive Apps**: Include gamification elements to encourage increased user engagement and sharing among friends.\\n\\n17. **Corporate Partnerships**: Develop case studies or success stories to showcase the benefits of reduced plastic use for businesses.\\n\\n18. **Legislation Advocacy**: Mobilize community members to become advocates themselves, creating a grass-roots effort for policy change.\\n\\n19. **Public Transportation Awareness**: Explore partnerships with public transit systems for eco-friendly promotions.\\n\\n20. **Create a Local Plastic Waste Repository**: Establish partnerships with local craft schools or organizations to enhance creativity and use of the repository.\\n\\nOverall, these ideas have high potential for impactful implementation. Emphasizing community engagement, education, and ongoing support will help ensure their success. **APPROVE**.', type='TextMessage'), TextMessage(id='55409dc3-9766-4071-ab85-0b3125cb59c7', source='summary', models_usage=RequestUsage(prompt_tokens=570, completion_tokens=82), metadata={}, created_at=datetime.datetime(2025, 7, 15, 1, 49, 19, 442276, tzinfo=datetime.timezone.utc), content='The user requested brainstorming ideas to reduce plastic waste, looking for practical and impactful solutions. The reviewer provided detailed feedback on each suggested idea, indicating strengths and considerations for improvement, such as involving local businesses, enhancing community engagement, and promoting educational initiatives. The final feedback indicates that the suggestions have great potential and emphasizes the importance of community involvement and education for successful implementation, culminating in an overall approval of the ideas presented.', type='TextMessage')], stop_reason='Digraph execution is complete')"]},- "execution_count": 1,+ "execution_count": 2,"metadata": {},"output_type": "execute_result"}@@ -531,6 +533,7 @@" DiGraphBuilder,\n"," GraphFlow,\n",")\n",+ "from autogen_agentchat.conditions import MaxMessageTermination\n","from autogen_agentchat.ui import Console\n","from autogen_ext.models.openai import OpenAIChatCompletionClient\n","\n",@@ -568,10 +571,13 @@"builder.set_entry_point(generator) # Set entry point to generator. Required if there are no source nodes.\n","graph = builder.build()\n","\n",+ "termination_condition = MaxMessageTermination(10)\n",+ "\n","# Create the flow\n","flow = GraphFlow(\n"," participants=builder.get_participants(),\n"," graph=graph,\n",+ " termination_condition=termination_condition\n",")\n","\n","# Run the flow and pretty print the output in the console\n",@@ -609,6 +615,7 @@"source": ["from autogen_agentchat.agents import AssistantAgent\n","from autogen_agentchat.teams import DiGraphBuilder, GraphFlow\n",+ "from autogen_agentchat.conditions import MaxMessageTermination\n","from autogen_agentchat.ui import Console\n","from autogen_ext.models.openai import OpenAIChatCompletionClient\n","\n",@@ -641,9 +648,10 @@"# B → E (exit condition)\n","builder.add_edge(agent_b, agent_e, condition=\"STOP\")\n","\n",+ "termination_condition = MaxMessageTermination(10)\n","# Build and create flow\n","graph = builder.build()\n",- "flow = GraphFlow(participants=[agent_a, agent_b, agent_c], graph=graph)\n",+ "flow = GraphFlow(participants=[agent_a, agent_b, agent_c, agent_e], graph=graph, termination_condition=termination_condition)\n","\n","print(\"=== Example 1: A→B→C→B with 'All' Activation ===\")\n","print(\"B will exit when it receives a message from C\")\n",@@ -795,7 +803,7 @@],"metadata": {"kernelspec": {- "display_name": ".venv",+ "display_name": "python","language": "python","name": "python3"},