Requirements
TypeAgent requires Python 3.12 or later. Check your Python version:Installation Methods
- pip
- uv
- poetry
The simplest way to install TypeAgent:To install with development dependencies:
Virtual Environment Setup
It’s strongly recommended to use a virtual environment to isolate TypeAgent dependencies from your system Python.
- venv (built-in)
- uv
- poetry
Using Python’s built-in
venv module:Environment Variables
TypeAgent requires API credentials for the LLM provider you’re using. Set these environment variables before running your code.OpenAI Setup
Get API Key
Create an API key at OpenAI Platform
Azure OpenAI Setup
If using Azure-hosted OpenAI:If both
OPENAI_API_KEY and AZURE_OPENAI_API_KEY are set, OpenAI (non-Azure) takes precedence.Using .env Files
For convenience, create a.env file in your project directory:
.env
Core Dependencies
TypeAgent automatically installs these key dependencies:| Package | Purpose |
|---|---|
openai | OpenAI API client |
pydantic-ai-slim[openai] | Provider-agnostic AI model interface |
azure-identity | Azure authentication |
tiktoken | Token counting for OpenAI models |
typechat | Type-safe AI interaction |
numpy | Numerical operations for embeddings |
python-dotenv | Environment variable management |
Optional Dependencies
Logfire (Observability)
For production monitoring and debugging:logfire: Structured logging and observabilityopentelemetry-instrumentation-httpx: HTTP tracing
Development Tools
For contributors and advanced users:pytest,pytest-asyncio,pytest-mock: Testingpyright: Type checkingcoverage: Code coverageisort: Import sorting- Email ingestion tools (
google-api-python-client,msgraph-sdk)
Verify Installation
Confirm TypeAgent is installed correctly:verify.py
Troubleshooting
ModuleNotFoundError: No module named 'typeagent'
ModuleNotFoundError: No module named 'typeagent'
Solution: Make sure you’ve activated your virtual environment and installed TypeAgent:
Python version too old
Python version too old
Error:
RuntimeError: This package requires Python 3.12 or laterSolution: Upgrade to Python 3.12+:- Download from python.org
- Or use pyenv:
pyenv install 3.12
OpenAI authentication error
OpenAI authentication error
Error: If empty, set it:
openai.AuthenticationError: Incorrect API key providedSolution: Verify your API key is set correctly:Import errors on Windows
Import errors on Windows
Issue: Module not found despite installationSolution: Ensure you’re using the correct Python interpreter:
Next Steps
Quickstart Tutorial
Build your first TypeAgent application
API Reference
Explore the complete API documentation
Upgrading TypeAgent
To upgrade to the latest version:Migration Notes
If you’re upgrading from an earlier version, be aware of these key changes:Version 0.4.0 (Current)
- Provider-agnostic models: Use
provider:modelspec strings (e.g.,"openai:gpt-4o") - New environment variables:
OPENAI_MODELandOPENAI_EMBEDDING_MODELfor overriding defaults - Breaking:
AsyncEmbeddingModelreplaced withIEmbedder/IEmbeddingModelprotocols - Storage APIs: All storage provider APIs are now async
Version 0.3.x
- Build system: Migrated from setuptools to uv_build
- Dev dependencies: Install with
typeagent[dev]instead of separate package - Project structure: Source moved to
src/typeagent/