#!/usr/bin/env python3
"""
Command-line script to run the Keet CLI agent.
"""
import asyncio
import sys
import argparse
from ollamatools.plugins.integrations.keet.keet_cmd_agent import KeetCmdAgent
# Default room key from the pear link invite
DEFAULT_ROOM_KEY = "yrb6mha3b4u5f1mm3jns44m3athon6was4pbums6awmns8ygsqs9ufop31z6d3n4qrqb7eerqp6f9zga5hb6ug9demezyftfarhnu3q57tz9sgde"
async def main():
"""Main entry point for the Keet CLI agent."""
# Set up argument parser
parser = argparse.ArgumentParser(description="Keet Command-line Agent")
parser.add_argument("--storage", type=str, help="Path to store Keet data")
parser.add_argument("--room-key", type=str, default=DEFAULT_ROOM_KEY,
help="Room key or invite link to join (default: hardcoded room key)")
parser.add_argument("--name", type=str, default="KeetBot", help="Display name for the agent")
parser.add_argument("--model", type=str, default="llama3:latest", help="Ollama model to use")
parser.add_argument("--ollama-host", type=str, default="localhost:11434",
help="Host address for the Ollama API")
parser.add_argument("--prompt", type=str, help="System prompt for the Ollama model")
parser.add_argument("--mock", action="store_true", help="Use the mock implementation")
parser.add_argument("--verbose", action="store_true", help="Enable verbose logging")
args = parser.parse_args()
# Extract room key from invite link if needed
room_key = args.room_key
if room_key.startswith("pear://keet/"):
room_key = room_key[len("pear://keet/"):]
# Create the agent
agent = KeetCmdAgent(
storage_path=args.storage,
room_key=room_key,
name=args.name,
model=args.model,
ollama_host=args.ollama_host,
prompt=args.prompt,
mock=args.mock,
verbose=args.verbose
)
# Start the agent
try:
await agent.start()
# Keep the agent running until interrupted
while True:
await asyncio.sleep(1)
except KeyboardInterrupt:
print("\nInterrupted by user")
finally:
# Stop the agent
await agent.stop()
if __name__ == "__main__":
sys.exit(asyncio.run(main()))