-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Ability to integrate external agents into the framework #246
Conversation
…ternal_agents # Conflicts: # src/crewai/agent.py
looking forward to merge of this PR into main for our use cases |
If you want to mix and match CrewAI agents with any other ones (Langchain, LllamaIndex, and Autogen so far, happy to add more), take a look at motleycrew :) |
@@ -131,7 +131,7 @@ def check_agent_executor(self) -> "Agent": | |||
def execute_task( | |||
self, | |||
task: Any, | |||
context: Optional[str] = None, | |||
context: Optional[List[str]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this breaking anything in terms of retro-compatibility? Not an issue, per se, but I wonder if there's any way around if that's the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just thought that the natural kind of context is a list of past messages in a conversation, and it's more natural to pass that through as a list instead of squashing it into a str
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love it. It makes sense! My concern is the breaking change. What if we moved it to an str | List[str] | None
type?
|
||
@property | ||
def i18n(self) -> I18N: | ||
if hasattr(self, "_agent") and hasattr(self._agent, "i18n"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we prevent this kind of indirection by using some sort of interface? We are moving fast to become a strongly-typed library and this makes it very hard to make sure things are working properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an offician AgentInterface existed, this could be part of it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanna draft something here?
from crewai.utilities import I18N | ||
|
||
|
||
class AgentWrapperParent(ABC, BaseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really loved the generic agent interface. In a perfect world, this would be the only way the engine would refer to agents, right!? Should we call it AgentInterface
, like the file name? #namingishard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make it clear, the dream here is that even Agent
respects AgentInterface
, then anything that complies to the interface would be able to be an agent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, that was exactly the idea :)
Looking forward to this as well. We'd use this to connect Agent components to CrewAI components in Langflow. |
#776 this PR address this letting you bring your agents by extending the BaseAgent class |
As discussed in #228
Example usage in https://github.com/joaomdmoura/crewAI-examples/pull/52/files