Create this exact folder structure:
biomni_plugin/
βββ manifest.yaml # Plugin manifest
βββ main.py # Entry point
βββ requirements.txt # Dependencies
βββ .env.example # Environment template
βββ _assets/
β βββ biomni_icon.png # Plugin icon (add your icon here)
βββ provider/
β βββ __init__.py # Empty file
β βββ biomni.yaml # Provider config
β βββ biomni.py # Provider implementation
βββ tools/
βββ __init__.py # Empty file
βββ biomni_agent.yaml # Tool config
βββ biomni_agent.py # Tool implementation
Ensure metadata is correct in these files (author, labels, etc.):
provider/biomni.yamltools/biomni_agent.yamlmanifest.yaml
- Create or find a PNG icon for Biomni (recommended size: 256x256px)
- Place it at
_assets/biomni_icon.png
Set these environment variables to point the plugin at your Biomni agent:
# Optional extra sys.path entry if Biomni lives outside site-packages
export BIOMNI_PYTHON_PATH=/absolute/path/to/biomni/source
# Import path to your agent class or instance. Examples:
# Package class: biomni:BiomniAgent
# Module object: biomni.agent:agent
export BIOMNI_AGENT_IMPORT="biomni:BiomniAgent"
# Optional method name to call on the agent (defaults to 'go').
export BIOMNI_AGENT_METHOD=gotools/biomni_agent.py will call BIOMNI_AGENT_METHOD if set, otherwise tries go, run, process_query, then __call__.
In tools/biomni_agent.py, customize the _format_result() method based on your agent's output format.
In requirements.txt, add all dependencies your Biomni agent needs. If Biomni is pip-installable, uncomment and pin biomni.
Create empty __init__.py files:
touch provider/__init__.py
touch tools/__init__.pyDownload the Dify plugin CLI tool:
# Download from Dify's GitHub releases or documentation
# Follow Dify's official installation guide for the CLI toolcd biomni_plugin
cp .env.example .env
# Get remote debugging credentials from your Dify instance:
# 1. Go to Dify admin panel β Plugin Management
# 2. Click "Get Debugging Key"
# 3. Copy the host, port, and key values
# 4. Update your .env file with these valuespip install -r requirements.txt# Run in development mode
python main.py
# Or use the CLI tool for debugging
dify plugin devWith your .env file configured:
python -m mainYou should see the plugin appear in your Dify workspace for testing.
# In your plugin root directory
dify plugin package .
# This creates biomni.difypkg fileIf CLI tool isn't available:
# Create a zip file with all plugin contents
zip -r biomni.difypkg \
manifest.yaml \
main.py \
requirements.txt \
_assets/ \
provider/ \
tools/
# Note: Don't include .env, __pycache__, or other development filesCreate a simple test script:
# test_plugin.py
import sys
sys.path.append('/path/to/your/biomni')
def test_agent_import():
"""Test if your agent can be imported"""
try:
# Use your actual import
from your_biomni_module import agent
print("β
Agent import successful")
return True
except Exception as e:
print(f"β Agent import failed: {e}")
return False
def test_agent_call():
"""Test if your agent method works"""
try:
from your_biomni_module import agent
result = agent.go("test query")
print(f"β
Agent call successful: {result[:100]}...")
return True
except Exception as e:
print(f"β Agent call failed: {e}")
return False
if __name__ == "__main__":
test_agent_import()
test_agent_call()- Install the plugin in your Dify development environment
- Create a simple Agent or Workflow
- Add your Biomni tool
- Test with simple queries first
- Gradually test more complex biomedical queries
# Upload to your Dify development instance
# Use the plugin management interface to upload biomni.difypkg# For production, ensure:
# 1. All dependencies are properly configured
# 2. Biomni agent is installed and accessible
# 3. Sufficient system resources (memory, CPU)
# 4. Proper error handling and logging- Import Errors: Check your Biomni path and import statements
- Agent Not Found: Verify your agent setup and method names
- Timeout Issues: Increase
max_execution_timefor complex queries - Memory Issues: Monitor resource usage, add cleanup if needed
- Permission Errors: Ensure proper file permissions and paths
Add more logging to troubleshoot:
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
# Add debug logs throughout your code
logger.debug(f"Agent setup status: {self.agent is not None}")
logger.debug(f"Processing query: {research_query[:50]}...")Before packaging:
- Updated all
your-nameplaceholders - Added proper Biomni agent import and path
- Configured correct agent method call
- Added plugin icon to
_assets/ - Updated
requirements.txtwith dependencies - Created empty
__init__.pyfiles - Tested agent import and method calls
- Tested plugin in development mode
- Verified remote debugging works
After successful deployment:
- Monitor plugin performance and resource usage
- Collect user feedback on biomedical research capabilities
- Consider adding more advanced features:
- Progress streaming for long-running analyses
- Result caching for common queries
- Integration with biomedical databases
- Batch processing capabilities
- Submit to Dify Marketplace (optional)
Your Biomni plugin is now ready for use! π§¬β¨