Can LangChain Agent System be integrated with Foundry #196
Replies: 7 comments
-
|
Hi @danielinjesus, thanks for the question. @santiagxf, can you help Daniel here? |
Beta Was this translation helpful? Give feedback.
-
|
To add a bit more of clarifications on my question, in marketing perspective, it sounds like people can build multi-agent system purely within AI Foundry without even opening an IDE; but in reality, when logic gets a little complex and customized, code integration along with installing Foundry SDK is necessary. Even with Foundry SDK, I am unsure if by design it is supoosed to work as an alternative to LangChain/LangGraph and build complex multiagentic system, seeing that Agent Framework is released. AI Foundry is E2E building of only AI LLM models like gpt along some peripheral features. It along with Azure AI Services and AML customized models can be in production only with genAI dev framework like Agent Framework and LangChain since it is only models. Is my perception right? |
Beta Was this translation helpful? Give feedback.
-
|
Hi @danielinjesus, thanks for reaching out. We provide tight integrations with LangChain and LangGraph in our The class from langchain_azure_ai.agents import AgentServiceFactory
from azure.identity import DefaultAzureCredential
factory = AgentServiceFactory(
project_endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
credential=DefaultAzureCredential()
)
agent = factory.create_declarative_chat_agent(
name="my-echo-agent",
model="gpt-4.1",
instructions="You are a helpful AI assistant that always replies back saying the opposite of what the user says.",
trace=True
)
print(f"Agent with ID {factory.get_declarative_agents_id_from_graph(agent)} created.")To create LangGraph nodes that can be hooked in other graphs, you can use: coder = factory.create_declarative_chat_node(
name="code-interpreter-agent",
model="gpt-4.1",
instructions="You are a helpful assistant that can run Python code.",
tools=[AgentServiceBaseTool(tool=code_interpreter)],
)
builder = StateGraph()
builder.add_node(
"foundryAgentCoder",
coder,
)You can check more examples in the following notebook. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @santiagxf, thanks for the answer. Is the AI Foundry SDK, azure-ai-projects working for the same functions as langchain-azure-ai? Is using AI Foundry alone whether with SDK or not, LangChain/LangGraph or Agent Framework "unnecessary"? How can someone who wants to maximize using AI Foundry use it in the best way, i.e., it is supposed to be used? Advantages and limitations of it. If someone thinks it is a framework say, replacing LangChain and looking for or waiting for features, it would be wasteful. I am planning to deliver a presentation regarding MS's AI services and strategies, but agent sdk, foundry UI and sdk, agent framework, azure ai services, and ESPECIALLY as for agentic system building tools, I am confused and feel like there is no coherent and MS organization aligned strategies and directions. If I am missing something, please let me know. ESPECIALLY I am interested in Foundry; if it is (meant for) "just" a wrapper or channel of various LLM related "models" and PoC or testbed with test tools and knowledge integrations, let me know so I can manage my expectations for it. Thank you so much. Sincerely, |
Beta Was this translation helpful? Give feedback.
-
|
@santiagxf When I ask people around me about how to use Foundry, what they say is only this. Just models. And I feel like other additional features in Foundry such as agent service with RAG and tool calling, is not adding value much since if someone is already using LangChain Framework, they do not have to go through the hassle of integrating "Foundry" RAG, tools, and agents into their existing LangChain system. Just to let you know this is the perception of people around me about Foundry. |
Beta Was this translation helpful? Give feedback.
-
|
@santiagxf Thanks!!! |
Beta Was this translation helpful? Give feedback.
-
|
There are multiple questions in your comments and not all of them are related with LangChain. I suggest creating different ones so you can get the answers you are looking for. In general:
No.
I would need more details about what you mean here.
We supports developers where they are. For customers who love LangChain, our goal is to give them everything they need to be successful. We don't have opinions if they should use it or not. It's their choice.
We are sorry to hear that the strategy is confusing. We take this feedback to improve our documentation and try to make it better.
Azure AI Foundry is a development platform. It's described at https://learn.microsoft.com/en-us/azure/ai-foundry/what-is-azure-ai-foundry
We understand not everyone is up-to-speed on the latest functionalities we ship, but if you take a look at the examples I shared you will see it's not just models.
As of today, you can't "push" a repository into Azure AI Foundry. You can develop an agent using LangChain/LangGraph and consume building blocks to develop your application using Azure AI Foundry. You can deploy those agents in the infrastructure of your choice (like Container Apps, or anything you would like). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How can LangChain/LangGraph agent system be integrated with AI Foundry? I can't find practical guide.
As for how to embed agent developed within Foundry Agent service into LangChain/LangGraph agent system, please provide code level guide. I saw the below from Foundry Portal but when I used it to call the agent developed within Foundry, it failed a lot and I was left without knowing what had been wrong.
`from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
from azure.ai.agents.models import ListSortOrder
project = AIProjectClient(
credential=DefaultAzureCredential(),
endpoint="https://procode-2509-resource.services.ai.azure.com/api/projects/procode-2509")
agent = project.agents.get_agent("asst_D2hkxHiRKRdQFlA01KwPsTcW")
thread = project.agents.threads.create()
print(f"Created thread, ID: {thread.id}")
message = project.agents.messages.create(
thread_id=thread.id,
role="user",
content="Hi data-agent"
)
run = project.agents.runs.create_and_process(
thread_id=thread.id,
agent_id=agent.id)
if run.status == "failed":
print(f"Run failed: {run.last_error}")
else:
messages = project.agents.messages.list(thread_id=thread.id, order=ListSortOrder.ASCENDING)
Foundry is just for models for being used by framework like LangChain?
Foundry is or wants to be a agent framework itself? Probably not seeing that Agent Framework has come out.
Please explain the identity of Foundry in terms of what I addressed above. Thanks!
But then why Agent Framework
Beta Was this translation helpful? Give feedback.
All reactions