From ec1b4af657e646bed26072ca7a1bebe93a56d26d Mon Sep 17 00:00:00 2001 From: Eric Phillips Date: Thu, 12 Feb 2026 09:07:14 -0700 Subject: [PATCH] talking to claude --- agent/__init__.py | 0 agent/config.py | 11 +++++++++++ agent/loop.py | 23 +++++++++++++++++++++++ main.py | 18 ++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 agent/__init__.py create mode 100644 agent/config.py create mode 100644 agent/loop.py create mode 100644 main.py diff --git a/agent/__init__.py b/agent/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/agent/config.py b/agent/config.py new file mode 100644 index 0000000..ffabac9 --- /dev/null +++ b/agent/config.py @@ -0,0 +1,11 @@ +from pydantic_settings import BaseSettings + + +class Settings(BaseSettings): + anthropic_api_key: str + model: str = "claude-sonnet-4-5-20250929" + safedir: str = "./workspace" + max_tokens: int = 500 + + class Config: + env_file = ".env" diff --git a/agent/loop.py b/agent/loop.py new file mode 100644 index 0000000..b685cc5 --- /dev/null +++ b/agent/loop.py @@ -0,0 +1,23 @@ +import asyncio + +from anthropic import AsyncAnthropic + +from agent.config import Settings + +settings = Settings() + +client = AsyncAnthropic(api_key=settings.anthropic_api_key) + + +async def run_turn(user_message: str) -> str: + message = await client.messages.create( + model=settings.model, + max_tokens=settings.max_tokens, + messages=[ + { + "role": "user", + "content": user_message, + } + ], + ) + return message diff --git a/main.py b/main.py new file mode 100644 index 0000000..b3b5f92 --- /dev/null +++ b/main.py @@ -0,0 +1,18 @@ +import asyncio + +from agent.loop import run_turn + + +async def run_tui(): + user_message = "what is the answer to life the universe and everythings?" + message = await run_turn(user_message) + print(message.content) + + +def main(): + print("Hello from mycode!") + asyncio.run(run_tui()) + + +if __name__ == "__main__": + main()