File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ google :
2+ api_key :
Original file line number Diff line number Diff line change 1+ import asyncio
2+ import os
3+
4+ from mcp_agent .app import MCPApp
5+ from mcp_agent .agents .agent import Agent
6+ from mcp_agent .workflows .llm .augmented_llm_openai import GoogleAugmentedLLM
7+
8+ app = MCPApp (name = "hello_world_agent" )
9+
10+ async def example_usage ():
11+ async with app .run () as mcp_agent_app :
12+ logger = mcp_agent_app .logger
13+ # This agent can read the filesystem or fetch URLs
14+ finder_agent = Agent (
15+ name = "Lumi-test" ,
16+ instruction = """You are a helpful assistant""" ,
17+ #server_names=["fetch", "filesystem"], # MCP servers this Agent can use
18+ )
19+
20+ async with finder_agent :
21+ # Automatically initializes the MCP servers and adds their tools for LLM use
22+ #tools = await finder_agent.list_tools()
23+ #logger.info(f"Tools available:", data=tools)
24+ llm = await finder_agent .attach_llm (GoogleAugmentedLLM )
25+
26+ # This will perform a file lookup and read using the filesystem server
27+ result = await llm .generate_str (
28+ message = "Why is the sky blue? Explain in two sentences."
29+ )
30+ logger .info (f"Response: { result } " )
31+
32+
33+ if __name__ == "__main__" :
34+ asyncio .run (example_usage ())
You can’t perform that action at this time.
0 commit comments