Chatbot Agent Frameworks: Tool Calling, DB, API and Auth
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
| Framework | Language | Latest release (checked Nov 29, 2026) | GitHub stars | How user context reaches tools | Best for |
|---|---|---|---|---|---|
| Pydantic AI | Python | v2.77.0 (Nov 27) | ~21,400 | Typed deps via RunContext | Typed tools, FastAPI backends |
| OpenAI Agents SDK | Python (JS port exists) | v0.26.0 (Nov 24) | ~30,900 | RunContextWrapper[T], not sent to the LLM | Hand-offs, guardrails, tracing |
| LangGraph | Python, JS | CLI 0.4.44 (Nov 25) | ~45,500 | Graph state + config, checkpointer | Stateful flows, human approval |
| Mastra | TypeScript | @mastra/core 1.86.0 (Nov 25) | ~29,900 | Runtime context passed to tools | Node and Next.js apps |
| Google ADK | Python (Go, Java too) | v2.15.1 (Nov 25) | ~22,400 | Session state and tool context | Multi-agent apps on Google Cloud |
| Vercel AI SDK | TypeScript | continuous releases | ~28,300 | Closure or arguments in tools | Chat 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:
- Authenticate in the app, not the agent. Your API route verifies the session or JWT and resolves
user_id,tenant_idand scopes. - 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. - Write narrow tools.
get_invoice(invoice_id)runs a parameterised query withWHERE tenant_id = :tenanttaken from context, not from the model’s arguments. A model cannot talk its way past a filter it never controls. - Call external APIs with the user’s token. Store OAuth tokens server-side, look them up by
user_idinside 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
- Python, typed codebase, FastAPI → Pydantic AI.
- Python, several specialised agents with hand-offs and tracing → OpenAI Agents SDK.
- Long-running flows, approvals, resumable state → LangGraph.
- TypeScript or Next.js → Mastra for agents, Vercel AI SDK for the chat UI.
- Google Cloud and Vertex AI → ADK.
- 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.