diff options
Diffstat (limited to 'personal_agent/cli.py')
| -rw-r--r-- | personal_agent/cli.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/personal_agent/cli.py b/personal_agent/cli.py new file mode 100644 index 0000000..7bd747a --- /dev/null +++ b/personal_agent/cli.py @@ -0,0 +1,65 @@ +from personal_agent.agent import Agent +from personal_agent.identity import load_agent_identity, load_user_profile +from personal_agent.llm import LLM +from personal_agent.tools import ( + CalculatorTool, + FileSystemListTool, + FileSystemReadTool, + ToolRegistry, + WeatherTool, +) + +llm = LLM( + "http://localhost:8080/v1/chat/completions", +) + +agent_identity = load_agent_identity("agent.toml") +user_profile = load_user_profile("user.toml") + +tools = ToolRegistry() +# tools.register(HelloTool()) +tools.register(CalculatorTool()) +tools.register(WeatherTool()) +tools.register(FileSystemListTool()) +tools.register(FileSystemReadTool()) + +agent = Agent( + llm, + agent_identity, + user_profile, + tools, +) + +while True: + user_input = input("You: ") + + if user_input.lower() in {"exit", "quit"}: + break + + match user_input: + case "/end": + agent.end_task() + print("[task ended]") + continue + + case "/task": + print(f"\n[memory: {agent.working_memory}]\n") + continue + + case "/pause": + agent.pause_task() + print("[task paused]") + continue + + case "/resume": + agent.resume_task() + print("[task resumed]") + continue + + case "/complete": + agent.complete_task() + print("[task completed]") + continue + + answer = agent.chat(user_input) + print(f"Agent: {answer}") |
