This project demonstrates how to create a Python-based UiPath Coded Agent that connects to UiPath Orchestrator and manages queue items with multiple interaction patterns.
The agent uses the UiPath Python SDK to:
- Connect to UiPath Orchestrator
- Add queue items using multiple methods (single, bulk, dictionary, with dates)
- List and view queue items
- Return detailed operation results
- UV package manager installed
- UiPath Orchestrator access with appropriate credentials
- At least one queue configured in your Orchestrator instance
uv venvActivate the virtual environment:
- Windows:
.venv\Scripts\activate - Linux/Mac:
source .venv/bin/activate
uv syncuv run uipath initThe agent supports multiple operations. Format your input.json file based on the operation:
{
"operation": "add_single",
"queue_name": "TestQueue",
"items": [
{
"reference": "ITEM-001",
"priority": "Normal",
"specific_content": {
"customer_id": "CUST-001",
"order_number": "ORD-2024-001"
}
}
]
}{
"operation": "add_bulk",
"queue_name": "TestQueue",
"items": [
{
"reference": "ITEM-001",
"priority": "High",
"specific_content": {"data": "item1"}
},
{
"reference": "ITEM-002",
"priority": "Low",
"specific_content": {"data": "item2"}
}
]
}{
"operation": "add_dict",
"queue_name": "TestQueue",
"items": [
{
"reference": "ITEM-DICT-001",
"priority": "High",
"specific_content": {
"transaction_type": "payment"
}
}
]
}{
"operation": "add_with_dates",
"queue_name": "TestQueue",
"items": [
{
"reference": "TIME-SENSITIVE-001",
"priority": "High",
"specific_content": {"task": "urgent"},
"defer_date": "2026-02-13 12:00:00.000",
"due_date": "2026-02-14 11:00:00.000"
}
]
}{
"operation": "list",
"queue_name": "TestQueue"
}Input Parameters:
operation(required): Operation to performadd_single: Add a single queue item using QueueItem objectadd_dict: Add a single queue item using dictionary methodadd_bulk: Add multiple queue items in one operationadd_with_dates: Add item with defer/due date constraintslist: List all queue items
queue_name(required): The name of the UiPath queueitems(optional): Array of queue items (required for add operations)reference(optional): Unique reference identifierpriority(optional): Priority level (Low, Normal, High)specific_content(optional): Custom data payloaddefer_date(optional): Earliest processing date in UTC formatdue_date(optional): Latest processing date in UTC format
Execute the agent locally:
uipath run main --input-file input.jsonWhen this agent runs, it will:
- Load input values (
operation,queue_name, and optionallyitems) - Connect to UiPath Orchestrator
- Execute the specified operation:
- add_single: Creates a single queue item using QueueItem object
- add_dict: Creates a single queue item using dictionary method
- add_bulk: Creates multiple queue items in bulk with independent processing
- add_with_dates: Creates a time-sensitive queue item with defer/due dates
- list: Retrieves and displays queue items (up to 10 shown)
- Return a detailed message with the operation results
Sample Outputs:
# add_single
Successfully added item 'ITEM-001' (ID: 12345) to queue 'TestQueue'
# add_bulk
Bulk operation: 3 item(s) added successfully, 0 failed in queue 'TestQueue'
# add_with_dates
Successfully added time-sensitive item (ID: 12346) with defer date: 2026-02-13T12:00:00Z
# list
Found 5 queue item(s):
ID: 12345 | Status: New | Priority: Low | Ref: ITEM-001
ID: 12346 | Status: New | Priority: High | Ref: ITEM-002
...
Each queue item supports the following properties:
| Property | Type | Required | Description |
|---|---|---|---|
reference |
str | No | Optional unique identifier (max 128 chars) |
priority |
str | No | Low, Normal, or High (default: None) |
specific_content |
dict | No | Custom data payload for the work item |
defer_date |
str | No | Earliest processing date (UTC format: "YYYY-MM-DD HH:MM:SS.mmm") |
due_date |
str | No | Latest processing date (UTC format: "YYYY-MM-DD HH:MM:SS.mmm") |
Adds a single queue item using the QueueItem class. This is the standard method for adding items with full type safety.
Adds a single queue item using a dictionary. Alternative approach that demonstrates dictionary-based item creation.
Adds multiple queue items in a single operation using CommitType.PROCESS_ALL_INDEPENDENTLY. Each item is processed independently, and the operation reports success/failure counts.
Adds a queue item with defer and due date constraints. Useful for time-sensitive processing where items should not be processed before a certain time or must be completed by a deadline.
Lists all queue items from the queue. Returns up to 10 items with their ID, Status, Priority, and Reference. Indicates if more items exist beyond the displayed limit.
Once tested locally, publish your agent to Orchestrator:
-
Pack the agent:
uipath pack
-
Publish to Orchestrator:
uipath publish