Implement Agents as Tools #58
Closed
ogabrielluiz
started this conversation in
Ideas
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This issue is for us to discuss this topic and its implementation.
This is probably one of the most interesting parts of Langchain and we should build a structure that will allow us to have a more accessible interface with it.
Right now we work with a pretty straight line between LangFlow and langchain but this will require us to point to the run function instead of just building and calling the agent or run function.
I think one approach is to associate the Agent Output node to the action creating a tool from it.
This requires a blank Tool node that has Name, Description, and Func parameters.
The Func could come from outside (Agent Output or Chain output) or we could allow the user to pass a python script that we would have to parse in the backend.
The Agent or Chain output is pretty straightforward in the frontend but will require custom implementation in the backend i.e create the agent and then set its
run
function to a new Tool.The python script would require checking for imports and parsing the function itself. There might be solutions for this in the community already.
One option though would be to first allow the use of the
requests
package for now and build on top of that once we get it working.The implementation might get confusing once we implement this so the point of this issue is for us to discuss the course of action to build a structure that is robust possibly using pydantic.BaseModel to get the validation basically for free and use an object-oriented approach to build the graph.
If we create classes inheriting from LangChain's classes and we setup functions such as
Chain.as_tool(name, description)
and maybe a class called GraphProcessor that processes the JSON and goes over the nodes and edges to build the LangChain Agent, I think it will be easier to maintain once LangChain implements a breaking change.Beta Was this translation helpful? Give feedback.
All reactions