Skip to content

Commit b66c9aa

Browse files
authored
Merge pull request #130 from UiPath/fix/update_samples_streamable_http
chore: update sample agents with streamable http
2 parents 486d995 + 21dc118 commit b66c9aa

File tree

10 files changed

+1611
-1152
lines changed

10 files changed

+1611
-1152
lines changed

samples/github-helper-agent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ uv sync
8080
Set your MCP Remote Server URL as environment variables in `.env`:
8181

8282
```bash
83-
UIPATH_MCP_SERVER_URL=https://cloud.uipath.com/account/tenant/agenthub_/mcp/folder-key/github-mcp/sse
83+
UIPATH_MCP_SERVER_URL=https://cloud.uipath.com/account/tenant/agenthub_/mcp/folder-key/github-mcp/
8484
```
8585

8686
## Debugging

samples/github-helper-agent/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from langgraph.prebuilt import create_react_agent
1212
from langgraph.prebuilt.chat_agent_executor import AgentState
1313
from mcp import ClientSession
14-
from mcp.client.sse import sse_client
14+
from mcp.client.streamable_http import streamablehttp_client
1515
from pydantic import BaseModel, Field
1616
from uipath_langchain.chat.models import UiPathAzureChatOpenAI
1717

@@ -96,11 +96,11 @@ def process_comment(comment) -> PullRequestComment:
9696

9797
@asynccontextmanager
9898
async def make_graph():
99-
async with sse_client(
99+
async with streamablehttp_client(
100100
url=os.getenv("UIPATH_MCP_SERVER_URL"),
101101
headers={"Authorization": f"Bearer {os.getenv('UIPATH_ACCESS_TOKEN')}"},
102102
timeout=60,
103-
) as (read, write):
103+
) as (read, write, session_id_callback):
104104
async with ClientSession(read, write) as session:
105105
all_tools = await load_mcp_tools(session)
106106

samples/github-helper-agent/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "An automated agent that reviews GitHub pull requests and provides
55
authors = [{ name = "Cristi Pufu", email = "[email protected]" }]
66
dependencies = [
77
"uipath-langchain>=0.0.118",
8-
"langgraph>=0.3.34",
9-
"langchain-mcp-adapters>=0.0.9"
8+
"langgraph>=0.5.4",
9+
"langchain-mcp-adapters>=0.1.9"
1010
]
1111
requires-python = ">=3.11"

samples/github-helper-agent/uv.lock

Lines changed: 671 additions & 397 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/github-slack-agent/main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from langgraph.prebuilt import create_react_agent
77
from langgraph.prebuilt.chat_agent_executor import AgentState
88
from mcp import ClientSession
9-
from mcp.client.sse import sse_client
9+
from mcp.client.streamable_http import streamablehttp_client
1010
from uipath_langchain.chat.models import UiPathAzureChatOpenAI
1111

1212
dotenv.load_dotenv()
@@ -20,19 +20,19 @@
2020

2121
@asynccontextmanager
2222
async def make_graph():
23-
async with sse_client(
23+
async with streamablehttp_client(
2424
url=GITHUB_MCP_SERVER_URL,
2525
headers={"Authorization": f"Bearer {UIPATH_ACCESS_TOKEN}"},
2626
timeout=60,
27-
) as (git_read, git_write):
27+
) as (git_read, git_write, git_session_id_callback):
2828
async with ClientSession(git_read, git_write) as git_session:
2929
all_github_tools = await load_mcp_tools(git_session)
3030

31-
async with sse_client(
31+
async with streamablehttp_client(
3232
url=SLACK_MCP_SERVER_URL,
3333
headers={"Authorization": f"Bearer {UIPATH_ACCESS_TOKEN}"},
3434
timeout=60,
35-
) as (slack_read, slack_write):
35+
) as (slack_read, slack_write, slack_session_id_callback):
3636
async with ClientSession(slack_read, slack_write) as slack_session:
3737
all_slack_tools = await load_mcp_tools(slack_session)
3838

samples/github-slack-agent/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "An automated agent that reviews GitHub pull requests and provides
55
authors = [{ name = "Cristi Pufu", email = "[email protected]" }]
66
dependencies = [
77
"uipath-langchain>=0.0.118",
8-
"langgraph>=0.3.34",
9-
"langchain-mcp-adapters>=0.0.9"
8+
"langgraph>=0.5.4",
9+
"langchain-mcp-adapters>=0.1.9"
1010
]
1111
requires-python = ">=3.11"

samples/github-slack-agent/uv.lock

Lines changed: 686 additions & 368 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/mcp-functions-agent/builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from langgraph.prebuilt import create_react_agent
99
from langgraph.prebuilt.chat_agent_executor import AgentState
1010
from mcp import ClientSession
11-
from mcp.client.sse import sse_client
11+
from mcp.client.streamable_http import streamablehttp_client
1212
from pydantic import BaseModel
1313
from uipath_langchain.chat.models import UiPathAzureChatOpenAI
1414

@@ -51,11 +51,11 @@ class GraphState(AgentState):
5151

5252
@asynccontextmanager
5353
async def make_graph():
54-
async with sse_client(
54+
async with streamablehttp_client(
5555
url=FUNCTIONS_MCP_SERVER_URL,
5656
headers={"Authorization": f"Bearer {UIPATH_ACCESS_TOKEN}"},
5757
timeout=60,
58-
) as (read, write):
58+
) as (read, write, session_id_callback):
5959
async with ClientSession(read, write) as session:
6060
await session.initialize()
6161
tools = await load_mcp_tools(session)

samples/mcp-functions-agent/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "A coder agent that implements and tests Python functions using a
55
authors = [{ name = "Cristi Pufu", email = "[email protected]" }]
66
dependencies = [
77
"uipath-langchain>=0.0.118",
8-
"langgraph>=0.3.34",
9-
"langchain-mcp-adapters>=0.0.9"
8+
"langgraph>=0.5.4",
9+
"langchain-mcp-adapters>=0.1.9"
1010
]
1111
requires-python = ">=3.11"

samples/mcp-functions-agent/uv.lock

Lines changed: 236 additions & 369 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)