FloTorch SDK Overview
The FloTorch SDK provides typed, high-level clients for building AI apps against the FloTorch Gateway and Workspace services. It currently includes:
- LLM:
FlotorchLLMfor sync and async model invocations - Memory:
FlotorchMemory/FlotorchAsyncMemoryfor user/agent/app memories andFlotorchVectorStore/FlotorchAsyncVectorStorefor vector store search - Session:
FlotorchSession/FlotorchAsyncSessionfor structured conversational sessions and event streams
Use the sidebar to dive into each module.
Installation
Section titled “Installation”pip install flotorch[sdk]Configuration
Section titled “Configuration”All SDK clients require your FloTorch API key and the base URL of your deployment.
API_KEY = "<your_api_key>"BASE_URL = "https://gateway.flotorch.cloud"Logging Configuration
Section titled “Logging Configuration”FloTorch SDK provides flexible logging configuration to help you monitor and debug your applications. You can configure logging using environment variables or programmatically through the logger API. This logging configuration applies to all FloTorch SDK components and plugins (ADK, CrewAI, etc.).
Environment Variables
Section titled “Environment Variables”Configure logging using the following environment variables:
# Enable debug and info level logsexport FLOTORCH_LOG_DEBUG=true
# Set log output destination: "console" or "file"export FLOTORCH_LOG_PROVIDER="file"
# Specify log file name (only used when provider is "file")# Default: "flotorch_logs.log" if not specifiedexport FLOTORCH_LOG_FILE="my_app.log"Environment Variable Details:
FLOTORCH_LOG_DEBUG- When set totrue, enables debug and info level logging. Whenfalseor unset, only warning and error logs are displayed.FLOTORCH_LOG_PROVIDER- Specifies where logs should be output:"console"- Logs are displayed in the console/terminal"file"- Logs are written to a file
FLOTORCH_LOG_FILE- The name of the log file whenFLOTORCH_LOG_PROVIDER="file". If not specified, defaults to"flotorch_logs.log".
Programmatic Configuration
Section titled “Programmatic Configuration”You can also configure logging programmatically using the configure_logger function:
from flotorch.sdk.logger.global_logger import configure_logger
# Configure logging programmaticallyconfigure_logger( debug=True, # Enable debug and info logs log_provider="file", # Output to file log_file="my_app.log" # Custom log file name)Programmatic Configuration Parameters:
debug(bool) - WhenTrue, enables debug and info level logging. WhenFalse, only warning and error logs are displayed.log_provider(str) - Log output destination:"console"or"file"log_file(str, optional) - Log file name whenlog_provider="file". Defaults to"flotorch_logs.log"if not specified.
Usage Examples
Section titled “Usage Examples”Console Logging with Debug Enabled
Section titled “Console Logging with Debug Enabled”export FLOTORCH_LOG_DEBUG=trueexport FLOTORCH_LOG_PROVIDER="console"from flotorch.sdk.logger.global_logger import configure_logger
configure_logger(debug=True, log_provider="console")File Logging with Custom File Name
Section titled “File Logging with Custom File Name”export FLOTORCH_LOG_DEBUG=trueexport FLOTORCH_LOG_PROVIDER="file"export FLOTORCH_LOG_FILE="production.log"from flotorch.sdk.logger.global_logger import configure_logger
configure_logger(debug=True, log_provider="file", log_file="production.log")File Logging with Default File Name
Section titled “File Logging with Default File Name”export FLOTORCH_LOG_DEBUG=trueexport FLOTORCH_LOG_PROVIDER="file"# FLOTORCH_LOG_FILE not set - will use default "flotorch_logs.log"from flotorch.sdk.logger.global_logger import configure_logger
configure_logger(debug=True, log_provider="file")# Uses default file name: "flotorch_logs.log"Best Practices
Section titled “Best Practices”- Development: Use console logging with debug enabled for immediate feedback during development
- Production: Use file logging with a descriptive file name for persistent log storage
- Log Rotation: Consider implementing log rotation for file-based logging in production environments
- Security: Be cautious when logging sensitive information; ensure log files have appropriate access controls
Next steps
Section titled “Next steps”- See LLM, Memory, and Session pages for full APIs and advanced usage.
- Prefer async variants for high-throughput or I/O-bound workloads.