| … | … | @@ -5,7 +5,53 @@ Command-line script to run the Keet CLI agent. |
| 5 | 5 | |
| 6 | 6 | import asyncio |
| 7 | 7 | import sys |
| 8 | from ollamatools.plugins.integrations.keet.keet_cmd_agent import main | |
| 8 | import argparse | |
| 9 | from ollamatools.plugins.integrations.keet.keet_cmd_agent import KeetCmdAgent | |
| 10 | ||
| 11 | # Default room key from the pear link invite | |
| 12 | DEFAULT_ROOM_KEY = "yrb6mha3b4u5f1mm3jns44m3athon6was4pbums6awmns8ygsqs9ufop31z6d3n4qrqb7eerqp6f9zga5hb6ug9demezyftfarhnu3q57tz9sgde" | |
| 13 | ||
| 14 | async def main(): | |
| 15 | """Main entry point for the Keet CLI agent.""" | |
| 16 | # Set up argument parser | |
| 17 | parser = argparse.ArgumentParser(description="Keet Command-line Agent") | |
| 18 | parser.add_argument("--storage", type=str, help="Path to store Keet data") | |
| 19 | parser.add_argument("--room-key", type=str, default=DEFAULT_ROOM_KEY, | |
| 20 | help="Room key or invite link to join (default: hardcoded room key)") | |
| 21 | parser.add_argument("--name", type=str, default="KeetBot", help="Display name for the agent") | |
| 22 | parser.add_argument("--model", type=str, default="llama3", help="Ollama model to use") | |
| 23 | parser.add_argument("--mock", action="store_true", help="Use the mock implementation") | |
| 24 | parser.add_argument("--verbose", action="store_true", help="Enable verbose logging") | |
| 25 | ||
| 26 | args = parser.parse_args() | |
| 27 | ||
| 28 | # Extract room key from invite link if needed | |
| 29 | room_key = args.room_key | |
| 30 | if room_key.startswith("pear://keet/"): | |
| 31 | room_key = room_key[len("pear://keet/"):] | |
| 32 | ||
| 33 | # Create the agent | |
| 34 | agent = KeetCmdAgent( | |
| 35 | storage_path=args.storage, | |
| 36 | room_key=room_key, | |
| 37 | name=args.name, | |
| 38 | model=args.model, | |
| 39 | mock=args.mock, | |
| 40 | verbose=args.verbose | |
| 41 | ) | |
| 42 | ||
| 43 | # Start the agent | |
| 44 | try: | |
| 45 | await agent.start() | |
| 46 | ||
| 47 | # Keep the agent running until interrupted | |
| 48 | while True: | |
| 49 | await asyncio.sleep(1) | |
| 50 | except KeyboardInterrupt: | |
| 51 | print("\nInterrupted by user") | |
| 52 | finally: | |
| 53 | # Stop the agent | |
| 54 | await agent.stop() | |
| 9 | 55 | |
| 10 | 56 | if __name__ == "__main__": |
| 11 | 57 | sys.exit(asyncio.run(main())) |
| … | … | @@ -2,6 +2,22 @@ |
| 2 | 2 | |
| 3 | 3 | A minimal CLI agent for Keet that can join a room, name itself, and respond to user messages using Ollama. |
| 4 | 4 | |
| 5 | ## Room Keys and Pear Link Invites | |
| 6 | ||
| 7 | Keet uses "pear link invites" to share room access. These links start with `pear://keet/` followed by the room key. For example: | |
| 8 | ||
| 9 | ``` | |
| 10 | pear://keet/yrb6mha3b4u5f1mm3jns44m3athon6was4pbums6awmns8ygsqs9ufop31z6d3n4qrqb7eerqp6f9zga5hb6ug9demezyftfarhnu3q57tz9sgde | |
| 11 | ``` | |
| 12 | ||
| 13 | The room key is everything after the `pear://keet/` prefix: | |
| 14 | ||
| 15 | ``` | |
| 16 | yrb6mha3b4u5f1mm3jns44m3athon6was4pbums6awmns8ygsqs9ufop31z6d3n4qrqb7eerqp6f9zga5hb6ug9demezyftfarhnu3q57tz9sgde | |
| 17 | ``` | |
| 18 | ||
| 19 | You can use either the full pear link invite or just the room key with the Keet CLI agent. The agent will automatically extract the room key from the pear link invite if needed. | |
| 20 | ||
| 5 | 21 | ## Features |
| 6 | 22 | |
| 7 | 23 | - Join a Keet room using a room key or invite link |
| … | … | @@ -27,13 +43,17 @@ The Keet CLI agent is part of the ollamatools package. If you have ollamatools i |
| 27 | 43 | You can run the Keet CLI agent from the command line using the `keet_cmd_run` script: |
| 28 | 44 | |
| 29 | 45 | ```bash |
| 30 | ./keet_cmd_run --room-key <room_key> --name <bot_name> --model <ollama_model> | |
| 46 | # Use the default hardcoded room key | |
| 47 | ./keet_cmd_run --name <bot_name> --model <ollama_model> | |
| 48 | ||
| 49 | # Or specify a different room key or pear link invite | |
| 50 | ./keet_cmd_run --room-key <room_key_or_pear_link> --name <bot_name> --model <ollama_model> | |
| 31 | 51 | ``` |
| 32 | 52 | |
| 33 | 53 | ### Options |
| 34 | 54 | |
| 35 | 55 | - `--storage`: Path to store Keet data. If not provided, a default path will be used. |
| 36 | - `--room-key`: Room key or invite link to join. If not provided, the most recent room will be used. | |
| 56 | - `--room-key`: Room key or invite link to join. If not provided, the default hardcoded room key will be used. | |
| 37 | 57 | - `--name`: Display name for the agent. Default is "KeetBot". |
| 38 | 58 | - `--model`: Ollama model to use for generating responses. Default is "llama3". |
| 39 | 59 | - `--mock`: Use the mock implementation (for testing). |