OneLi ב־Google ADK
איך נותנים לסוכן שבנוי ב־Google ADK לבצע שיחות טלפון בעברית דרך OneLi, לעקוב אחרי השיחה, לענות להתייעצויות ולקבל את התוצאה.
ב־Google ADK מוסיפים לסוכן McpToolset עם StreamableHTTPConnectionParams וכותרת Authorization. אפשר גם להעביר פונקציית Python רגילה ככלי.
התקנה
- יוצרים מפתח API ב־oneli.io/app/connect ושומרים אותו במשתנה הסביבה
ONELI_API_KEYבשרת. - מתקינים את החבילות:
Terminal
pip install google-adkנבדק מול: google-adk 2.12.0 (Python) · @google/adk 2.3.0 (TS)
MCP, עם חלופת REST
Python
import os, uuid, httpx
from google.adk.agents import LlmAgent
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams
def create_call_task(to_number: str, goal: str, instructions: str = "") -> dict:
"""Places an AI phone call via OneLi. Args: to_number: E.164. goal: what the call must achieve."""
body = {"idempotency_key": str(uuid.uuid4()), "to_number": to_number, "goal": goal}
if instructions: body["instructions"] = instructions
r = httpx.post("https://api.oneli.io/v1/call-tasks", json=body,
headers={"Authorization": f"Bearer {os.environ['ONELI_API_KEY']}"}, timeout=30)
return {"status": "success" if r.is_success else "error", "result": r.json()}
root_agent = LlmAgent(
model="gemini-2.5-flash", name="oneli_agent",
instruction="Use OneLi tools to place and track phone calls.",
tools=[McpToolset(connection_params=StreamableHTTPConnectionParams(
url="https://mcp.oneli.io/mcp",
headers={"Authorization": f"Bearer {os.environ['ONELI_API_KEY']}"}, timeout=30))],
# REST variant: tools=[create_call_task]
)שימו לב
- ב־Python המחלקה היא McpToolset; ב־TypeScript MCPToolset עם transportOptions: { requestInit: { headers } }.
- מחוץ ל־adk web קוראים ל־await toolset.close().
- בתיעוד של Java מופיע רק stdio.
מספרי טלפון: OneLi מקבלת מספר ישראלי בכל פורמט נפוץ (050-1234567, +972501234567). כשהשיחה מתחילה, הסוכן ממשיך עם get_call_events או עם GET /v1/call-tasks/:id/events כדי לעקוב, לענות להתייעצויות ולקבל את הסיכום.
מה הלאה
מקורות: adk.dev/tools-custom/mcp-tools/ · adk.dev/tools-custom/function-tools/