A basic Python agent built with the Anthropic SDK that maintains conversation history across turns. Each user message is appended to a running history list, giving the model full context of prior exchanges within a session.
- Python 3.8+
- An Anthropic API key
- The
anthropicPython package
Install the required package:
pip install anthropicSet your API key as an environment variable:
export ANTHROPIC_API_KEY="your-api-key-here"python chat.pyOnce running, type a message and press Enter to get a response. The full conversation history is printed after each turn. Type quit to exit.
If you run into any problems or have questions, please file an issue.