import os
import asyncio
from hypertic.agents import Agent
from hypertic.models import OpenAIChat
from hypertic.tools import FileSystemTools
# Set root directory for file operations
test_dir = os.path.join(os.path.dirname(__file__), "data")
filesystem_tools = FileSystemTools(root_dir=test_dir)
model = OpenAIChat(model="gpt-4o")
agent = Agent(
model=model,
tools=[filesystem_tools],
)
async def main():
# List directory contents
response = await agent.arun("List all the contents")
print(response.content)
# Read a file
response = await agent.arun("Read the contents of sample.txt")
print(response.content)
asyncio.run(main())