Skip to content

Commit 62ccecb

Browse files
committed
feat: Fix agent swarm workflow and prompt management - Fix router 'Unnamed' subnode by using named method instead of lambda - Update test_generator to produce actual test code files (not just plans) - Add supervisor prompts loading (9 prompts total: 3 supervisor + 6 specialist) - Set temperature to 0.0 for deterministic output - Fix code_generator JSON parsing for structured output - Fix prompt naming consistency (underscores not hyphens) - Update prompt caching to use correct LangSmith names - Create push_prompts_to_langsmith.py automation script - Update test_generator_v1 prompt in LangSmith Hub with test_files requirement
1 parent df96a19 commit 62ccecb

File tree

62 files changed

+7296
-2426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+7296
-2426
lines changed

.cursor/rules/core/development_excellence.mdc

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,187 @@ elif existing_system_type == "utility_system":
110110
add_utility_function(existing_util_path, new_function)
111111
```
112112

113+
## 0.5. Documentation-First API Integration (CRITICAL FOUNDATION)
114+
115+
### **READ DOCUMENTATION BEFORE IMPLEMENTATION - MANDATORY**
116+
117+
```python
118+
# FORBIDDEN: Implementing API integration without reading documentation
119+
from langchain import some_module # WRONG - guessing at API usage
120+
result = some_module.do_something() # WRONG - assuming how it works
121+
122+
# REQUIRED: Documentation-first approach
123+
# Step 1: Read official API documentation
124+
# Step 2: Understand correct usage patterns
125+
# Step 3: Implement using documented methods
126+
from langsmith import Client
127+
128+
# Correct usage based on official documentation
129+
client = Client(api_key=api_key)
130+
prompt = client.pull_prompt("prompt_name", include_model=True) # Documented method
131+
```
132+
133+
### **Mandatory Documentation Review Process**
134+
135+
Before implementing ANY integration with special libraries:
136+
137+
1. **MANDATORY: Read Official Documentation**
138+
- LangChain: https://python.langchain.com/docs/
139+
- LangGraph: https://langchain-ai.github.io/langgraph/
140+
- LangSmith: https://docs.smith.langchain.com/
141+
- Any other special library: Find and read official docs
142+
143+
2. **MANDATORY: Understand API Contracts**
144+
- Read method signatures
145+
- Understand parameters and return types
146+
- Review code examples
147+
- Check version compatibility
148+
149+
3. **MANDATORY: Use Documented Patterns**
150+
- Follow official examples
151+
- Use documented method names
152+
- Respect parameter conventions
153+
- Handle errors as documented
154+
155+
4. **FORBIDDEN: Guessing or Assuming**
156+
- Don't guess at method names
157+
- Don't assume API behavior
158+
- Don't use deprecated patterns
159+
- Don't ignore version differences
160+
161+
### **Special Library Integration Standards**
162+
163+
```python
164+
# REQUIRED: Documentation-first integration pattern
165+
166+
class DocumentedAPIIntegration:
167+
"""Integration following official documentation."""
168+
169+
def __init__(self):
170+
# Step 1: Read docs for initialization
171+
# Documentation: https://docs.library.com/client
172+
self.client = ProperClientClass(
173+
param1="value", # As documented
174+
param2="value" # As documented
175+
)
176+
177+
def use_api_method(self):
178+
"""Use API method exactly as documented."""
179+
# Step 2: Read docs for method usage
180+
# Documentation: https://docs.library.com/methods
181+
182+
try:
183+
# Use documented method with documented parameters
184+
result = self.client.documented_method(
185+
required_param="value",
186+
optional_param="value"
187+
)
188+
189+
# Handle result as documented
190+
return self._process_documented_result(result)
191+
192+
except DocumentedException as e:
193+
# Handle errors as documented
194+
self._handle_documented_error(e)
195+
196+
# FORBIDDEN: Undocumented usage
197+
class UndocumentedIntegration:
198+
def __init__(self):
199+
# WRONG - guessing at initialization
200+
self.client = GuessedClass() # Not in docs
201+
202+
def use_api_method(self):
203+
# WRONG - guessing at method names
204+
result = self.client.maybe_this_works() # Not documented
205+
return result # Hope it works!
206+
```
207+
208+
### **Documentation Sources Priority**
209+
210+
**Priority Order** (check in this order):
211+
212+
1. **Official Documentation** (highest priority)
213+
- Main docs site
214+
- API reference
215+
- Official examples
216+
217+
2. **Release Notes / Changelog**
218+
- Breaking changes
219+
- Deprecated methods
220+
- New features
221+
222+
3. **Official GitHub Repository**
223+
- Source code (if needed)
224+
- Issue tracker
225+
- Official examples directory
226+
227+
4. **Community Resources** (lowest priority, verify against official docs)
228+
- Stack Overflow
229+
- Blog posts
230+
- Third-party tutorials
231+
232+
### **Version Compatibility Checks**
233+
234+
```python
235+
# REQUIRED: Check and document version compatibility
236+
237+
# Document versions at top of file
238+
"""
239+
Integration with LangChain/LangSmith
240+
241+
Dependencies:
242+
- langchain==0.1.0 (or compatible)
243+
- langsmith==0.1.0 (or compatible)
244+
- langgraph==0.1.0 (or compatible)
245+
246+
Documentation references:
247+
- https://docs.smith.langchain.com/reference/python-client
248+
- https://python.langchain.com/docs/get_started/introduction
249+
"""
250+
251+
import importlib.metadata
252+
253+
def check_version_compatibility():
254+
"""Verify library versions match documentation."""
255+
required_versions = {
256+
'langchain': '>=0.1.0',
257+
'langsmith': '>=0.1.0',
258+
'langgraph': '>=0.1.0'
259+
}
260+
261+
for package, version_req in required_versions.items():
262+
try:
263+
installed = importlib.metadata.version(package)
264+
logger.info(f"{package} version: {installed}")
265+
except importlib.metadata.PackageNotFoundError:
266+
logger.error(f"{package} not installed!")
267+
```
268+
269+
### **Integration Testing with Documentation**
270+
271+
```python
272+
# REQUIRED: Test against documented behavior
273+
274+
def test_langsmith_integration():
275+
"""Test LangSmith integration using documented API."""
276+
277+
# Based on: https://docs.smith.langchain.com/reference/python-client
278+
from langsmith import Client
279+
280+
# Test documented initialization
281+
client = Client(api_key="test-key")
282+
assert client is not None
283+
284+
# Test documented method
285+
# Documentation states: client.pull_prompt(prompt_name, include_model=True)
286+
try:
287+
prompt = client.pull_prompt("test_prompt", include_model=True)
288+
# Success - API used correctly
289+
except Exception as e:
290+
# Handle as documented
291+
logger.error(f"Failed as documented: {e}")
292+
```
293+
113294
## 1. Data Integrity and Authenticity
114295

115296
### **NO FAKE VALUES - CRITICAL PRINCIPLE**

apps/main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@ def __init__(self, config: SystemConfig):
5252
self.file_manager = FileManager(config.storage)
5353
self.agents = self._initialize_agents()
5454

55-
# Initialize LangGraph workflow manager with agents and logging
55+
# Initialize LangGraph workflow manager
5656
llm_config = {
57-
"api_key": self.config.gemini.api_key,
5857
"model_name": self.config.gemini.model_name,
5958
"temperature": self.config.gemini.temperature,
6059
"max_tokens": self.config.gemini.max_tokens
6160
}
62-
self.workflow_manager = LangGraphWorkflowManager(llm_config, self.agents, self.logging_manager)
61+
# Set GEMINI_API_KEY in environment for ChatGoogleGenerativeAI
62+
os.environ["GEMINI_API_KEY"] = self.config.gemini.api_key
63+
self.workflow_manager = LangGraphWorkflowManager(llm_config)
6364

6465
self.logger.info("AI Development Agent system initialized successfully")
6566

context/context_engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
try:
2222
from qdrant_client import QdrantClient
2323
from qdrant_client.models import Distance, VectorParams, SparseVectorParams
24-
from langchain.schema import Document
25-
from langchain.text_splitter import RecursiveCharacterTextSplitter
24+
from langchain_core.documents import Document
25+
from langchain_text_splitters import RecursiveCharacterTextSplitter
2626

2727
# Try new QdrantVectorStore (langchain-qdrant >= 0.1.0)
2828
QDRANT_NEW_API = False

docs/agile/catalogs/EPIC_OVERVIEW.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090
| **Phase 4** | Optimization & Learning | 26 | 📋 Planned | 9-10 sprints |
9191
| **Total** | **4 phases** | **104 points** | **0% Complete** | **8-10 sprints** |
9292

93-
**Planned User Stories**:
93+
**User Stories**:
94+
- 🔄 US-SWARM-002: Build LangGraph Agent Swarm with Coordinated Specialist Agents (13 points) **IN PROGRESS**
9495
- 📋 US-AGENT-REQ-001: Requirements Analysis Agent (13 points)
9596
- 📋 US-AGENT-ARCH-001: Architecture Design Agent (13 points)
9697
- 📋 US-AGENT-CODE-001: Code Generation Engine (13 points)

0 commit comments

Comments
 (0)