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.8.4"
version = "0.8.5"
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
10 changes: 2 additions & 8 deletions src/uipath_langchain/_cli/cli_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ def generate_agent_md_file(
def generate_specific_agents_md_files(
target_directory: str, no_agents_md_override: bool
) -> Generator[tuple[str, FileOperationStatus], None, None]:
"""Generate agent-specific files from the packaged resource.
"""Generate CLAUDE.md file from the packaged resource.

Args:
target_directory: The directory where the files should be created.
target_directory: The directory where the file should be created.
no_agents_md_override: Whether to override existing files.

Yields:
Expand All @@ -82,15 +82,9 @@ def generate_specific_agents_md_files(
- UPDATED: File was overwritten
- SKIPPED: File exists and was not overwritten
"""
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:
Expand Down
18 changes: 1 addition & 17 deletions src/uipath_langchain/_resources/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,4 @@

This document provides practical code patterns for building UiPath coded agents using LangGraph and the UiPath Python SDK.

---

## 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
Run with: `uipath run main '{...}'`
92 changes: 0 additions & 92 deletions src/uipath_langchain/_resources/REQUIRED_STRUCTURE.md

This file was deleted.

94 changes: 19 additions & 75 deletions tests/cli/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestGenerateAgentMdFile:
"""Tests for the generate_agent_md_file function."""

def test_generate_file_success(self):
"""Test successfully generating an agent MD file."""
"""Test successfully generating AGENTS.md file."""
with tempfile.TemporaryDirectory() as temp_dir:
result = generate_agent_md_file(
temp_dir, "AGENTS.md", "uipath_langchain._resources", False
Expand All @@ -27,7 +27,7 @@ def test_generate_file_success(self):
with open(target_path, "r") as f:
content = f.read()
assert len(content) > 0
assert "Agent Code Patterns Reference" in content
assert "LangGraph" in content

def test_file_already_exists(self):
"""Test that an existing file is overwritten."""
Expand All @@ -49,26 +49,7 @@ def test_file_already_exists(self):
content = f.read()

assert content != original_content
assert "Agent Code Patterns Reference" in content

def test_generate_required_structure_file(self):
"""Test generating REQUIRED_STRUCTURE.md file."""
with tempfile.TemporaryDirectory() as temp_dir:
agent_dir = os.path.join(temp_dir, ".agent")
os.makedirs(agent_dir, exist_ok=True)
result = generate_agent_md_file(
agent_dir, "REQUIRED_STRUCTURE.md", "uipath_langchain._resources", False
)
assert result is not None
file_name, status = result
assert file_name == "REQUIRED_STRUCTURE.md"
assert status == FileOperationStatus.CREATED

target_path = os.path.join(agent_dir, "REQUIRED_STRUCTURE.md")
assert os.path.exists(target_path)
with open(target_path, "r") as f:
content = f.read()
assert "Required Agent Structure" in content
assert "LangGraph" in content

def test_file_skipped_when_no_override(self):
"""Test that an existing file is skipped when no_agents_md_override is True."""
Expand All @@ -95,54 +76,33 @@ def test_file_skipped_when_no_override(self):
class TestGenerateSpecificAgentsMdFiles:
"""Tests for the generate_specific_agents_md_files function."""

def test_generate_all_files(self):
"""Test that all agent documentation files are generated."""
def test_generate_agents_and_claude_md(self):
"""Test that AGENTS.md and CLAUDE.md are generated (without .agent/ sub-docs)."""
with tempfile.TemporaryDirectory() as temp_dir:
results = list(generate_specific_agents_md_files(temp_dir, False))

# Check that we got results for all files
assert len(results) == 5
# Check that we got results for AGENTS.md and CLAUDE.md
assert len(results) == 2
file_names = [name for name, _ in results]
assert "AGENTS.md" in file_names
assert "REQUIRED_STRUCTURE.md" in file_names
assert "CLAUDE.md" in file_names
assert "CLI_REFERENCE.md" in file_names
assert "SDK_REFERENCE.md" in file_names

# Check all were created (not updated or skipped)
# Should NOT create .agent directory
assert not os.path.exists(os.path.join(temp_dir, ".agent"))

# Check files were created (not updated or skipped)
for _, status in results:
assert status == FileOperationStatus.CREATED

agent_dir = os.path.join(temp_dir, ".agent")
assert os.path.exists(agent_dir)
assert os.path.isdir(agent_dir)

agents_md_path = os.path.join(temp_dir, "AGENTS.md")
assert os.path.exists(agents_md_path)

required_structure_path = os.path.join(agent_dir, "REQUIRED_STRUCTURE.md")
assert os.path.exists(required_structure_path)

with open(agents_md_path, "r") as f:
agents_content = f.read()
assert "Agent Code Patterns Reference" in agents_content

with open(required_structure_path, "r") as f:
required_content = f.read()
assert "Required Agent Structure" in required_content

def test_agent_dir_already_exists(self):
"""Test that the existing .agent directory doesn't cause errors."""
with tempfile.TemporaryDirectory() as temp_dir:
agent_dir = os.path.join(temp_dir, ".agent")
os.makedirs(agent_dir, exist_ok=True)

results = list(generate_specific_agents_md_files(temp_dir, False))
assert len(results) == 5
assert os.path.exists(agent_dir)
assert "LangGraph" in agents_content

def test_files_overwritten(self):
"""Test that existing files are overwritten."""
"""Test that existing AGENTS.md is overwritten."""
with tempfile.TemporaryDirectory() as temp_dir:
agents_md_path = os.path.join(temp_dir, "AGENTS.md")
original_content = "Custom documentation"
Expand All @@ -151,7 +111,7 @@ def test_files_overwritten(self):

results = list(generate_specific_agents_md_files(temp_dir, False))

# Check that AGENTS.md was updated, others were created
# Check that AGENTS.md was updated
agents_result = [r for r in results if r[0] == "AGENTS.md"]
assert len(agents_result) == 1
_, status = agents_result[0]
Expand All @@ -161,42 +121,26 @@ def test_files_overwritten(self):
content = f.read()

assert content != original_content
assert "Agent Code Patterns Reference" in content
assert "LangGraph" in content

def test_files_skipped_when_no_override(self):
"""Test that existing files are skipped when no_agents_md_override is True."""
"""Test that existing AGENTS.md is skipped when no_agents_md_override is True."""
with tempfile.TemporaryDirectory() as temp_dir:
# Create some existing files
# Create existing AGENTS.md
agents_md_path = os.path.join(temp_dir, "AGENTS.md")
claude_md_path = os.path.join(temp_dir, "CLAUDE.md")
with open(agents_md_path, "w") as f:
f.write("Existing AGENTS.md")
with open(claude_md_path, "w") as f:
f.write("Existing CLAUDE.md")

results = list(generate_specific_agents_md_files(temp_dir, True))

# Check that existing files were skipped
# Check that existing file was skipped
skipped_files = [
name
for name, status in results
if status == FileOperationStatus.SKIPPED
]
assert "AGENTS.md" in skipped_files
assert "CLAUDE.md" in skipped_files

# Check that non-existing files were created
created_files = [
name
for name, status in results
if status == FileOperationStatus.CREATED
]
assert "CLI_REFERENCE.md" in created_files
assert "SDK_REFERENCE.md" in created_files
assert "REQUIRED_STRUCTURE.md" in created_files

# Verify the existing files were not modified
# Verify the existing file was not modified
with open(agents_md_path, "r") as f:
assert f.read() == "Existing AGENTS.md"
with open(claude_md_path, "r") as f:
assert f.read() == "Existing CLAUDE.md"
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.