AI agents · OpenClaw · self-hosting · automation

Quick Answer

Chatbot Agent Frameworks: Tool Calling, DB, API and Auth

Published:

The short answer

Every serious agent framework does tool calling; the real differences are how cleanly each one carries the authenticated user into those tools, and which language your team writes. As of November 29, 2026:

  • Pydantic AI (Python, v2.77.0, November 27, 2026): the cleanest typed dependency injection, so the user, database pool and HTTP client reach every tool without globals.
  • OpenAI Agents SDK (Python, v0.26.0, November 24, 2026): a typed run context that is never sent to the model, plus hand-offs, guardrails and tracing.
  • LangGraph (about 45,500 GitHub stars): the pick for long, stateful flows with checkpoints and human approval before risky tool calls.
  • Mastra (TypeScript, @mastra/core 1.86.0, November 25, 2026): agents, tools, workflows and memory for Node and Next.js teams.
  • Google ADK for Python (v2.15.1, November 25, 2026): multi-agent apps with built-in evaluation, deployed on Google Cloud.

None of these frameworks is an authentication system. Users sign in through your app (Auth0, Clerk, WorkOS, Cognito or your own); the framework’s job is to pass that identity into tools. For agents that act on third-party APIs on a user’s behalf, see the best auth platforms for AI agents and MCP servers.

The comparison

FrameworkLanguageLatest release (checked Nov 29, 2026)GitHub starsHow user context reaches toolsBest for
Pydantic AIPythonv2.77.0 (Nov 27)~21,400Typed deps via RunContextTyped tools, FastAPI backends
OpenAI Agents SDKPython (JS port exists)v0.26.0 (Nov 24)~30,900RunContextWrapper[T], not sent to the LLMHand-offs, guardrails, tracing
LangGraphPython, JSCLI 0.4.44 (Nov 25)~45,500Graph state + config, checkpointerStateful flows, human approval
MastraTypeScript@mastra/core 1.86.0 (Nov 25)~29,900Runtime context passed to toolsNode and Next.js apps
Google ADKPython (Go, Java too)v2.15.1 (Nov 25)~22,400Session state and tool contextMulti-agent apps on Google Cloud
Vercel AI SDKTypeScriptcontinuous releases~28,300Closure or arguments in toolsChat UI and streaming layer

Release tags and star counts were read from GitHub on November 29, 2026.

The pattern that keeps data safe

The same four-step pattern works in every framework:

  1. Authenticate in the app, not the agent. Your API route verifies the session or JWT and resolves user_id, tenant_id and scopes.
  2. Put identity in the run context. Pass it as the OpenAI Agents SDK context object or Pydantic AI deps. The OpenAI documentation is explicit that the context object “is not sent to the LLM”; it is a local object your tools read.
  3. Write narrow tools. get_invoice(invoice_id) runs a parameterised query with WHERE tenant_id = :tenant taken from context, not from the model’s arguments. A model cannot talk its way past a filter it never controls.
  4. Call external APIs with the user’s token. Store OAuth tokens server-side, look them up by user_id inside the tool, and refresh them there. The token never appears in the prompt or the transcript.

Add database-level protection behind that: a read-only role for lookup tools, Postgres row-level security keyed on the tenant, and an approval step (LangGraph interrupts, or the Agents SDK’s tool approval) before tools that write, pay or send.

Database and API access in practice

  • SQL databases: wrap queries in tools; avoid giving a customer-facing bot an open SQL tool. For analyst-style questions over a warehouse, a text-to-SQL layer on a read-only replica is safer.
  • REST and GraphQL APIs: one tool per operation with typed arguments (Pydantic models in Python, Zod schemas in Mastra and the AI SDK), so invalid calls fail before they reach the API.
  • MCP servers: all five frameworks can call Model Context Protocol tools, which lets you reuse one tool server across chatbots. Authenticate the MCP connection per user rather than with one shared key.

How to choose

  1. Python, typed codebase, FastAPI → Pydantic AI.
  2. Python, several specialised agents with hand-offs and tracing → OpenAI Agents SDK.
  3. Long-running flows, approvals, resumable state → LangGraph.
  4. TypeScript or Next.js → Mastra for agents, Vercel AI SDK for the chat UI.
  5. Google Cloud and Vertex AI → ADK.
  6. Java or Kotlin → see Spring AI vs LangChain4j vs Koog.

For a broader ranking of agent frameworks, see the best AI agent frameworks in 2026.

Last verified: November 29, 2026.

Sources