Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/uipath-agent-framework/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-agent-framework"
version = "0.0.2"
version = "0.0.3"
description = "Python SDK that enables developers to build and deploy Microsoft Agent Framework agents to the UiPath Cloud Platform"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
3 changes: 3 additions & 0 deletions packages/uipath-agent-framework/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ Sample agents built with [Agent Framework](https://github.com/microsoft/agent-fr
|--------|-------------|
| [quickstart-agent](./quickstart-agent/) | Single agent with tool calling: fetches live weather data for any location |
| [multi-agent](./multi-agent/) | Multi-agent coordinator: delegates research and code execution to specialist sub-agents via `as_tool()` |
| [group-chat](./group-chat/) | Group chat orchestration: researcher, critic, and writer discuss a topic with an orchestrator picking speakers |
| [concurrent](./concurrent/) | Concurrent orchestration: sentiment, topic extraction, and summarization agents analyze text in parallel |
| [handoff](./handoff/) | Handoff orchestration: customer support agents transfer control to specialists with explicit routing rules |
33 changes: 33 additions & 0 deletions packages/uipath-agent-framework/samples/concurrent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Concurrent

Three specialist agents analyze the same input text in parallel: sentiment analysis, topic extraction, and summarization. Results are aggregated automatically.

## Agent Graph

```mermaid
flowchart TB
__start__(__start__)
concurrent_analysis(concurrent_analysis)
__end__(__end__)
__start__ --> |input|concurrent_analysis
concurrent_analysis --> |output|__end__
```

Internally, the concurrent orchestration fans out to:
- **sentiment** — analyzes positive/negative/neutral sentiment
- **topic_extractor** — identifies topics, entities, and themes
- **summarizer** — writes a concise summary

All three run simultaneously, results are collected and returned together.

## Run

```
uipath run agent '{"messages": [{"contentParts": [{"data": {"inline": "Apple announced a new Vision Pro headset today, priced at $3,499. The mixed-reality device features a custom M4 chip and will be available in 10 countries. Analysts are divided on whether the high price point will limit adoption."}}], "role": "user"}]}'
```

## Debug

```
uipath dev web
```
16 changes: 16 additions & 0 deletions packages/uipath-agent-framework/samples/concurrent/agent.mermaid
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
flowchart TB
__start__(__start__)
__end__(__end__)
dispatcher(dispatcher)
sentiment(sentiment)
topic_extractor(topic_extractor)
summarizer(summarizer)
aggregator(aggregator)
__start__ --> |input|dispatcher
dispatcher --> sentiment
dispatcher --> topic_extractor
dispatcher --> summarizer
sentiment --> aggregator
topic_extractor --> aggregator
summarizer --> aggregator
aggregator --> |output|__end__
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"agents": {
"agent": "main.py:agent"
}
}
40 changes: 40 additions & 0 deletions packages/uipath-agent-framework/samples/concurrent/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from agent_framework.orchestrations import ConcurrentBuilder

from uipath_agent_framework.chat import UiPathOpenAIChatClient

client = UiPathOpenAIChatClient(model="gpt-5-mini-2025-08-07")

sentiment_agent = client.as_agent(
name="sentiment",
description="Analyzes text sentiment.",
instructions=(
"You are a sentiment analyst. Analyze the sentiment of the given text. "
"Return a short assessment: positive/negative/neutral with a confidence "
"percentage and a one-sentence explanation."
),
)

topic_agent = client.as_agent(
name="topic_extractor",
description="Extracts main topics and entities from text.",
instructions=(
"You are a topic extraction specialist. Identify the main topics, "
"entities (people, organizations, places), and key themes in the "
"given text. Return a structured list."
),
)

summary_agent = client.as_agent(
name="summarizer",
description="Writes concise summaries.",
instructions=(
"You are a summarization expert. Write a concise one-paragraph "
"summary of the given text, capturing the key points."
),
)

workflow = ConcurrentBuilder(
participants=[sentiment_agent, topic_agent, summary_agent],
).build()

agent = workflow.as_agent(name="concurrent_analysis")
25 changes: 25 additions & 0 deletions packages/uipath-agent-framework/samples/concurrent/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[project]
name = "concurrent"
version = "0.0.1"
description = "Concurrent: multiple agents analyze the same input in parallel"
authors = [{ name = "John Doe" }]
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"uipath",
"uipath-agent-framework",
"agent-framework-core>=1.0.0b260212",
"agent-framework-orchestrations>=1.0.0b260212",
]

[dependency-groups]
dev = [
"uipath-dev",
]

[tool.uv]
prerelease = "allow"

[tool.uv.sources]
uipath-dev = { path = "../../../../../uipath-dev-python", editable = true }
uipath-agent-framework = { path = "../../", editable = true }
14 changes: 14 additions & 0 deletions packages/uipath-agent-framework/samples/concurrent/uipath.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://cloud.uipath.com/draft/2024-12/uipath",
"runtimeOptions": {
"isConversational": true
},
"packOptions": {
"fileExtensionsIncluded": [],
"filesIncluded": [],
"filesExcluded": [],
"directoriesExcluded": [],
"includeUvLock": true
},
"functions": {}
}
32 changes: 32 additions & 0 deletions packages/uipath-agent-framework/samples/group-chat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Group Chat

A group discussion where multiple agents (researcher, critic, writer) take turns in a shared conversation. An orchestrator agent selects who speaks next based on the discussion flow.

## Agent Graph

```mermaid
flowchart TB
__start__(__start__)
group_chat(group_chat)
__end__(__end__)
__start__ --> |input|group_chat
group_chat --> |output|__end__
```

Internally, the group chat orchestration manages:
- **researcher** — finds facts via Wikipedia
- **critic** — challenges claims and asks probing questions
- **writer** — synthesizes the discussion into clear prose
- **orchestrator** — picks the next speaker each round

## Run

```
uipath run agent '{"messages": [{"contentParts": [{"data": {"inline": "What are the environmental impacts of lithium mining?"}}], "role": "user"}]}'
```

## Debug

```
uipath dev web
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"agents": {
"agent": "main.py:agent"
}
}
82 changes: 82 additions & 0 deletions packages/uipath-agent-framework/samples/group-chat/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import httpx
from agent_framework.orchestrations import GroupChatBuilder

from uipath_agent_framework.chat import UiPathOpenAIChatClient


def search_wikipedia(query: str) -> str:
"""Search Wikipedia for a topic and return a summary.

Args:
query: The search query, e.g. "Python programming language"

Returns:
A summary of the Wikipedia article, or an error message.
"""
try:
resp = httpx.get(
"https://en.wikipedia.org/api/rest_v1/page/summary/"
+ query.replace(" ", "_"),
headers={"User-Agent": "UiPathGroupChat/1.0"},
timeout=10,
follow_redirects=True,
)
resp.raise_for_status()
data = resp.json()
return data.get("extract", "No summary available.")
except Exception as e:
return f"Wikipedia search failed for '{query}': {e}"


client = UiPathOpenAIChatClient(model="gpt-5-mini-2025-08-07")

researcher = client.as_agent(
name="researcher",
description="Expert at finding facts and data using Wikipedia.",
instructions=(
"You are a research specialist. Use the search_wikipedia tool "
"to find factual information. Provide concise, well-sourced responses."
),
tools=[search_wikipedia],
)

critic = client.as_agent(
name="critic",
description="Challenges assumptions and evaluates claims critically.",
instructions=(
"You are a critical thinker. Evaluate the claims made by other "
"participants. Point out gaps, biases, or missing context. "
"Ask probing questions to deepen the discussion."
),
)

writer = client.as_agent(
name="writer",
description="Synthesizes group discussion into clear, structured prose.",
instructions=(
"You are a skilled writer. Synthesize the group discussion into "
"a clear, well-organized summary. Incorporate the researcher's "
"facts and address the critic's concerns."
),
)

orchestrator = client.as_agent(
name="orchestrator",
description="Coordinates the group discussion by selecting the next speaker.",
instructions=(
"You coordinate a team of researcher, critic, and writer. "
"Select the next speaker based on the conversation flow:\n"
"- Pick 'researcher' when facts or data are needed.\n"
"- Pick 'critic' to challenge or evaluate claims.\n"
"- Pick 'writer' to synthesize when enough discussion has happened.\n"
"Respond with ONLY the agent name, nothing else."
),
)

workflow = GroupChatBuilder(
participants=[researcher, critic, writer],
orchestrator_agent=orchestrator,
max_rounds=6,
).build()

agent = workflow.as_agent(name="group_chat")
21 changes: 21 additions & 0 deletions packages/uipath-agent-framework/samples/group-chat/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[project]
name = "group-chat"
version = "0.0.1"
description = "Group chat: multiple agents discuss a topic with an orchestrator picking speakers"
authors = [{ name = "John Doe" }]
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"uipath",
"uipath-agent-framework",
"agent-framework-core>=1.0.0b260212",
"agent-framework-orchestrations>=1.0.0b260212",
]

[dependency-groups]
dev = [
"uipath-dev",
]

[tool.uv]
prerelease = "allow"
14 changes: 14 additions & 0 deletions packages/uipath-agent-framework/samples/group-chat/uipath.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://cloud.uipath.com/draft/2024-12/uipath",
"runtimeOptions": {
"isConversational": true
},
"packOptions": {
"fileExtensionsIncluded": [],
"filesIncluded": [],
"filesExcluded": [],
"directoriesExcluded": [],
"includeUvLock": true
},
"functions": {}
}
34 changes: 34 additions & 0 deletions packages/uipath-agent-framework/samples/handoff/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Handoff

A customer support system where agents transfer control to each other based on the customer's needs. The triage agent routes to specialists, and specialists can re-route if needed.

## Agent Graph

```mermaid
flowchart TB
__start__(__start__)
customer_support(customer_support)
__end__(__end__)
__start__ --> |input|customer_support
customer_support --> |output|__end__
```

Internally, the handoff orchestration manages routing between:
- **triage** — first contact, routes to the right specialist
- **billing_agent** — invoices, payments, charges
- **tech_agent** — bugs, errors, technical setup
- **returns_agent** — product returns and refunds

Agents hand off control using auto-generated `handoff_to_<agent>` tools. When an agent hands off, it steps out and the target agent takes over the conversation directly.

## Run

```
uipath run agent '{"messages": [{"contentParts": [{"data": {"inline": "Hi, I was charged twice for my last order"}}], "role": "user"}]}'
```

## Debug

```
uipath dev web
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"agents": {
"agent": "main.py:agent"
}
}
Loading