Get Started
Examples
Concepts
Resources
Projects
Integrations
API Reference
Interfaze as Tools
copy markdown
You can wire any Interfaze capability directly as a tool inside your existing agent. Your main model decides when to call it, Interfaze runs the task, and the result comes back as clean structured JSON — no extra infrastructure required.
This works by combining run-task mode with your SDK's tool-calling primitives.
Available tasks
The Interfaze SDK exposes one typed function per task, so each tool executor is a single call.
| Task | Interfaze SDK | What it does |
|---|---|---|
ocr | tasks.ocr(url) | Extract text and structured data from images or documents |
object_detection | tasks.objectDetection(url) | Detect and locate objects in images |
web_search | tasks.webSearch(query) | Real-time web search with sources |
scraper | tasks.scrape(url) | Extract structured content from any web page |
speech_to_text | tasks.transcribe(url) | Transcribe audio files |
translate | tasks.translate(text, { to }) | Translate text between languages |
Python uses snake_case for the same functions, so tasks.objectDetection becomes tasks.object_detection and tasks.webSearch becomes tasks.web_search.
Calling Interfaze
Interfaze SDK
Vercel AI SDK
LangChain SDK
import { Interfaze } from "interfaze";
const interfaze = new Interfaze({ apiKey: process.env.INTERFAZE_API_KEY });
// each task takes a source and returns the raw result your agent can reason over
const text = await interfaze.tasks.ocr("https://arxiv.org/pdf/2602.04101");
const results = await interfaze.tasks.webSearch("GLP-1 research paper");
const transcript = await interfaze.tasks.transcribe("https://example.com/call.mp3");OCR — extract text from documents
Register OCR as a tool. Your agent calls it when it encounters a document or image URL and gets back clean structured text.
Interfaze SDK
Vercel AI SDK
LangChain SDK
import { Interfaze } from "interfaze";
import OpenAI from "openai";
const interfaze = new Interfaze({ apiKey: process.env.INTERFAZE_API_KEY });
const model = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const ocrTool = {
type: "function" as const,
function: {
name: "ocr",
description: "Extract text and structured data from images or documents.",
parameters: {
type: "object",
properties: {
url: { type: "string", description: "URL of the image or document." },
},
required: ["url"],
},
},
};
const messages: OpenAI.ChatCompletionMessageParam[] = [
{
role: "user",
content: "Extract the title, authors, and abstract from: https://arxiv.org/pdf/2602.04101",
},
];
const res = await model.chat.completions.create({
model: "gpt-4o",
messages,
tools: [ocrTool],
tool_choice: "auto",
});
messages.push(res.choices[0].message);
for (const call of res.choices[0].message.tool_calls ?? []) {
const { url } = JSON.parse(call.function.arguments);
const result = await interfaze.tasks.ocr(url);
messages.push({ role: "tool", tool_call_id: call.id, content: JSON.stringify(result) });
}
const final = await model.chat.completions.create({ model: "gpt-4o", messages });
console.log(final.choices[0].message.content);Web search — live data at runtime
Give your agent access to real-time information. It can look up current events, check documentation, or verify facts before responding.
Interfaze SDK
Vercel AI SDK
LangChain SDK
import { Interfaze } from "interfaze";
import OpenAI from "openai";
const interfaze = new Interfaze({ apiKey: process.env.INTERFAZE_API_KEY });
const model = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const webSearchTool = {
type: "function" as const,
function: {
name: "web_search",
description: "Search the web for real-time information.",
parameters: {
type: "object",
properties: {
query: { type: "string", description: "The search query." },
},
required: ["query"],
},
},
};
const messages: OpenAI.ChatCompletionMessageParam[] = [
{ role: "user", content: "What are the latest updates to the OpenAI API?" },
];
const res = await model.chat.completions.create({
model: "gpt-4o",
messages,
tools: [webSearchTool],
tool_choice: "auto",
});
messages.push(res.choices[0].message);
for (const call of res.choices[0].message.tool_calls ?? []) {
const { query } = JSON.parse(call.function.arguments);
const result = await interfaze.tasks.webSearch(query);
messages.push({ role: "tool", tool_call_id: call.id, content: JSON.stringify(result) });
}
const final = await model.chat.completions.create({ model: "gpt-4o", messages });
console.log(final.choices[0].message.content);Speech-to-text — transcribe audio files
Register speech-to-text as a tool. Pass any audio URL and your agent gets a full transcript to summarize, extract action items from, or reason over.
Interfaze SDK
Vercel AI SDK
LangChain SDK
import { Interfaze } from "interfaze";
import OpenAI from "openai";
const interfaze = new Interfaze({ apiKey: process.env.INTERFAZE_API_KEY });
const model = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const sttTool = {
type: "function" as const,
function: {
name: "speech_to_text",
description: "Transcribe an audio file to text.",
parameters: {
type: "object",
properties: {
audio_url: { type: "string", description: "URL of the audio file." },
},
required: ["audio_url"],
},
},
};
const messages: OpenAI.ChatCompletionMessageParam[] = [
{
role: "user",
content: "Summarize this call and list any follow-up items: https://r2public.jigsawstack.com/interfaze/examples/stt_call.mp3",
},
];
const res = await model.chat.completions.create({
model: "gpt-4o",
messages,
tools: [sttTool],
tool_choice: "auto",
});
messages.push(res.choices[0].message);
for (const call of res.choices[0].message.tool_calls ?? []) {
const { audio_url } = JSON.parse(call.function.arguments);
const result = await interfaze.tasks.transcribe(audio_url);
messages.push({ role: "tool", tool_call_id: call.id, content: JSON.stringify(result) });
}
const final = await model.chat.completions.create({ model: "gpt-4o", messages });
console.log(final.choices[0].message.content);Combining multiple tools
You can register any combination of tasks as tools. The agent picks whichever it needs based on the request.
Interfaze SDK
Vercel AI SDK
import { Interfaze } from "interfaze";
import OpenAI from "openai";
const interfaze = new Interfaze({ apiKey: process.env.INTERFAZE_API_KEY });
const model = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const tools: OpenAI.ChatCompletionTool[] = [
{
type: "function",
function: {
name: "ocr",
description: "Extract text and structured data from images or documents.",
parameters: {
type: "object",
properties: { url: { type: "string" } },
required: ["url"],
},
},
},
{
type: "function",
function: {
name: "web_search",
description: "Search the web for real-time information.",
parameters: {
type: "object",
properties: { query: { type: "string" } },
required: ["query"],
},
},
},
{
type: "function",
function: {
name: "speech_to_text",
description: "Transcribe an audio file to text.",
parameters: {
type: "object",
properties: { audio_url: { type: "string" } },
required: ["audio_url"],
},
},
},
];
const taskMap: Record<string, (args: Record<string, string>) => Promise<unknown>> = {
ocr: ({ url }) => interfaze.tasks.ocr(url),
web_search: ({ query }) => interfaze.tasks.webSearch(query),
speech_to_text: ({ audio_url }) => interfaze.tasks.transcribe(audio_url),
};
const messages: OpenAI.ChatCompletionMessageParam[] = [
{ role: "user", content: "Search for the latest news on AI agents and summarize the top results." },
];
let res = await model.chat.completions.create({ model: "gpt-4o", messages, tools, tool_choice: "auto" });
messages.push(res.choices[0].message);
while (res.choices[0].message.tool_calls?.length) {
for (const call of res.choices[0].message.tool_calls) {
const args = JSON.parse(call.function.arguments);
const result = await taskMap[call.function.name](args);
messages.push({ role: "tool", tool_call_id: call.id, content: JSON.stringify(result) });
}
res = await model.chat.completions.create({ model: "gpt-4o", messages, tools, tool_choice: "auto" });
messages.push(res.choices[0].message);
}
console.log(res.choices[0].message.content);