Agent Calls
DocsAn agent is focused model-backed code with a clear task. This demo compares three ways a route can call that code: wait for a direct result, hand work to the background, or chain one focused step into the next. The caller owns timing; the agent owns the task.
Select a call shape and operation, then click Run to see agent calls in action.
Call Pattern
Operation
Sample Text
Hello!!! from the ***SDK Explorer***... #demo @test
Reference Code
import { Hono } from "hono";
import { z } from "zod";
const ClassifyInput = z.object({
message: z.string().min(1),
});
async function classifyIntent(message: string): Promise<"sales" | "support"> {
return message.toLowerCase().includes("price") ? "sales" : "support";
}
async function draftReply(message: string, intent: "sales" | "support") {
return {
intent,
reply:
intent === "sales"
? "A teammate can help with pricing."
: "A teammate can help troubleshoot this.",
original: message,
};
}
const app = new Hono();
app.post("/api/triage", async (c) => {
const input = ClassifyInput.parse(await c.req.json());
// The route owns validation and timing; the focused functions own the work.
const intent = await classifyIntent(input.message);
const response = await draftReply(input.message, intent);
return c.json(response);
});
export default app;Ready
Output will appear here...