|
|
|
@ -124,8 +124,9 @@ def run_agent(
|
|
|
|
|
raise RuntimeError(f"Error running agent: {str(e)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def find_agent_by_name(agents: List[Union[Agent, Callable]], agent_name: str) -> Agent:
|
|
|
|
|
def find_agent_by_name(
|
|
|
|
|
agents: List[Union[Agent, Callable]], agent_name: str
|
|
|
|
|
) -> Agent:
|
|
|
|
|
"""
|
|
|
|
|
Find an agent by its name in a list of agents.
|
|
|
|
|
|
|
|
|
@ -151,9 +152,8 @@ def find_agent_by_name(agents: List[Union[Agent, Callable]], agent_name: str) ->
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
for agent in agents:
|
|
|
|
|
if hasattr(agent, 'name') and agent.name == agent_name:
|
|
|
|
|
if hasattr(agent, "name") and agent.name == agent_name:
|
|
|
|
|
return agent
|
|
|
|
|
raise ValueError(f"Agent with name '{agent_name}' not found")
|
|
|
|
|
except Exception as e:
|
|
|
|
|
raise RuntimeError(f"Error finding agent: {str(e)}")
|
|
|
|
|
|
|
|
|
|