Skip to content

Ability to integrate external agents into the framework#246

Closed
ZmeiGorynych wants to merge 10 commits into
crewAIInc:mainfrom
ZmeiGorynych:external_agents
Closed

Ability to integrate external agents into the framework#246
ZmeiGorynych wants to merge 10 commits into
crewAIInc:mainfrom
ZmeiGorynych:external_agents

Conversation

@ZmeiGorynych
Copy link
Copy Markdown

@sameermahajan
Copy link
Copy Markdown

looking forward to merge of this PR into main for our use cases

@ZmeiGorynych
Copy link
Copy Markdown
Author

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 :)
I started it after the above PR was put on ice, and it's all about nice orchestration, while allowing you to use any agents and tools of your choice, conveniently.

Comment thread src/crewai/agent.py
self,
task: Any,
context: Optional[str] = None,
context: Optional[List[str]] = None,
Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Author

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

Copy link
Copy Markdown
Collaborator

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"):
Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Author

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 :)

Copy link
Copy Markdown
Collaborator

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):
Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Author

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 :)

@ogabrielluiz
Copy link
Copy Markdown

Looking forward to this as well. We'd use this to connect Agent components to CrewAI components in Langflow.

@lorenzejay
Copy link
Copy Markdown
Collaborator

#776 this PR address this letting you bring your agents by extending the BaseAgent class

@lorenzejay lorenzejay closed this Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants