Skip to main content

SDK Host Configuration

This guide covers how Agenta SDK automatically handles host configuration based on your deployment environment, ensuring proper connectivity for your applications.

Overview

The Agenta SDK automatically handles host configuration based on your deployment environment to ensure proper connectivity.

How it works

The SDK uses the DOCKER_NETWORK_MODE setting to determine how to handle host URLs:

  • Inside Docker containers (network mode: bridge): The SDK automatically converts localhost references to host.docker.internal to enable communication between containers
  • Outside Docker (network mode: host/default): The SDK preserves your original host configuration (e.g., localhost remains localhost). Note: "default" means DOCKER_NETWORK_MODE is not set when using the SDK outside Docker

Common scenarios

EnvironmentNetwork ModeHost SettingResult
AI services running in Dockerbridgelocalhosthost.docker.internal
Local development outside Dockerhost/default*localhostlocalhost
Custom host URLanyhttps://my-api.comhttps://my-api.com

*default = DOCKER_NETWORK_MODE environment variable is not set

Troubleshooting

If you're experiencing connectivity issues, verify that:

  • Your host configuration matches your deployment environment
  • The DOCKER_NETWORK_MODE is correctly set for your environment (bridge for Docker, host/default for outside Docker)
  • When running outside Docker, use localhost or your actual API URL
  • When running inside Docker, the SDK will handle host resolution automatically