OneLi with Google ADK
How to let an agent built with Google ADK place Hebrew phone calls through OneLi, follow the call, answer consultations and read the result.
In Google ADK, add an McpToolset with StreamableHTTPConnectionParams and an Authorization header to the agent. A plain Python function also works as a tool.
Setup
- Create an API key at oneli.io/app/connect and store it on the server as
ONELI_API_KEY. - Install the packages:
Terminal
pip install google-adkChecked against: google-adk 2.12.0 (Python) · @google/adk 2.3.0 (TS)
MCP, with a REST alternative
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]
)Notes
- The Python class is McpToolset; TypeScript uses MCPToolset with transportOptions: { requestInit: { headers } }.
- Outside adk web, call await toolset.close().
- The Java docs show stdio only.
Phone numbers: OneLi accepts an Israeli number in any common format (050-1234567, +972501234567). Once the call starts, the agent follows it with get_call_events or GET /v1/call-tasks/:id/events to answer consultations and get the summary.
Next steps
Sources: adk.dev/tools-custom/mcp-tools/ · adk.dev/tools-custom/function-tools/