Skip to content

Instantly share code, notes, and snippets.

View ftnext's full-sized avatar

nikkie ftnext

View GitHub Profile
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "genai-processors",
# ]
# ///
import asyncio
import os
from genai_processors import content_api, processor, streams
# Copyright 2025 ftnext
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# Shows how to call all the sub-agents using the LLM's reasoning ability. Run this with "adk run" or "adk web"
from pathlib import Path
from google.adk.agents import LlmAgent
from google.adk.tools import google_search
from google.adk.tools.agent_tool import AgentTool
def load_instruction_from_file(filename: str) -> str:
"""Reads instruction text from a file relative to this script."""
# uvx --from google-adk --with litellm adk web
from pathlib import Path
from google.adk.agents import LlmAgent
from google.adk.models.lite_llm import LiteLlm
from google.adk.tools import google_search
from google.adk.tools.agent_tool import AgentTool
def load_instruction_from_file(filename: str) -> str:
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "openai",
# "langsmith",
# "python-dotenv",
# ]
# ///
# before version: https://gist.github.com/ftnext/50f990da0dfb94bc27198ec91039ae9d
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "azure-ai-inference",
# ]
# ///
import os
from azure.ai.inference import ChatCompletionsClient
from azure.ai.inference.models import SystemMessage, UserMessage
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "langchain-azure-ai",
# ]
# ///
import os
from langchain_azure_ai.chat_models import AzureAIChatCompletionsModel
from langchain_core.messages import HumanMessage, SystemMessage
from google.adk.agents.remote_a2a_agent import RemoteA2aAgent
root_agent = RemoteA2aAgent(
name="Parrot_Agent", agent_card="http://0.0.0.0:9999/.well-known/agent.json"
)
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "fastapi",
# "uvicorn",
# ]
# ///
import json
from typing import Literal
from uuid import uuid4
FROM ghcr.io/astral-sh/uv:python3.12-bookworm AS builder
WORKDIR /app
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-dev
FROM python:3.12-slim-bookworm