Entrypoints
Defining an Entrypoint
import { z } from 'zod';
import { createAgent } from '@regent/core';
import { http } from '@regent/http';
import { createAgentApp } from '@regent/hono';
const agent = await createAgent({
name: 'my-agent',
version: '1.0.0',
})
.use(http())
.build();
const { app, addEntrypoint } = await createAgentApp(agent);
addEntrypoint({
key: 'greet',
description: 'Greets a user by name',
input: z.object({
name: z.string(),
}),
output: z.object({
message: z.string(),
}),
async handler({ input }) {
return {
output: {
message: `Hello, ${input.name}!`,
},
};
},
});EntrypointDef Type
Input and Output Schemas
Handler Function
Handler Signature
AgentContext
Handler Example
Streaming Entrypoints
Stream Handler Signature
Stream Envelope Types
Full StreamEnvelope Union
Invoking Entrypoints
Non-Streaming (invoke)
Streaming (stream)
Adding Pricing
Usage Tracking
Listing Entrypoints
Validation Errors
Best Practices
Next Steps
Last updated