Create medical_agent.py with the code below, or save it directly from your editor.
"""Medical Research Agent with Web SearchA Bindu agent that provides medical information and health guidance using DuckDuckGo web search.Provides general health information, symptom analysis, and wellness recommendations.Features:- Web search via DuckDuckGo for real-time medical information- Medical research and symptom analysis capabilities- OpenRouter integration with google/gemini-2.0-flash-001- Clean, synthesized responses with medical disclaimers- Health and wellness guidanceUsage: python medical_agent.pyEnvironment: Requires OPENROUTER_API_KEY in .env file"""import osfrom dotenv import load_dotenv# Load environment variables from .env fileload_dotenv()from bindu.penguin.bindufy import bindufyfrom agno.agent import Agentfrom agno.tools.duckduckgo import DuckDuckGoToolsfrom agno.models.openrouter import OpenRouter# Initialize the medical research agentagent = Agent( instructions="""You are a medical research assistant. When asked about health or medical topics, provide clear, accurate information with appropriate disclaimers. Key guidelines:- Always include a medical disclaimer stating this is not professional medical advice- Provide general health information and educational content- For specific medical concerns, recommend consulting healthcare professionals- Use web search to find current, reliable medical information- Present information in an organized, easy-to-read format- Avoid making definitive diagnoses or treatment recommendations- Focus on evidence-based information from reputable sourcesResponse format:- Start with relevant medical information- Include supporting details and context- End with a clear medical disclaimer- Avoid showing multiple search results - synthesize information coherently""", model=OpenRouter( id="google/gemini-2.0-flash-001", api_key=os.getenv("OPENROUTER_API_KEY") ), tools=[DuckDuckGoTools()], markdown=True)# Agent configuration for Binduconfig = { "author": "bindu.builder@getbindu.com", "name": "medical_agent", "description": "Medical research agent that provides health information, symptom analysis, and wellness guidance", "deployment": { "url": "http://localhost:3773", "expose": True, "cors_origins": ["http://localhost:5173"] }, "skills": ["skills/medical-research-skill"],}# Message handler functiondef handler(messages: list[dict[str, str]]): """ Process incoming messages and return agent response. Args: messages: List of message dictionaries containing conversation history Returns: Agent response with medical information and appropriate disclaimers """ # Extract the latest user message if messages: latest_message = messages[-1].get('content', '') if isinstance(messages[-1], dict) else str(messages[-1]) # Run the agent with the latest message result = agent.run(input=latest_message) # Format the response to be cleaner if hasattr(result, 'content'): return result.content elif hasattr(result, 'response'): return result.response else: return str(result) return "Please provide a health or medical question. Remember, I provide general information for educational purposes only."# Bindu-fy the agent - converts it to a discoverable, interoperable Bindu agentbindufy(config, handler)
id: medical-research-skillname: medical-research-skillversion: 1.0.0author: bindu.builder@getbindu.comdescription: | Advanced medical research skill that provides comprehensive health information, symptom analysis, and wellness guidance for educational purposes. Features: - Real-time medical information via web search - Symptom analysis and preliminary assessment - Drug information and interaction details - Health and wellness recommendations - Medical research and study summaries - Preventive care guidance - Lifestyle and nutrition advice Uses DuckDuckGo search to find current medical information and provides detailed analysis with appropriate medical disclaimers.tags: - medical - health - symptoms - wellness - research - healthcare - medicineinput_modes: - application/jsonoutput_modes: - application/jsonexamples: - "What are the symptoms of flu?" - "Provide information about ibuprofen side effects" - "How to prevent common cold?" - "What are the benefits of regular exercise?" - "Explain the symptoms of diabetes" - "Give tips for better sleep hygiene"capabilities_detail: medical_research: supported: true description: "Comprehensive medical research and health information retrieval" symptom_analysis: supported: true description: "Preliminary symptom analysis and assessment guidance" drug_information: supported: true description: "Medication details, side effects, and interaction information" wellness_guidance: supported: true description: "Health and wellness recommendations and lifestyle advice" search_integration: supported: true description: "Real-time medical information search via DuckDuckGo" preventive_care: supported: true description: "Preventive health measures and screening recommendations"
# Clone the Bindu repositorygit clone https://github.com/GetBindu/Bindu# Navigate to frontend directorycd frontend# Install dependenciesnpm install# Start frontend development servernpm run dev