Skip to main content

Google ADK model implementation for LangDB's LLM API.

Project description

LangDB LLM for Google ADK

A Google ADK (Agent Development Kit) model implementation for LangDB's LLM API. This package provides seamless integration of LangDB's LLM capabilities into the Google ADK framework.

Features

  • Native integration with Google ADK's BaseLlm interface
  • Support for both streaming and non-streaming completions
  • Built-in function calling support
  • Integration with MCP (Model Control Protocol) servers
  • Asynchronous API compatible with ADK's execution model
  • Automatic handling of tool execution and responses

Installation

pip install -e .

Usage with Google ADK

Basic Usage

import os
import asyncio
from google.adk import Agent
from langdb_adk import LangDBLlm
from google.adk.runners import InMemoryRunner

async def main():
    # Initialize the LangDB LLM with your credentials
    llm = LangDBLlm(
        model="anthropic/claude-sonnet-4",
        api_key=os.getenv("LANGDB_API_KEY"),
        project_id=os.getenv("LANGDB_PROJECT_ID")
    )
    
    # Create an ADK agent with the LangDB LLM
    agent = Agent(llm=llm)
    
    # Create a runner to execute the agent
    runner = InMemoryRunner()
    
    # Run the agent with a prompt
    response = await runner.run(agent, "Hello, how are you?")
    print(response.text)

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

With MCP Servers

# Configure MCP servers for LangDB
mcp_servers = [
    {
        "server_url": "server_url",
        "type": "sse",
        "name": "search",
        "description": "Web search capabilities via DuckDuckGo"
    }
]

async def main():
    # Initialize the LangDB LLM with MCP servers
    llm = LangDBLlm(
        model="anthropic/claude-sonnet-4",
        api_key=os.getenv("LANGDB_API_KEY"),
        project_id=os.getenv("LANGDB_PROJECT_ID"),
        mcp_servers=mcp_servers
    )
    
    # Create an ADK agent with the LangDB LLM
    agent = Agent(llm=llm)
    
    # Create a runner to execute the agent
    runner = InMemoryRunner()
    
    # Run the agent with a prompt that can use MCP tools
    response = await runner.run(agent, "Search for the latest news about AI")
    print(response.text)

Configuration

Environment Variables

  • LANGDB_API_KEY: Your LangDB API key (required)
  • LANGDB_PROJECT_ID: Your LangDB project ID (required)

LangDBLlm Parameters

  • model: The name of the model to use (e.g., "anthropic/claude-sonnet-4")
  • api_key: Your LangDB API key
  • project_id: Your LangDB project ID
  • extra_headers: Additional headers to include in requests
  • mcp_servers: List of MCP server configurations for extended capabilities

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Acknowledgements

  • Google ADK Team for the Agent Development Kit

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

langdb_adk-0.1.9.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

langdb_adk-0.1.9-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file langdb_adk-0.1.9.tar.gz.

File metadata

  • Download URL: langdb_adk-0.1.9.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for langdb_adk-0.1.9.tar.gz
Algorithm Hash digest
SHA256 d235adb317cf61f3789238427caf585577a972871cdd848ddf9d3d0a7c9a472f
MD5 0791f1217b908f783b58f81ccb7090bf
BLAKE2b-256 aba7e4cb7c2681310c697e22ed663289ae5588f0eb2ba9a88c7baa1be2f4899f

See more details on using hashes here.

File details

Details for the file langdb_adk-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for langdb_adk-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 04bcd7eb5df0e41fc35e36d46d4d7e2c0789996f193dfc21c23d52f515e17ba7
MD5 1e8eb37d4e7cbd84f3417ea56fb9efa9
BLAKE2b-256 248e4ad74852624852f1a67b1d8330c2d18e38da2119380dd96faffe2a5d8962

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