← Back to dashboard

AI Agents — Multi-Provider Developer Guide

What is an AI agent?

The real model

Same loop everywhere; the differentiator is the SDK, the hosting, and how you attach tools — unified by MCP.

xAI Grok (xai-sdk: client-side tool()/tool_result() + server-side web_search/code_execution/mcp()), Anthropic (the Claude API Tool Runner, the Claude Agent SDK with @tool + create_sdk_mcp_server where allowed_tools auto-approves rather than restricts, and the hosted Managed Agents beta), Microsoft's Agent Framework (agent_framework / .NET AIAgent over IChatClient; the SK+AutoGen successor) plus VS Code's Agents (MCP via .vscode/mcp.json), and Google ADK (Agent + functions-as-tools, McpToolset, deploy to Agent Runtime), and the Vercel AI SDK's ToolLoopAgent. MCP is the connector: build one server, every agent consumes it. Its 2026-07-28 spec is stateless, with Streamable HTTP for remote servers. For codeAmani: keep keys server-side, allowlist tools, require human approval before any money-moving action, and bound the loop with step + cost limits.

Four ways to build one — and the connector

Same loop, different SDK + hosting. Tap a card for install, tools, and MCP wiring.

Watch the agent loop run

The single idea behind every agent SDK. Press Run and follow one pass: the agent can’t answer directly, so it reasons, calls a tool, observes the result, reasons again, and only then responds — exactly the flow you wire with Grok, Claude, Microsoft, or Google.

task: “Is checkout ws_CO_123 paid?”
  1. Perceive
    →
  2. Reason
    →
  3. Act
    →
  4. Observe
    →
  5. Respond
↑ Observe loops back to Reason until the agent can answer
Press Run to watch the agent loop: it can't answer directly, so it calls a tool, reads the result, then responds.

Every provider runs this same loop. The tool here is an mpesa MCP server — written once, callable from Grok, Claude, Microsoft, or Google agents. Bound the loop with step + cost limits, and require human approval before any money-moving tool.

Text
 █████╗ ██╗     █████╗  ██████╗ ███████╗███╗   ██╗████████╗███████╗
██╔══██╗██║    ██╔══██╗██╔════╝ ██╔════╝████╗  ██║╚══██╔══╝██╔════╝
███████║██║    ███████║██║  ███╗█████╗  ██╔██╗ ██║   ██║   ███████╗
██╔══██║██║    ██╔══██║██║   ██║██╔══╝  ██║╚██╗██║   ██║   ╚════██║
██║  ██║██║    ██║  ██║╚██████╔╝███████╗██║ ╚████║   ██║   ███████║
╚═╝  ╚═╝╚═╝    ╚═╝  ╚═╝ ╚═════╝ ╚══════╝╚═╝  ╚═══╝   ╚═╝   ╚══════╝

AI Agents — Multi-Provider Developer Guide

Focus: how to build AI agents on the stacks you'll actually reach for: Anthropic (Claude API Tool Runner, Claude Agent SDK, Claude Managed Agents), xAI Grok, Microsoft Agent Framework (+ VS Code agents), Google ADK, and the Vercel AI SDK. Covers their scope, how to wire tools, and the MCP connector that links them all. Grounded in each vendor's official docs and registries; reviewed 2026-10-18.

What an agent actually is

Strip away the hype: an agent is a language model put in a loop with tools. It reads the goal, decides whether it can answer directly or needs a tool, calls the tool, reads the result, and loops until it can give a final answer. Everything else (memory, multi-agent, hosting) is built on top.

The two non-negotiables: tools (what the agent can do: search, query a DB, send an SMS) and stop conditions (when to quit the loop). Get those right and the rest is plumbing.

Who runs the loop?

The first decision is not which model. It is who owns the loop and where tools execute:

You want…Reach forLoop runsTools run
Full control of every messageRaw SDK, manual loopYour codeYour code
Your tools, no loop boilerplateClaude Tool Runner, AI SDK ToolLoopAgent, MS Agent Framework, Google ADKSDK in your processYour code
A ready-made coding/ops agent (files, bash, web)Claude Agent SDKSDK in your processYour machine / container
Anthropic to host the loop and a sandboxClaude Managed Agents (beta)AnthropicPer-session container
Search / code / MCP calls run by the providerxAI server-side toolsxAIxAI
A loop that survives crashes and waits for approvalAI SDK WorkflowAgentDurable workflowYour code

Official Documentation


MCP — the universal connector

Before the providers, learn the thing that ties them together. MCP (Model Context Protocol) is an open standard: an MCP server exposes tools, resources, and prompts, and any MCP-capable agent (client) can consume them. Build your "check M-Pesa status" or "query Supabase" tool once as an MCP server, and every agent below can call it.

What changed in the 2026-07-28 spec

The current revision is 2026-07-28 (the previous one was 2025-11-25). If you wrote MCP code a year ago, these are the changes that matter:

  • MCP is stateless. The initialize handshake and the Mcp-Session-Id header are gone. Every request carries its protocol version and client capabilities in _meta. Servers must implement a new server/discover RPC. Servers that need state across calls pass explicit handles as ordinary tool arguments.
  • Transports: stdio for local subprocesses, Streamable HTTP for remote servers. The old HTTP+SSE transport is formally Deprecated (12-month minimum window), so migrate to Streamable HTTP. SSE resumability (Last-Event-ID) is removed.
  • Deprecated: Roots, Sampling, and Logging. Pass directories as tool parameters, call the model API directly instead of sampling, and log to stderr or OpenTelemetry.
  • Server-initiated requests (elicitation, sampling) are replaced by Multi Round-Trip Requests: the server returns resultType: "input_required" and the client retries with the answers. Every result now carries a resultType.
  • Auth: OAuth stays. Client ID Metadata Documents are preferred, Dynamic Client Registration is deprecated, and clients must validate iss (RFC 9207).
  • Extensions (opt-in, io.modelcontextprotocol/*): MCP Apps (inline UI), Tasks (long-running work, moved out of the core), Skills over MCP, auth extensions. The MCP Registry exists but is officially preview.

SDKs

LanguagePackageVersion (2026-10-18)Notes
TypeScript (v2, current)@modelcontextprotocol/server, @modelcontextprotocol/client2.3.1Split packages; implements the 2026-07-28 spec
TypeScript (v1)@modelcontextprotocol/sdk1.32.1Maintenance branch (v1.x): fixes for at least 6 months after the v2 release
Pythonmcp2.3.0from mcp.server import MCPServer (replaces FastMCP in the README)

A read-only tool server, built once and attachable to every agent below (TypeScript, v2 SDK, ESM):

TypeScript
// mpesa-tools/server.ts   npm i @modelcontextprotocol/server zod
import { McpServer } from "@modelcontextprotocol/server";
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
import { z } from "zod";

const server = new McpServer({ name: "mpesa-tools", version: "1.0.0" });

server.registerTool(
  "mpesa_status",
  {
    description: "Read the recorded status of an M-Pesa STK checkout. Read-only.",
    inputSchema: z.object({ checkout_request_id: z.string().min(10) }),
  },
  async ({ checkout_request_id }) => {
    const row = await lookupCheckout(checkout_request_id); // your DB read
    return row
      ? { content: [{ type: "text", text: JSON.stringify(row) }] }
      : { content: [{ type: "text", text: "not_found" }], isError: true };
  },
);

await server.connect(new StdioServerTransport());

Every provider in this guide speaks MCP. That's the bet: write tools once, reuse everywhere. See the github and supabase guides for first-party MCP servers you can attach today.


1. Anthropic — three ways to build on Claude

Anthropic offers three agent surfaces that differ in who hosts what. Pick the simplest one that does the job.

a) Claude API + Tool Runner (your tools, SDK runs the loop)

The default for a custom-tool agent. The TypeScript SDK's Tool Runner (beta in @anthropic-ai/sdk 0.135) runs the request → execute → loop cycle; you write tool functions. Full example: examples/agent-tool-runner.ts. The manual loop it automates is in examples/agent-loop.ts.

TypeScript
import Anthropic from "@anthropic-ai/sdk";
import { betaZodTool } from "@anthropic-ai/sdk/helpers/beta/zod";
import { z } from "zod";

const client = new Anthropic(); // ANTHROPIC_API_KEY, server-side

const mpesaStatus = betaZodTool({
  name: "mpesa_status",
  description: "Read the recorded status of an M-Pesa STK checkout.",
  inputSchema: z.object({ checkout_request_id: z.string() }),
  run: async ({ checkout_request_id }) => JSON.stringify(await lookupCheckout(checkout_request_id)),
});

const final = await client.beta.messages.toolRunner({
  model: "claude-opus-5-5",
  max_tokens: 16000,
  max_iterations: 10,          // the step cap. Always set it
  tools: [mpesaStatus],
  messages: [{ role: "user", content: "Is checkout ws_CO_123 paid?" }],
});

Three gotchas from the current API:

  • Handle every stop_reason. "tool_use" means run tools; "pause_turn" means a server tool paused, so re-send to continue (the Tool Runner does not auto-resume it); "refusal" means the model declined, so check stop_details instead of retrying blindly. A loop that treats "not tool_use" as "done" silently truncates.
  • Tool errors go back as data: a tool_result with is_error: true, never a thrown exception. And return all results of a turn in one user message, or Claude learns to stop making parallel calls.
  • Current models reject old request shapes. claude-opus-5-5 returns a 400 for temperature, for disabled thinking, and for forced tool_choice (any / tool). Use tool_choice: auto plus a prompt instruction, and control depth with output_config.effort (default medium on Opus 5.5).

b) Claude Agent SDK (a ready-made agent harness)

  • Scope: the harness behind Claude Code, packaged as a library: built-in file / bash / web tools, hooks, permissions, subagents, sessions, and first-class MCP. You host it.
  • Packages: PyPI claude-agent-sdk (0.2.168, Python ≥3.10) and npm @anthropic-ai/claude-agent-sdk (0.3.302).
Python
from claude_agent_sdk import tool, create_sdk_mcp_server, ClaudeAgentOptions, query, ResultMessage

@tool("mpesa_status", "Check an M-Pesa STK payment status", {"checkout_id": str})
async def mpesa_status(args):
    status = await lookup(args["checkout_id"])  # your code
    return {"content": [{"type": "text", "text": status}]}

server = create_sdk_mcp_server(name="mpesa", version="1.0.0", tools=[mpesa_status])

options = ClaudeAgentOptions(
    mcp_servers={"mpesa": server},
    allowed_tools=["mcp__mpesa__mpesa_status"],  # auto-approve this one tool
    disallowed_tools=["Bash"],                    # remove a built-in entirely
    permission_mode="default",
    max_turns=10,
    max_budget_usd=0.50,                          # hard cost cap → result subtype "error_max_budget_usd"
)

async for msg in query(prompt="Is checkout ws_CO_123 paid?", options=options):
    if isinstance(msg, ResultMessage) and msg.subtype == "success":
        print(msg.result)
  • allowed_tools is auto-approval, not a restriction. The docs: tools listed there run without a prompt; unlisted tools "fall through to permissionMode and canUseTool". To restrict availability, use tools=[...] (tools=[] removes every built-in) or disallowed_tools. A bare name like "Bash" removes the tool from Claude's context; a scoped rule like "Bash(rm *)" only denies matching calls.
  • Tool names are mcp__{server}__{tool}; wildcards such as mcp__mpesa__* work.
  • Other options worth knowing: can_use_tool (your own approval callback), hooks, agents (subagent definitions), fallback_model, effort, and resume / fork_session for sessions. Use ClaudeSDKClient instead of query() for multi-turn, bidirectional sessions. The TypeScript names are the camelCase twins (createSdkMcpServer, allowedTools, maxTurns, maxBudgetUsd, canUseTool).
  • Mark read-only tools with annotations=ToolAnnotations(readOnlyHint=True) so Claude can run them in parallel. Tool search is on by default, so large MCP tool sets load lazily.

c) Claude Managed Agents (Anthropic hosts the loop and the sandbox)

Beta (managed-agents-2026-04-01, set automatically by the SDK on client.beta.*). You create a persisted, versioned Agent config once (model, system prompt, tools, MCP servers, skills), then start a Session per run. Each session gets its own container where bash, file, and code tools execute, and streams events back to you. Credentials for MCP servers and CLIs live in vaults and are substituted at egress, never visible in the sandbox. There are also scheduled deployments, rubric-graded outcomes, and multi-agent sessions.

  • Mandatory flow: agents.create() once (store the ID) → sessions.create({ agent: id }) every run. Creating an agent per request accumulates orphaned agents.
  • Reach for it when the work is long-running, needs a workspace, or runs on a schedule, and you would rather not host a sandbox. Availability varies by cloud platform: Bedrock, Vertex, and Foundry use Claude API + tool use instead.

See anthropic for models, prompt caching, and effort.


2. xAI — Grok agents

  • Scope: frontier reasoning plus a strong server-side agentic toolset, where xAI runs the tool loop for you. The current flagship is grok-4.7 (500k context). xAI recommends its Responses API and marks Chat Completions as deprecated. The xai-sdk (gRPC) below is unaffected.
  • Install & a client-side tool (you run the tool):
Python
# pip install xai-sdk   (1.20.0, Python 3.10+)
import json
from pydantic import BaseModel, Field
from xai_sdk import Client
from xai_sdk.chat import system, user, tool, tool_result

client = Client()  # reads XAI_API_KEY

class WeatherReq(BaseModel):
    city: str = Field(description="City name")

def get_weather(city: str) -> str:
    return f"Sunny, 26°C in {city}"

chat = client.chat.create(
    model="grok-4.7",
    messages=[system("You are a helpful assistant.")],
    tools=[tool(name="get_weather", description="Current weather for a city.",
                parameters=WeatherReq.model_json_schema())],
)
chat.append(user("Weather in Nairobi?"))
resp = chat.sample()
chat.append(resp)
for tc in resp.tool_calls:                      # the model asked to call a tool
    args = json.loads(tc.function.arguments)
    chat.append(tool_result(get_weather(**args), tool_call_id=tc.id))  # tool_call_id optional
print(chat.sample().content)                     # final answer after the tool result
  • Server-side tools (xAI runs the loop): pass web_search(), x_search(), code_execution(), collections_search(), image_generation(), or mcp(...) into tools=. mcp() takes server_url, server_label (prefixes tool names), allowed_tool_names (an allowlist), authorization, and extra_headers.
Python
from xai_sdk.tools import web_search, code_execution, mcp
chat = client.chat.create(model="grok-4.7", tools=[
    web_search(), code_execution(),
    mcp(server_url="https://mcp.example.com", server_label="mpesa",
        allowed_tool_names=["mpesa_status"], authorization="Bearer TOKEN"),
])
  • Gotchas: server-side tools are billed per call on top of tokens (web_search and code_execution are $5 per 1k calls). Parallel tool calls are on by default, so resolve them all before the next request. Keep XAI_API_KEY server-side. For a TypeScript Grok agent on the AI SDK (Responses API, store: false, cost metering), see grok-chatbot.

3. Microsoft — Agent Framework + VS Code agents

a) Build agents in code — Microsoft Agent Framework

The direct successor to Semantic Kernel and AutoGen (same teams). It is GA in Python (agent-framework 1.22.0, Python ≥3.10) and .NET (Microsoft.Agents.AI 1.25.0). Go is public preview (github.com/microsoft/agent-framework-go v0.1.1). It covers agents, functional and graph-based workflows, session state, middleware and telemetry, MCP, and a newer Harness Agent (planning, context compaction, file and memory access, tool approval).

Python
# pip install agent-framework
from typing import Annotated
from pydantic import Field
from agent_framework import Agent, tool
from agent_framework.openai import OpenAIChatClient   # or foundry.FoundryChatClient, anthropic.AnthropicClient

@tool(approval_mode="never_require")                 # read-only → no approval prompt
def get_weather(location: Annotated[str, Field(description="City name")]) -> str:
    """Get the weather for a location."""
    return f"Sunny, 26°C in {location}"

agent = Agent(
    client=OpenAIChatClient(),
    name="SupportAgent",
    instructions="You are codeAmani's Swahili-fluent support agent.",
    tools=[get_weather],
)
result = await agent.run("Habari ya hali ya hewa Nairobi?")
print(result.text)
  • Providers: OpenAI, Foundry (FoundryChatClient; prefer it over the older agent-framework-azure-ai), Azure OpenAI, Ollama, and Anthropic (from agent_framework.anthropic import AnthropicClient). The Anthropic package agent-framework-anthropic is still beta, so install it with --pre. A separate ClaudeAgent wraps the Claude Agent SDK runtime. Since rc6 the model parameter is model=, not model_id=. Python doesn't auto-load .env, so call load_dotenv().
  • MCP: MCPStdioTool (local process), MCPStreamableHTTPTool (remote; static_headers / header_provider), and MCPWebsocketTool, passed in tools=[...]. Hosted MCP is available via client.get_mcp_tool(...) on the Anthropic and Foundry clients.
  • .NET: the base type is AIAgent. ChatClientAgent wraps any IChatClient, and A2AAgent, CopilotStudioAgent, GitHubCopilotAgent, and DurableAIAgent derive from the same base. The Foundry, A2A, and CopilotStudio packages still ship as preview, so pin versions.

b) Drive an agent in the IDE — VS Code

VS Code's docs now say agents rather than "agent mode": pick the Agent (or the Plan agent) in the chat session controls. Enable MCP tools with the Configure Tools button, reference tools with # (e.g. #fetch), and invoke MCP prompts as /<server>.<prompt>.

JSON
// .vscode/mcp.json  (top-level key is "servers"; .mcp.json files use "mcpServers")
{
  "inputs": [
    { "type": "promptString", "id": "mpesa-token", "description": "M-Pesa tools token", "password": true }
  ],
  "servers": {
    "mpesa": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "mpesa-mcp"],
      "env": { "MPESA_TOOLS_TOKEN": "${input:mpesa-token}" }
    },
    "github": { "type": "http", "url": "https://api.githubcopilot.com/mcp" }
  }
}
  • Gotcha: never commit a token into mcp.json. Use inputs (prompted, stored securely) or envFile. Treat IDE agent tools like production access and require approval for file writes and shell.

4. Google — Agent Development Kit (ADK)

  • Scope: an open, code-first agent toolkit, Gemini-optimised but model-agnostic, with graph workflows since ADK 2.0. SDKs: Python (google-adk 2.12.0, Python ≥3.11), TypeScript (@google/adk 2.3.0), Go (google.golang.org/adk/v2), Java (com.google.adk:google-adk), and Kotlin (new). Docs moved to adk.dev.
  • Quickstart agent (the official one uses the adk create / adk run / adk web CLI; a runner is shown for in-process use):
Python
# pip install google-adk
from google.adk.agents import Agent
from google.adk.runners import InMemoryRunner

def get_weather(city: str) -> dict:
    """Current weather for a city.  (the docstring is the tool's description)"""
    return {"status": "success", "report": f"Sunny, 26°C in {city}"}

root_agent = Agent(
    name="weather_agent",
    model="gemini-flash-latest",   # the string the official quickstart uses
    description="Answers weather questions.",
    instruction="Use the get_weather tool to answer.",
    tools=[get_weather],           # plain Python functions; docstring + type hints = schema
)

runner = InMemoryRunner(agent=root_agent, app_name="weather")
  • MCP wiring: the connection params live in the mcp_session_manager submodule:
Python
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import (
    StdioConnectionParams, StreamableHTTPConnectionParams,
)
from mcp import StdioServerParameters

tools = [
    McpToolset(  # local server over stdio
        connection_params=StdioConnectionParams(
            server_params=StdioServerParameters(command="npx", args=["-y", "mpesa-mcp"]),
        ),
        tool_filter=["mpesa_status"],               # expose only what the agent needs
    ),
    McpToolset(  # remote server: prefer Streamable HTTP over SseConnectionParams
        connection_params=StreamableHTTPConnectionParams(
            url="https://mcp.example.com/mcp", headers={"Authorization": "Bearer TOKEN"},
        ),
    ),
]
  • Deploy: Google now calls the hosting product Agent Runtime on the Gemini Enterprise / Google Cloud Agent Platform (formerly Vertex AI Agent Engine; https://adk.dev/deploy/agent-runtime/). The CLI command is unchanged: adk deploy agent_engine --project=… --region=… <agent_dir>. To route Gemini through Google Cloud, set GOOGLE_GENAI_USE_ENTERPRISE=True with GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION. The old GOOGLE_GENAI_USE_VERTEXAI still works as a legacy alias.
  • Memory: VertexAiMemoryBankService(project=…, location=…, agent_engine_id=…) passed to Runner(memory_service=...).
  • A2A (agent-to-agent): expose an agent with to_a2a(root_agent, port=8001) and consume one with RemoteA2aAgent(...). Marked experimental; Python, Go, and Java (not TypeScript).
  • Gotcha: ADK reads your function's docstring + type hints as the tool schema, so write them well. Region-pin for data residency (KDPA).

5. Vercel AI SDK — agents in a Next.js app

For codeAmani's Next.js apps, AI SDK 7 (ai 7.x) gives you a provider-agnostic agent class, so you can swap Claude, Grok, or Gemini without rewriting the loop. Full example: examples/agent-loop-vercel.ts.

TypeScript
import { ToolLoopAgent, isStepCount } from "ai";
import { anthropic } from "@ai-sdk/anthropic";

export const supportAgent = new ToolLoopAgent({
  model: anthropic("claude-opus-5-5"),
  instructions: "Answer from tools; never guess payment status.",
  tools: { mpesaStatus },          // tool({ description, inputSchema, execute })
  stopWhen: isStepCount(10),
});

const { text } = await supportAgent.generate({ prompt: "Is ws_CO_123 paid?" });

Step limits differ by entry point, so always set stopWhen explicitly:

Entry pointDefault stopConsequence if you forget
generateText / streamTextisStepCount(1)Stops after the first tool call and returns an empty answer
ToolLoopAgentisStepCount(20)Logs a warning when it hits the cap
WorkflowAgent (@ai-sdk/workflow)noneRuns until the model stops calling tools

WorkflowAgent is the durable variant. Each tool call is a workflow step with retries, the run survives a crash, and needsApproval tools suspend for a human and resume later. That is the right shape for an agent that must wait for an approval before an M-Pesa payout.


Choosing a stack

Claude (Tool Runner / Agent SDK / Managed)xAI GrokMS Agent FrameworkGoogle ADKVercel AI SDK
LanguageTS / Python (+ more SDKs)Python / RESTPython / .NET / Go (preview)Python / TS / Go / Java / KotlinTypeScript
Toolsfunctions, MCP, built-insclient + server-sidefunctions + MCPfunctions + MCPfunctions (+ MCP adapter)
MCPmcp_servers / Managed vaultsmcp() toolMCPStdioTool / MCPStreamableHTTPToolMcpToolsetvia MCP client
Hostingyour infra, or Anthropic (Managed)xAI APIAzure / your infraAgent Runtime / your infraVercel / your infra
Multi-agentsubagents, multi-agent sessionsDIYgraph + functional workflowsagent hierarchies, A2Asubagents, workflows
Best forcoding/ops agents, guardrails, hosted sandboxeslive web/X research.NET/Azure shopsGemini + GCP-nativeNext.js apps, provider swaps

Rule of thumb for codeAmani: Claude for anything agentic with real consequences (Tool Runner in apps, Agent SDK for ops, Managed Agents when you want Anthropic to host the sandbox); the AI SDK ToolLoopAgent in Next.js when provider portability matters; Grok for live web/X research; ADK when you're already on GCP/Gemini; Microsoft when the stack is .NET/Azure.


Capabilities & scope (what to expect)

  • Tools: the agent's hands. Anything you can call from code can be a tool (HTTP, DB, M-Pesa, SMS). Keep each tool small, typed, and documented. The model chooses tools from their descriptions.
  • Memory & state: short-term (the conversation) vs long-term (ADK Memory Bank, Managed Agents memory stores, a vector store — see pinecone/pgvector).
  • Multi-agent: split work across specialised agents (planner → workers → reviewer). Every stack supports it; graph workflows (Microsoft, ADK 2.0) make the control flow explicit.
  • Human-in-the-loop: gate risky actions behind approval (can_use_tool, approval_mode, AI SDK needsApproval in a WorkflowAgent). Non-negotiable for anything that moves money or writes to prod.
  • What agents are bad at: unbounded loops (set step limits and cost caps) and silent failure (log every tool call + result, and handle refusal / pause_turn).

codeAmani notes

  • Secrets stay server-side. Model keys (XAI_API_KEY, ANTHROPIC_API_KEY, Google ADC, Azure creds) and tool credentials live in Hazina / env managers (infisical), never in client code, prompts, or a committed mcp.json. MCP servers that touch money or PII run server-side only.
  • Allowlist + approve. Auto-approve only safe, read-only tools for unattended runs. In the Claude Agent SDK, remember that allowed_tools approves rather than restricts, so also set tools / disallowed_tools. Require human approval before any agent action that triggers an M-Pesa transfer, deletes data, or deploys.
  • Bound the loop. Cap steps (max_iterations, max_turns, stopWhen) and spend (max_budget_usd in the Agent SDK; track usage elsewhere). An agent in a tool loop can burn spend fast. Log every tool call + result for audit.
  • AI routing. House policy: complex reasoning/coding → Claude (claude-opus-5-5 default; claude-sonnet-5-5 cheaper; claude-haiku-5-5 for high-volume dispatch); GCP/Gemini-native + managed memory → ADK; live web/X research → Grok; structured/function-calling-heavy flows → whichever SDK fits the runtime. Build shared tools as MCP servers so the choice of agent stays swappable.
  • MCP hygiene. Target the 2026-07-28 spec for new servers: Streamable HTTP for remote, no reliance on sessions, Sampling, or Roots. Keep tools read-only by default and expose write tools behind a separate server you can leave unattached.
  • African market. A Swahili-fluent support agent with an mpesa MCP tool (check status, send receipt) is a high-leverage first build. Keep the callback + reconciliation idempotent (see daraja + webhooks), and region-pin hosted agents (africa-south1 / europe-west1) for latency + residency. For the customer-facing WhatsApp side, see grok-chatbot.