mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
* better spacing * works with llama index * works on langchain custom just need delegation to work * cleanup for custom_agent class * works with different argument expectations for agent_executor * cleanup for hierarchial process, better agent_executor args handler and added to the crew agent doc page * removed code examples for langchain + llama index, added to docs instead * added key output if return is not a str for and added some tests * added hinting for CustomAgent class * removed pass as it was not needed * closer just need to figuire ou agentTools * running agents - llamaindex and langchain with base agent * some cleanup on baseAgent * minimum for agent to run for base class and ensure it works with hierarchical process * cleanup for original agent to take on BaseAgent class * Agent takes on langchainagent and cleanup across * token handling working for usage_metrics to continue working * installed llama-index, updated docs and added better name * fixed some type errors * base agent holds token_process * heirarchail process uses proper tools and no longer relies on hasattr for token_processes * removal of test_custom_agent_executions * this fixes copying agents * leveraging an executor class for trigger llamaindex agent * llama index now has ask_human * executor mixins added * added output converter base class * type listed * cleanup for output conversions and tokenprocess eliminated redundancy * properly handling tokens * simplified token calc handling * original agent with base agent builder structure setup * better docs * no more llama-index dep * cleaner docs * test fixes * poetry reverts and better docs * base_agent_tools set for third party agents * updated task and test fix
26 lines
872 B
Python
26 lines
872 B
Python
from langchain.tools import StructuredTool
|
|
|
|
from crewai.agents.agent_builder.utilities.base_agent_tool import BaseAgentTools
|
|
|
|
|
|
class AgentTools(BaseAgentTools):
|
|
"""Default tools around agent delegation"""
|
|
|
|
def tools(self):
|
|
coworkers = f"[{', '.join([f'{agent.role}' for agent in self.agents])}]"
|
|
tools = [
|
|
StructuredTool.from_function(
|
|
func=self.delegate_work,
|
|
name="Delegate work to coworker",
|
|
description=self.i18n.tools("delegate_work").format(
|
|
coworkers=coworkers
|
|
),
|
|
),
|
|
StructuredTool.from_function(
|
|
func=self.ask_question,
|
|
name="Ask question to coworker",
|
|
description=self.i18n.tools("ask_question").format(coworkers=coworkers),
|
|
),
|
|
]
|
|
return tools
|