Skip to content
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

Proposal: Langchain Integration #74

Open
jondwillis opened this issue Oct 17, 2023 · 4 comments
Open

Proposal: Langchain Integration #74

jondwillis opened this issue Oct 17, 2023 · 4 comments

Comments

@jondwillis
Copy link

jondwillis commented Oct 17, 2023

Objective:

The primary advantage to be gained from integrating with Langchain is for Agent Protocol exposure/advocacy. Langchain docs and repos get a decent chunk of traffic! There is also greater potential for simple and quick interop between projects that adopt Langchain and/or the Agent Protocol already.

Additionally, the proposed Agent and AgentExecutor could be used as a reference implementation.

Background:

LangChain consists of a Python and Typescript library. There are also some other newer applications in the ecosystem such as LangSmith and LangServe. LangChain is a commonly used library that has built-in agents already.

Proposed:

TL;DR: Implement something like AgentProtocolAgent and AgentProtocolAgentExecutor, which would take an Agent Protocol API-compliant base URL. After there is a PR open for that, we can then evaluate if some other abstractions like Tool, Chain, Retriever, etc., would be worth implementing as well.

We can probably get by with following: https://github.com/langchain-ai/langchainjs/blob/main/.github/contributing/INTEGRATIONS.md
Otherwise, we contact and work with the LangChain TS and Python maintainers so that we can have a high chance of success for having a set of pull requests merged into the upstream Langchain repos. The pull requests should consider integrating with the Agent Protocol in the following ways:

  • An Agent that works by consuming Agent Protocol endpoints. This could work by extending or passing in a new parameter to the agent executor initializer functions.

  • A Tool that works by calling Agent Protocol endpoints.

  • A Retriever that gets the result of a task or otherwise consumes Agent Protocol endpoints.

  • Add documentation (there are many Integrations docs already to use as examples!) so that discoverability is improved.

Examples:

TBD

Discussion Points:

Are the proposed abstractions the best to start with and sufficient?

I am happy to try to work on this initiative, but I also have limited time and would be more effective working on the Typescript portion.

@davidzshi
Copy link

First of all, excited that this proposal is in progress.

I think the abstractions make sense conceptually, but I'm having trouble understanding exactly how you would adapt a Langchain agent to the protocol.

Given that there are multiple agents and chains available in Langchain with many permutations for combining them, it'd be great to understand how an existing agent can become compliant and how that determination can be verified.

Some concrete examples detailing this would be fantastic - I'd be happy to contribute some after getting a better sense of what you're thinking.

@jondwillis
Copy link
Author

jondwillis commented Oct 20, 2023

First of all, excited that this proposal is in progress.

I think the abstractions make sense conceptually, but I'm having trouble understanding exactly how you would adapt a Langchain agent to the protocol.

Given that there are multiple agents and chains available in Langchain with many permutations for combining them, it'd be great to understand how an existing agent can become compliant and how that determination can be verified.

Some concrete examples detailing this would be fantastic - I'd be happy to contribute some after getting a better sense of what you're thinking.

I am working on this, and will link a few prototypes soon. After some basic research and discussion, the most clear path in my understand would be to write a custom AgentExecutor+Agent. (unfortunately AgentProtocolAgentExecutor, and AgentProtocolAgent do not exactly roll off the tongue 👅.) The primary new input to these would an Agent Protocol API-compliant base URL. This would basically serve as a reference implementation, and then I will consider exposing the Agent Protocol in other ways (Tools, Retrievers, Chains).

I may be oversimplifying or missing some details, so let me know if you have any specific suggestions or use-cases you want to support @davidzshi

@hackgoofer
Copy link
Contributor

Given that there are multiple agents and chains available in Langchain with many permutations for combining them, it'd be great to understand how an existing agent can become compliant and how that determination can be verified.

This is how you can verify:

$ URL=http://127.0.0.1:8000 bash -c "$(curl -fsSL https://raw.githubusercontent.com/AI-Engineers-Foundation/agent-protocol/main/testing_suite/test.sh)"

where http://127.0.0.1:8000 is where your agent is running, and accepting REST calls that are compliant with the protocol.

@davidzshi
Copy link

Got it! Thanks @jondwillis @hackgoofer, that's helpful context. Looking forward to reading more about the reference implementation when it's ready.

I'm primarily interested in the potential of interoperable Langchain agents. In practice, this means that for a specific field, a number of specialist agents can be created and then called upon to solve complex problems. In Langchain, this would look like leveraging agents as tools, but what excites me most about Agent Protocol is the potential for multi-agent systems that are unaffiliated. If one generalist agent is able to, using the standardization of queries and responses, access the specialized skills of a specialist agent, it opens up an entire world of possibilities.

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

No branches or pull requests

3 participants