Skip to content
Open
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 pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-langchain"
version = "0.10.20"
version = "0.10.21"
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
85 changes: 49 additions & 36 deletions src/uipath_langchain/_cli/cli_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ def generate_agent_md_file(
target_directory: The directory where the file should be created.
file_name: The name of the file should be created.
resource_name: The name of the resource folder where should be the file.
no_agents_md_override: Whether to override existing files.
no_agents_md_override: When True, do not overwrite an existing file.

Returns:
A tuple of (file_name, status) where status is a FileOperationStatus:
- CREATED: File was created
- UPDATED: File was overwritten
- SKIPPED: File exists and no_agents_md_override is True
Returns None if an error occurred.
A tuple of (file_name, status) where status is a FileOperationStatus,
or None if an error occurred.
"""
target_path = os.path.join(target_directory, file_name)
will_override = os.path.exists(target_path)
Expand All @@ -68,54 +65,70 @@ def generate_agent_md_file(


def generate_specific_agents_md_files(
target_directory: str, no_agents_md_override: bool
target_directory: str,
no_agents_md_override: bool,
with_offline_docs: bool = False,
) -> Generator[tuple[str, FileOperationStatus], None, None]:
"""Generate agent-specific files from the packaged resource.
"""Generate AGENTS.md (and a CLAUDE.md shim), optionally bundling the offline docs.

Args:
target_directory: The directory where the files should be created.
no_agents_md_override: Whether to override existing files.
no_agents_md_override: When True, do not overwrite existing AGENTS.md/CLAUDE.md.
with_offline_docs: When True, copy llms-full.txt to .uipath/ as an offline fallback.

Yields:
Tuple of (file_name, status) for each file operation, where status is a FileOperationStatus:
- CREATED: File was created
- UPDATED: File was overwritten
- SKIPPED: File exists and was not overwritten
Tuple of (file_name, status) for each file operation.
"""
agent_dir = os.path.join(target_directory, ".agent")
os.makedirs(agent_dir, exist_ok=True)

file_configs = [
(target_directory, "CLAUDE.md", "uipath._resources"),
(agent_dir, "CLI_REFERENCE.md", "uipath._resources"),
(agent_dir, "SDK_REFERENCE.md", "uipath._resources"),
(target_directory, "AGENTS.md", "uipath_langchain._resources"),
(agent_dir, "REQUIRED_STRUCTURE.md", "uipath_langchain._resources"),
]

for directory, file_name, resource_name in file_configs:
result = generate_agent_md_file(
directory, file_name, resource_name, no_agents_md_override
)
if result:
yield result
result = generate_agent_md_file(
target_directory,
"AGENTS.md",
"uipath_langchain._resources",
no_agents_md_override,
)
if result:
yield result

claude_result = generate_agent_md_file(
target_directory,
"CLAUDE.md",
"uipath_langchain._resources",
no_agents_md_override,
)
if claude_result:
yield claude_result

if with_offline_docs:
uipath_dir = os.path.join(target_directory, ".uipath")
os.makedirs(uipath_dir, exist_ok=True)
try:
source = importlib.resources.files("uipath._resources").joinpath(
"llms-full.txt"
)
with importlib.resources.as_file(source) as s_path:
shutil.copy(s_path, os.path.join(uipath_dir, "llms-full.txt"))
except (FileNotFoundError, ModuleNotFoundError):
pass
else:
agents_path = os.path.join(target_directory, "AGENTS.md")
with open(agents_path, "a", encoding="utf-8") as f:
f.write(
"\n3. If neither of the above is reachable, read "
"`.uipath/llms-full.txt` (offline fallback bundled with this project).\n"
)


def generate_agents_md_files(options: dict[str, Any]) -> None:
"""Generate agent MD files and log categorized summary.

Args:
options: Options dictionary
"""
"""Generate AGENTS.md and log a summary."""
current_directory = os.getcwd()
no_agents_md_override = options.get("no_agents_md_override", False)
with_offline_docs = options.get("with_offline_docs", False)

created_files = []
updated_files = []
skipped_files = []

for file_name, status in generate_specific_agents_md_files(
current_directory, no_agents_md_override
current_directory, no_agents_md_override, with_offline_docs
):
if status == FileOperationStatus.CREATED:
created_files.append(file_name)
Expand Down
24 changes: 6 additions & 18 deletions src/uipath_langchain/_resources/AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
# Agent Code Patterns Reference
# UiPath LangGraph Project

This document provides practical code patterns for building UiPath coded agents using LangGraph and the UiPath Python SDK.
For SDK and CLI knowledge, follow this order:

---
1. Run `uip skills install` (install the CLI first if needed: `npm install -g @uipath/cli`).
Recommended skills: `uipath-agents`, `uipath-platform`.

## Documentation Structure

This documentation is split into multiple files for efficient context loading. Load only the files you need:

1. **@.agent/REQUIRED_STRUCTURE.md** - Agent structure patterns and templates
- **When to load:** Creating a new agent or understanding required patterns
- **Contains:** Required Pydantic models (Input, State, Output), LLM initialization patterns, standard agent template

2. **@.agent/SDK_REFERENCE.md** - Complete SDK API reference
- **When to load:** Calling UiPath SDK methods, working with services (actions, assets, jobs, etc.)
- **Contains:** All SDK services and methods with full signatures and type annotations

3. **@.agent/CLI_REFERENCE.md** - CLI commands documentation
- **When to load:** Working with `uipath init`, `uipath run`, or `uipath eval` commands
- **Contains:** Command syntax, options, usage examples, and workflows
2. If `uip` is unavailable, fetch `https://uipath.github.io/uipath-python/llms.txt`
and follow the linked sections on demand.
1 change: 1 addition & 0 deletions src/uipath_langchain/_resources/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
92 changes: 0 additions & 92 deletions src/uipath_langchain/_resources/REQUIRED_STRUCTURE.md

This file was deleted.

Loading
Loading