Spaces:
Sleeping
Sleeping
File size: 5,801 Bytes
c75526e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | # OpenProblems Agent Integration Guide
## Complete Setup Overview
This guide shows how to integrate the **Agent Rules**, **Agent Prompt**, and **Continue.dev Configuration** for optimal spatial transcriptomics AI assistance.
## π Integration Checklist
### 1. **Continue.dev Configuration**
β
**File**: `~/.continue/config.json`
β
**Purpose**: Connects Continue.dev to your MCP server
β
**Key Component**:
```json
"experimental": {
"modelContextProtocolServers": [
{
"name": "openproblems-spatial",
"transport": {
"type": "stdio",
"command": "python",
"args": ["-m", "mcp_server.main"],
"cwd": "/home/obi/SpatialAI_MCP"
}
}
]
}
```
### 2. **Agent Rules**
β
**File**: `docs/AGENT_RULES.md`
β
**Purpose**: Comprehensive guidelines for spatial transcriptomics best practices
β
**Usage**: Continue.dev agent references these rules automatically when integrated
### 3. **Agent Prompt**
β
**File**: `docs/AGENT_PROMPT.md`
β
**Purpose**: Sophisticated agent behavior definition
β
**Integration**: Add to Continue.dev system prompt or rules section
## π§ **Final Continue.dev Configuration**
Update your `~/.continue/config.json` to include the agent prompt:
```json
{
"models": [
{
"title": "Claude 3.5 Sonnet",
"provider": "anthropic",
"model": "claude-3-5-sonnet-20241022",
"apiKey": "your-anthropic-api-key-here"
}
],
"experimental": {
"modelContextProtocolServers": [
{
"name": "openproblems-spatial",
"transport": {
"type": "stdio",
"command": "python",
"args": ["-m", "mcp_server.main"],
"cwd": "/home/obi/SpatialAI_MCP"
}
}
]
},
"systemMessage": "You are an expert computational biology assistant specializing in spatial transcriptomics analysis using the OpenProblems framework. You have access to a comprehensive Model Context Protocol (MCP) server with 11 specialized tools and 5 curated knowledge resources. Always start interactions by checking the environment using check_environment tool, then assess project structure with list_directory. Follow the systematic workflow guidelines in AGENT_RULES.md for optimal results.",
"docs": [
{
"title": "Nextflow Documentation",
"startUrl": "https://www.nextflow.io/docs/latest/"
},
{
"title": "Viash Documentation",
"startUrl": "https://viash.io/docs/"
},
{
"title": "OpenProblems GitHub",
"startUrl": "https://github.com/openproblems-bio/openproblems-v2"
},
{
"title": "Spatial Transcriptomics Task",
"startUrl": "https://github.com/openproblems-bio/task_spatial_decomposition"
}
]
}
```
## π **Testing Your Complete Setup**
### Step 1: Verify MCP Server
```bash
cd /home/obi/SpatialAI_MCP
python -m mcp_server.main
# Should start without errors
```
### Step 2: Test Continue.dev Integration
1. **Restart VS Code** after updating config
2. **Open Continue.dev** (Cmd/Ctrl + L)
3. **Test Query**: "Check my spatial transcriptomics environment and help me create a quality control pipeline"
### Step 3: Expected Agent Behavior
The agent should:
- β
Use `check_environment` tool first
- β
Use `list_directory` to assess project structure
- β
Reference OpenProblems best practices
- β
Generate Viash-compatible components
- β
Create Nextflow DSL2 pipelines
- β
Follow all rules from AGENT_RULES.md
## π― **Expected Interaction Flow**
```mermaid
graph TD
A["π©βπ» User Query<br/>'Help with spatial QC'"] --> B["π€ Agent Assessment<br/>check_environment tool"]
B --> C["π Project Analysis<br/>list_directory tool"]
C --> D["π Rules Reference<br/>AGENT_RULES.md guidelines"]
D --> E["π οΈ Solution Creation<br/>write_file + validate tools"]
E --> F["β
Quality Validation<br/>test and verify output"]
F --> G["π Comprehensive Response<br/>Code + Documentation + Next Steps"]
```
## π **Example Successful Interaction**
**User**: "I need help setting up spatial transcriptomics quality control"
**Agent Response**:
```
I'll help you set up comprehensive spatial transcriptomics quality control. Let me first assess your environment and project structure.
[Uses check_environment tool]
β
Docker: Available (v28.1.1)
β Nextflow: Not found
β Viash: Not found
[Uses list_directory tool]
Found spatial data in: data/spatial_samples/
Existing configs: config/
Based on the OpenProblems best practices, I'll:
1. Install missing dependencies
2. Create a modular QC pipeline
3. Generate Viash components
4. Set up comprehensive testing
[Creates optimized pipeline with proper error handling and documentation]
```
## π **Troubleshooting**
### Issue: MCP Tools Not Available
**Solution**: Check Continue.dev logs in VS Code Developer Tools
```bash
# Verify MCP server manually
python -m mcp_server.main
openproblems-mcp info
```
### Issue: Agent Not Following Rules
**Solution**: Ensure systemMessage includes rules reference
```json
"systemMessage": "...Follow the systematic workflow guidelines in AGENT_RULES.md..."
```
### Issue: Spatial Analysis Errors
**Solution**: Agent should use validate_nextflow_config tool
```
The agent will automatically validate pipelines using our MCP tools before providing solutions.
```
## π **Success Indicators**
Your integration is successful when:
- [ ] Agent proactively uses MCP tools (check_environment, list_directory)
- [ ] Generated code follows OpenProblems conventions
- [ ] Pipelines are properly validated before delivery
- [ ] Documentation includes troubleshooting and next steps
- [ ] Solutions are tested and reproducible
**π You now have a complete AI-powered spatial transcriptomics development environment!**
|