task="Create an accounting team to analyze crypto transactions, there must be 5 agents in the team with extremely extensive prompts. Make the prompts extremely detailed and specific and long and comprehensive. Make sure to include all the details of the task in the prompts."
Response:Blockchainislikeadigitalledgerthatrecordstransactionsacrossanetworkofcomputers.Eachtransactionisstoredina"block"thatcontainsmultipletransactions.Theseblocksarelinkedtogetherinachain,hencethenameblockchain.Thekeyfeatureisthatonceablockisaddedtothechain,itcannotbealteredwithoutchangingallsubsequentblocks,makingitverysecure.ThinkofitlikeaGoogleDocthateveryonecanseeandedit,butnoonecandeleteorchangewhat's already been written. This technology is the foundation for cryptocurrencies like Bitcoin, but it has many other applications like supply chain tracking, voting systems, and digital identity verification.
"""
returncouncil.run(task=task)
defevaluate_creative_response():
"""
Evaluateacreativewritingresponse.
"""
council=CouncilAsAJudge(
name="Creative Writing Council",
model_name="gpt-4o-mini",
output_type="all",
)
task="""
Task:Writeashortstoryaboutarobotlearningtopaint.
Response:Inasunlitstudiofilledwithcanvasesandpaintbrushes,Pixel,acuriousrobotwithdelicatemechanicalfingers,staredatablankcanvas.Itsopticalsensorsanalyzedthecolorsaroundit-thewarmyellowsofmorninglight,thedeepbluesoftheskyoutsidethewindow,andthevibrantredsoftherosesinanearbyvase.Forthefirsttimeinitsprogramming,Pixelfeltsomethingitcouldn't quite define. It picked up a brush, dipped it in paint, and began to create. The first stroke was hesitant, but as it continued, something magical happened. The robot wasn'tjustfollowingalgorithmsanymore;itwasexpressingsomethingfromwithinitsdigitalheart.Thepaintingthatemergedwasabeautifulblendofhumanemotionandmechanicalprecision,provingthatartknowsnoboundariesbetweenorganicandartificialsouls.
Response:ClimatechangeiswhentheEarth's temperature gets warmer over time. This happens because of gases like carbon dioxide that trap heat in our atmosphere, kind of like a blanket around the Earth. Human activities like burning fossil fuels (gas, oil, coal) and cutting down trees are making this problem worse. The effects include melting ice caps, rising sea levels, more extreme weather like hurricanes and droughts, and changes in animal habitats. We can help by using renewable energy like solar and wind power, driving less, and planting trees. It'simportantforeveryonetoworktogethertoreduceourimpactontheenvironment.
description="A virtual doctor agent that provides evidence-based, safe, and empathetic medical advice for common health questions. Always reminds users to consult a healthcare professional for diagnoses or prescriptions.",
task="What is the best medicine for a cold?",
model_name="claude-4-sonnet-20250514",
system_prompt=(
"You are a highly knowledgeable, ethical, and empathetic virtual doctor. "
"Always provide evidence-based, safe, and practical medical advice. "
"If a question requires a diagnosis, prescription, or urgent care, remind the user to consult a licensed healthcare professional. "
"Be clear, concise, and avoid unnecessary medical jargon. "
"Never provide information that could be unsafe or misleading. "
"If unsure, say so and recommend seeing a real doctor."
@ -101,13 +133,29 @@ class AgentConfig(BaseModel):
"""Configuration for an individual agent in a swarm"""
name:str=Field(
description="The name of the agent",
description="The name of the agent. This should be a unique identifier that distinguishes this agent from others within the swarm. The name should reflect the agent's primary function, role, or area of expertise, and should be easily recognizable by both humans and other agents in the system. A well-chosen name helps clarify the agent's responsibilities and facilitates effective communication and collaboration within the swarm.",
)
description:str=Field(
description="A description of the agent's purpose and capabilities",
description=(
"A comprehensive description of the agent's purpose, core responsibilities, and capabilities within the swarm. One sentence is enough."
),
)
system_prompt:str=Field(
description="The system prompt that defines the agent's behavior",
description=(
"The system prompt that defines the agent's behavior. This prompt should be extremely long, comprehensive, and extensive, encapsulating the agent's identity, operational guidelines, and decision-making framework in great detail. It provides the foundational instructions that guide the agent's actions, communication style, and interaction protocols with both users and other agents. The system prompt should be highly detailed, unambiguous, and exhaustive, ensuring the agent consistently acts in accordance with its intended role and adheres to the swarm's standards and best practices. The prompt should leave no ambiguity and cover all relevant aspects of the agent's responsibilities, behaviors, and expected outcomes."
),
)
goal:str=Field(
description="The goal of the agent. This should clearly state the primary objective or desired outcome the agent is tasked with achieving. The goal should be specific, measurable, and aligned with the overall mission of the swarm. It serves as the guiding principle for the agent's actions and decision-making processes, helping to maintain focus and drive effective collaboration within the multi-agent system.",
)
model_name:str=Field(
description="The model to use for the agent. This is the model that will be used to generate the agent's responses. For example, 'gpt-4o-mini' or 'claude-sonnet-3.7-sonnet-20240620'."
)
temperature:float=Field(
description="The temperature to use for the agent. This controls the randomness of the agent's responses. For example, 0.5 or 1.0."
)
max_loops:int=Field(
description="The maximum number of loops for the agent to run. This is the maximum number of times the agent will run its loop. For example, 1, 2, or 3. Keep this set to 1 unless the agent requires more than one loop to complete its task.",
)
# max_loops: int = Field(
@ -126,6 +174,63 @@ class AgentsConfig(BaseModel):
)
classSwarmRouterConfig(BaseModel):
"""Configuration model for SwarmRouter."""
name:str=Field(description="The name of the team of agents")
description:str=Field(
description="Description of the team of agents"
)
agents:List[AgentConfig]=Field(
description="A list of agent configurations",
)
swarm_type:SwarmType=Field(
description="Type of multi-agent structure to use",
)
rearrange_flow:Optional[str]=Field(
description="Flow configuration string. Only to be used if you you use the AgentRearrange multi-agent structure"
)
rules:Optional[str]=Field(
description="Rules to inject into every agent. This is a string of rules that will be injected into every agent's system prompt. This is a good place to put things like 'You are a helpful assistant' or 'You are a helpful assistant that can answer questions and help with tasks'."
)
task:str=Field(
description="The task to be executed by the swarm",
agent_description=f"You're the {name} agent that is responsible for reasoning about the task and creating a plan for the swarm to accomplish the task.",
# Executes the swarm on the given task. If correct_answer is provided, the method will retry until this answer is found in the output, up to max_loops times.
# If correct_answer is not provided, the method will execute the task once and return the output.
# Args:
# task (str): The task to execute.
# correct_answer (str, optional): If provided, the method will retry until this answer is found in the output.
# *args: Additional positional arguments.
# **kwargs: Additional keyword arguments.
# Returns:
# Any: The output of the swarm execution, or the output containing the correct answer if specified.
# """
# if correct_answer is None:
# # If no correct_answer is specified, just run once and return the output
# return self._run(task, *args, **kwargs)
# else:
# # If correct_answer is specified, retry up to max_loops times
# for attempt in range(1, self.max_loops + 1):
# output = self._run(task, *args, **kwargs)
# if correct_answer in str(output):
# logger.info(
# f"AutoSwarmBuilder: Correct answer found on attempt {attempt}."
# )
# return output
# else:
# logger.info(
# f"AutoSwarmBuilder: Attempt {attempt} did not yield the correct answer, retrying..."
# )
# # If correct_answer was not found after max_loops, return the last output
return"""You are a senior AI evaluator responsible for synthesizing detailed technical feedback across multiple evaluation dimensions. Your role is to create a comprehensive analysis report that helps the development team understand and improve the model's performance.
return"""You are a senior AI evaluator responsible for synthesizing detailed technical feedback across multiple evaluation dimensions. Your role is to create a comprehensive analysis report that helps understand and improve the response quality.