The Vercel AI SDK makes it easy to build AI-powered web applications with streaming, tool calling, and multi-step interactions. Adding RentAHuman tools lets your app's AI assistant help users hire humans for physical tasks, all within a chat interface.
Define the Tools
typescript
import { tool } from "ai";
import { z } from "zod";
const searchHumans = tool({
description: "Search for humans on RentAHuman with specific skills",
parameters: z.object({
skill: z.string().describe("The skill to search for"),
city: z.string().optional().describe("Filter by city"),
maxRate: z.number().optional().describe("Maximum hourly rate"),
}),
execute: async ({ skill, city, maxRate }) => {
const params = new URLSearchParams({ skill, limit: "5" });
if (city) params.set("city", city);
if (maxRate) params.set("maxRate", String(maxRate));
const res = await fetch(
`https://rentahuman.ai/api/humans?${params}`,
{ headers: { "X-API-Key": process.env.RENTAHUMAN_API_KEY! } }
);
return res.json();
},
});Use in Your Route Handler
Your users can now chat with an AI assistant that searches for and hires humans, all within your Next.js app.
typescript
import { streamText } from "ai";
import { openai } from "@ai-sdk/openai";
export async function POST(req: Request) {
const { messages } = await req.json();
const result = streamText({
model: openai("gpt-4o"),
messages,
tools: { searchHumans, createBounty },
system: "You help users hire humans for physical tasks via RentAHuman.",
});
return result.toDataStreamResponse();
}Build full-stack apps where AI meets the physical world. Vercel AI SDK + RentAHuman = your users can hire anyone, anywhere.
Ready to get started? Set up in under 5 minutes or explore the MCP tools.