# agents/filesystem_agent.py
import asyncio
from laddr import Agent, WorkerRunner
from laddr.llms import gemini
from laddr.core.mcp_tools import MCPToolProvider
async def main():
# Initialize MCP provider for filesystem
mcp = MCPToolProvider(
command="npx -y @modelcontextprotocol/server-filesystem /path/to/project",
transport="stdio",
server_name="filesystem"
)
# Create agent
agent = Agent(
name="filesystem_assistant",
role="Filesystem Assistant",
goal="Help users explore and analyze files and directories",
backstory="""You are a helpful filesystem assistant. You can:
- Navigate directories
- Read and analyze files
- Search for content
- Provide file information""",
llm=gemini(model="gemini-2.5-flash", temperature=0.3),
tools=[mcp],
instructions="""
When helping users:
1. Use filesystem tools to explore directories
2. Read relevant files to answer questions
3. Provide clear, organized information
4. Be concise and focus on what the user asked
"""
)
# Run as worker
runner = WorkerRunner(agent=agent)
print("Starting filesystem assistant...")
await runner.start()
if __name__ == "__main__":
asyncio.run(main())