Repository navigation
VercelAISDK
createAlgentaTools — a factory that connects to your engine's MCP endpoint via
@ai-sdk/mcp's real MCP client and returns an
Algenta-aware AI SDK ToolSet for
generateText / streamText / an Agent, with typed ExecutionReceipt results and
ExecutionBlockedError denials.
npm install algenta-tools ai zodai (^7) and zod (^4) are peer dependencies. Node.js 22+. The only real dependency is
@ai-sdk/mcp (the AI SDK's MCP client moved out of ai itself into that package); deliberately
no algenta-sdk dependency — its hosted-default constants are exactly what this package must
never use.
import { streamText } from "ai";
import { createAlgentaTools } from "algenta-tools";
const tools = await createAlgentaTools({ baseUrl: "http://localhost:8000/mcp", profile: "observe" });
const result = streamText({
model: "openai/gpt-5",
tools,
prompt: "What's the expected value of scenario X?",
});Endpoint resolves from baseUrl → ALGENTA_BASE_URL → http://localhost:8000/mcp (see
Self-Hosted).
All four, per the contract: observe (default) · govern · execute · full
(opt-in). force/override_safety are stripped from every advertised JSON Schema and scrubbed
from forwarded arguments, in every profile.
-
Denials: a blocked
execute_decisionthrowsExecutionBlockedErrorfromexecute()— the AI SDK's native "tool call failed" idiom — carryinggate("idempotency"|"confidence"|"risk_floor"),code, andoverrideHint, so your code branches onerror.gateinstead of re-parsing a message. NoneedsApprovalpause is set — there is no asynchronous approval state to pause on. -
Factory, not a class: an AI SDK
ToolSetis justRecord<string, Tool>— the idiomatic shape in this ecosystem, rather than an invented "toolset" abstraction. -
Bring your own client:
connectAlgentaMCPClientreturns a reusable connected client (multiple profiles, custom headers, OAuth), and thetoolsoption wraps a pre-built tool set with no MCP round trip. -
Try it locally:
pnpm --filter algenta-tools examplerunsexamples/try-it-locally.ts— stub server, real receipts, and a realExecutionBlockedError(the idempotency gate), no engine required. -
Tests: real
@modelcontextprotocol/sdkMcpServerover a realnode:httpsocket —pnpm --filter algenta-tools test.
Full reference: package README
(full outcome mapping table, @ai-sdk/mcp rationale, advanced options).
thyn-ai/algenta-integrations · Apache-2.0 · The Algenta engine is separate, closed-source software — these packages are ordinary Python and TypeScript talking to its public HTTP/MCP APIs. · Support · Security · Discord
Start here
Framework guides
- LangChain
- LlamaIndex
- Pydantic AI
- MS Agent Framework
- Haystack
- LiteLLM
- Ray Serve
- vLLM
- Vercel AI SDK
- n8n
Project