Skip to content

bug: Anthropic client fails to use system proxy #699

Description

@jinzhuer

Describe the bug

When using Curator with the Anthropic SDK in a proxy environment (e.g. with HTTP_PROXY, HTTPS_PROXY, or ALL_PROXY set), Curator’s implementation bypasses the system proxy and connects directly to the Anthropic API.

To Reproduce

Steps to reproduce:

  1. Set proxy environment variables:
   export HTTPS_PROXY=http://127.0.0.1:7890
   export ANTHROPIC_API_KEY=sk-xxxxxx
  1. Use Curator to make a call with a model such as "claude-3-5-sonnet-latest" (or any Anthropic model) behind the proxy.

  2. Observe connection errors (timeout, unreachable host, proxy ignored).

Expected behavior

The Anthropic API client should route all requests through the configured system proxy when environment variables are set, so Curator works properly in proxy environments.

Root cause

  • Curator’s integration uses aiohttp to create the Anthropic client session, but it does not pass trust_env=True or forward proxy configuration to aiohttp.ClientSession. As a result, aiohttp bypasses the system proxy and connects directly to the Anthropic API even when HTTP(S)_PROXY or ALL_PROXY is set.
  • According to the Anthropic SDK v0.54.0 release notes, the fix for proxy behavior was introduced in version 0.54.0 or higher.

Proposed fix for Curator

  1. When constructing the Anthropic client or aiohttp.ClientSession, explicitly set trust_env=True (or equivalent) so that environment-defined proxies are respected.
  2. Update Curator’s dependency constraint for anthropic to >= 0.54.0, which contains the upstream proxy fix in the SDK itself.

Environment

  • Curator version: main branch (before fix)
  • Python version: 3.10+
  • OS: Linux
  • Anthropic SDK version: < 0.54.0
  • Proxy: HTTP(S) proxy set via environment variables

Additional context

A corresponding pull request has been opened to fix this issue and update the dependency. #698

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions