Skip to main content

A full-featured async Python client for the internal Antigravity API with Tool Calling and Streaming support.

Project description

anti-client

A full-featured Python client library for interacting with the internal Anrigravity API (Gemini).

Features

  • OAuth 2.0 Authentication: Built-in authentication flow with token caching (~/.anti-api/accounts.json).
  • Function Calling: Complete support for tool execution by agents.
  • Streaming: Native streaming capabilities, seamlessly integrated with function calling.
  • Resource Management: Automated model discovery, quota checking, and precise usage statistics.

Installation

Install the package directly from the source directory:

pip install .

Usage Example

from anti_client import Client, Agent, Tool

# 1. Initialize Client (Triggers OAuth flow if tokens are missing)
client = Client()

# 2. Define Tools
def get_weather(city: str) -> str:
    """Retrieve weather information for a specific city."""
    return f"The weather in {city} is clear and sunny."

weather_tool = Tool(
    name="get_weather",
    description="Retrieve the current weather for a specified city.",
    parameters={
        "type": "object",
        "properties": {
            "city": {"type": "string", "description": "The name of the city."}
        },
        "required": ["city"],
    },
    func=get_weather
)

# 3. Initialize Agent
agent = Agent(
    client=client,
    model="gemini-3.1-pro-low",
    system_prompt="You are a helpful assistant.",
    tools=[weather_tool]
)

# 4. Generate Response
response = agent.run("Hello! What's the weather like in London?")

if not isinstance(response, type((x for x in []))): # If stream=False
    print("Response:", response.text)
    print("Tokens Used:", response.usage.total_tokens)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anti_client-0.1.3.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anti_client-0.1.3-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file anti_client-0.1.3.tar.gz.

File metadata

  • Download URL: anti_client-0.1.3.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Gentoo","version":"2.18","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for anti_client-0.1.3.tar.gz
Algorithm Hash digest
SHA256 619f0fcf5c9109407de97cf437ea4f22233c060f0fbcfab988730dd6ea9b39b3
MD5 9a3ce2c4d1c8a146b7742a5c22b3f6f8
BLAKE2b-256 91f03ffb7e705e23e05abae0f192d888440efceab42b67043b74da901355b867

See more details on using hashes here.

File details

Details for the file anti_client-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: anti_client-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Gentoo","version":"2.18","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for anti_client-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 228ee67d6600cf026c6ca134c42bcec22235067f479297ad40c528f0e2b96906
MD5 8408a30f8f7201a4768d1c772a8de4a8
BLAKE2b-256 66010f51e38692a8c4da8d58279d15ee1c32ebd9e426ecba35f6d519f8a6b15d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page