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

import asyncio
from anti_client import Client, Agent, Tool

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

async def main():
    # 2. Initialize Client using an async context manager
    # (Triggers OAuth flow if tokens are missing)
    async with Client() as client:

        # 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 = await agent.run("Hello! What's the weather like in London?", stream=False)

        print("Response:", response.text)
        print("Tokens Used:", response.usage.total_tokens)

if __name__ == "__main__":
    asyncio.run(main())

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-1.0.0.tar.gz (15.6 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-1.0.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: anti_client-1.0.0.tar.gz
  • Upload date:
  • Size: 15.6 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-1.0.0.tar.gz
Algorithm Hash digest
SHA256 19dd5733989275450f0e299d6476b7871d9169d94c3d2a6c710c5e6a609b214e
MD5 5e15a1bda8275aecf167245b8dcbd258
BLAKE2b-256 a6f7ef59bbc1027117776b3b09cf500b06943ae00354cefcc314642c0ebb8925

See more details on using hashes here.

File details

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

File metadata

  • Download URL: anti_client-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 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-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce3d6cf2b0dee5b458b3862f26b43dd30a7f0d71084ed97572833930363d6bd7
MD5 8ae528d4c90452c5c400cb70f89e1a1b
BLAKE2b-256 1aa19860949adaaf5e54fe80f49370751cb56065e2ec270a3bd4ef1d363772af

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