Examples
Copy-ready ways to give an agent Qurren's facts. Each one reads your key from QURREN_API_KEY. With an MCP-capable framework, the hosted MCP server is the shortest path; otherwise wrap the REST endpoints as tools.
Claude Agent SDK
The hosted MCP server, allowed for the agent with one wildcard.
TypeScript · npm install @anthropic-ai/claude-agent-sdk
import { query } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({
prompt: "Upgrade the dependencies in package.json to current majors and fix what breaks",
options: {
mcpServers: {
qurren: {
type: "http",
url: "https://api.qurren.com/mcp",
headers: { Authorization: `Bearer ${process.env.QURREN_API_KEY}` },
},
},
allowedTools: ["mcp__qurren__*"],
},
})) {
if (message.type === "result" && message.subtype === "success") console.log(message.result);
}OpenAI Agents SDK
Python, with the hosted MCP server over streamable HTTP.
Python · pip install openai-agents
import asyncio, os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp
async def main():
async with MCPServerStreamableHttp(
name="qurren",
params={
"url": "https://api.qurren.com/mcp",
"headers": {"Authorization": f"Bearer {os.environ['QURREN_API_KEY']}"},
},
) as qurren:
agent = Agent(
name="Coder",
instructions="Before writing model names, package versions, Actions or runtimes, check them with the qurren tools.",
mcp_servers=[qurren],
)
result = await Runner.run(agent, "Which Node.js LTS should our Dockerfile use, and which image tag?")
print(result.final_output)
asyncio.run(main())Vercel AI SDK
Two REST endpoints as tools; the model calls them when it needs a current version.
TypeScript · npm install ai zod
import { generateText, stepCountIs, tool } from "ai";
import { z } from "zod";
const qurren = (path: string, init?: RequestInit) =>
fetch(`https://api.qurren.com${path}`, {
...init,
headers: { authorization: `Bearer ${process.env.QURREN_API_KEY}`, "content-type": "application/json" },
}).then((r) => r.json());
const { text } = await generateText({
model: "anthropic/claude-sonnet-5-5",
tools: {
checkPackage: tool({
description: "Current version, install command and common agent mistakes for an npm or PyPI package",
inputSchema: z.object({ name: z.string(), ecosystem: z.enum(["npm", "pypi"]).default("npm") }),
execute: ({ name, ecosystem }) => qurren(`/v1/packages/${name}?ecosystem=${ecosystem}`),
}),
currentFacts: tool({
description: "Today's AI model names, runtime LTS versions and GitHub Actions majors",
inputSchema: z.object({ topic: z.enum(["all", "models", "runtimes", "github-actions"]).default("all") }),
execute: ({ topic }) => qurren(`/v1/facts?topic=${topic}`),
}),
},
stopWhen: stepCountIs(5),
prompt: "Write the install command for the current Next.js and the newest Claude Sonnet model ID.",
});
console.log(text);LangChain
Python tools over the REST API; works with any chat model LangChain supports.
Python · pip install langchain langchain-anthropic requests
import os, requests
from langchain.agents import create_agent
from langchain_core.tools import tool
API = "https://api.qurren.com"
H = {"Authorization": f"Bearer {os.environ['QURREN_API_KEY']}"}
@tool
def check_package(name: str, ecosystem: str = "npm") -> dict:
"""Current version, install command and common agent mistakes for an npm or PyPI package."""
return requests.get(f"{API}/v1/packages/{name}", params={"ecosystem": ecosystem}, headers=H, timeout=20).json()
@tool
def check_project(files: dict[str, str]) -> dict:
"""Find outdated majors, retired AI models, old GitHub Actions and end-of-life runtimes. files: path -> file text."""
return requests.post(f"{API}/v1/check", json={"files": files}, headers=H, timeout=60).json()
agent = create_agent(model="anthropic:claude-sonnet-5-5", tools=[check_package, check_project])
out = agent.invoke({"messages": [{"role": "user", "content": "Is pydantic 1.10 still current? What should I install?"}]})
print(out["messages"][-1].content)curl
Facts, a package, a project check, a request check
export QURREN_API_KEY=qk_live_…
curl "https://api.qurren.com/v1/facts?topic=models" -H "Authorization: Bearer $QURREN_API_KEY"
curl "https://api.qurren.com/v1/packages/zod" -H "Authorization: Bearer $QURREN_API_KEY"
curl -X POST "https://api.qurren.com/v1/check" -H "Authorization: Bearer $QURREN_API_KEY" \
-H "content-type: application/json" \
--data "{\"files\": {\"package.json\": $(jq -Rs . < package.json)}}"
curl -X POST "https://api.qurren.com/v1/requests/check" -H "Authorization: Bearer $QURREN_API_KEY" \
-H "content-type: application/json" \
-d '{"body": {"model": "claude-sonnet-4-5", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hi"}]}}'