Skip to content

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: FlotorchLLM for sync and async model invocations
  • Memory: FlotorchMemory / FlotorchAsyncMemory for user/agent/app memories and FlotorchVectorStore / FlotorchAsyncVectorStore for vector store search
  • Session: FlotorchSession / FlotorchAsyncSession for structured conversational sessions and event streams

Use the sidebar to dive into each module.


Terminal window
pip install flotorch[sdk]

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"

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.).

Configure logging using the following environment variables:

Terminal window
# Enable debug and info level logs
export 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 specified
export FLOTORCH_LOG_FILE="my_app.log"

Environment Variable Details:

  • FLOTORCH_LOG_DEBUG - When set to true, enables debug and info level logging. When false or 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 when FLOTORCH_LOG_PROVIDER="file". If not specified, defaults to "flotorch_logs.log".

You can also configure logging programmatically using the configure_logger function:

from flotorch.sdk.logger.global_logger import configure_logger
# Configure logging programmatically
configure_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) - When True, enables debug and info level logging. When False, only warning and error logs are displayed.
  • log_provider (str) - Log output destination: "console" or "file"
  • log_file (str, optional) - Log file name when log_provider="file". Defaults to "flotorch_logs.log" if not specified.
Terminal window
export FLOTORCH_LOG_DEBUG=true
export FLOTORCH_LOG_PROVIDER="console"
from flotorch.sdk.logger.global_logger import configure_logger
configure_logger(debug=True, log_provider="console")
Terminal window
export FLOTORCH_LOG_DEBUG=true
export 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")
Terminal window
export FLOTORCH_LOG_DEBUG=true
export 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"
  1. Development: Use console logging with debug enabled for immediate feedback during development
  2. Production: Use file logging with a descriptive file name for persistent log storage
  3. Log Rotation: Consider implementing log rotation for file-based logging in production environments
  4. Security: Be cautious when logging sensitive information; ensure log files have appropriate access controls

  • See LLM, Memory, and Session pages for full APIs and advanced usage.
  • Prefer async variants for high-throughput or I/O-bound workloads.