Skip to content

Commit 57d016d

Browse files
committed
chore: include hitl flag for generic agent
1 parent fd9b843 commit 57d016d

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"query": "What is the company policy on travel spending? What is the price of GPUs in 2025? What is 5+6+7+8+(6*10)?",
3-
"add_data_to_index": false
3+
"add_data_to_index": false,
4+
"include_hitl": false
45
}

samples/generic-rag-agent/main.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
class CustomStartEvent(StartEvent):
4848
query: str = ""
4949
add_data_to_index: Optional[bool] = False
50+
include_hitl: bool = False
5051

5152

5253
class QueryEvent(Event):
@@ -165,6 +166,7 @@ async def workflow_entrypoint(
165166
await ctx.store.set("original_query", ev.query)
166167
await ctx.store.set("iteration_count", 0)
167168
await ctx.store.set("feedback_history", [])
169+
await ctx.store.set("include_hitl", ev.include_hitl)
168170

169171
if ev.add_data_to_index:
170172
return AddDataToIndexEvent()
@@ -396,8 +398,17 @@ async def request_human_confirmation(
396398
) -> OutputEvent | QueryEvent:
397399
"""
398400
Present the formatted answer to the user and request confirmation.
401+
If include_hitl is False, skip human confirmation and return the output directly.
399402
"""
400-
await ctx.store.set("last_formatted_answer", ev.formatted_answer)
403+
include_hitl = await ctx.store.get("include_hitl", False)
404+
405+
if not include_hitl:
406+
print("\n" + "="*80)
407+
print("FORMATTED ANSWER (HITL disabled):")
408+
print("="*80)
409+
print(ev.formatted_answer)
410+
print("="*80)
411+
return OutputEvent(output=ev.formatted_answer)
401412

402413
print("\n" + "="*80)
403414
print("FORMATTED ANSWER:")

samples/generic-rag-agent/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "generic-rag-agent"
3-
version = "0.0.29"
3+
version = "0.0.30"
44
description = "A generic RAG agent that combines multiple knowledge bases with web search capabilities and MCP tool support"
55
authors = [{ name = "John Doe", email = "john.doe@myemail.com" }]
66
readme = { file = "README.md", content-type = "text/markdown" }

samples/generic-rag-agent/uipath.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"entryPoints": [
33
{
44
"filePath": "agent",
5-
"uniqueId": "e321d542-02cc-47d8-9e28-88b4b638c4d0",
5+
"uniqueId": "de56dd1d-85cc-4b3d-b794-e8ddccae291a",
66
"type": "agent",
77
"input": {
88
"type": "object",
@@ -15,6 +15,11 @@
1515
"add_data_to_index": {
1616
"type": "boolean",
1717
"nullable": true
18+
},
19+
"include_hitl": {
20+
"default": false,
21+
"title": "Include Hitl",
22+
"type": "boolean"
1823
}
1924
},
2025
"required": []

samples/generic-rag-agent/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)