App 4: Build an AI Agent with Python and LangChain

What We Will Build:

Installing Libraries and Getting API Keys:

Requirements.txt:

python-dotenv>=1.0.0

langchain-core>=0.2.0

langchain-google-genai>=0.1.0

langchain>=0.2.0

todoist-api-python>=2.2.0

pydantic>=2.0.0

Gemini API Key: https://aistudio.google.com/app/apikey

Loading API Keys:

Getting AI Responses from LangChain:

Agent Executing Tools (Python functions):

Agent Tools With Function Arguments:

Adding Tasks to Todoist With the Agent:

Enabling Agent History:

Agent Showing Existing Tasks: