veryfront/agent
AI agents with memory, tools, and multi-agent composition.Import
Examples
Basic agent
Agent with tools
Agent with skills
Streaming API route
Multi-agent composition
API
agent(config)
Create an agent
| Property | Type | Description |
|---|---|---|
id? | string | Unique identifier (auto-generated if omitted) |
model? | ModelString | Optional model string in “provider/model” format. |
system | string | (() => string) | (() => Promise<string>) | System prompt — string, function, or async function |
tools? | true | Record<string, Tool | boolean> | Tools available to the agent |
remoteTools? | RemoteToolSource[] | |
maxSteps? | number | Max tool-call iterations per request |
streaming? | boolean | Enable streaming responses |
memory? | MemoryConfig | Conversation memory settings |
middleware? | AgentMiddleware[] | Execution middleware pipeline |
edge? | EdgeConfig | Edge runtime configuration |
multimodal? | { vision?: boolean; audio?: boolean } | Enable vision and/or audio |
allowedModels? | ModelString[] | Restrict runtime model overrides to these “provider/model” strings. |
resolveModelTransport? | ModelTransportResolver | Optional request-aware hook for overriding the resolved model runtime and |
resolveRuntimeState? | RuntimeStateResolver | Optional step-boundary hook for refreshing the runtime system prompt and |
skills? | true | string[] | Enable skills for this agent. |
suggestions? | AgentSuggestions | |
security? | false | Set to false to disable the default security middleware |
Agent
agent.generate(input)
Run the agent and return a complete response. Accepts a string or message array as input.
| Property | Type | Description |
|---|---|---|
input | string | Message[] | Prompt string or message history |
context? | Record<string, unknown> | Additional context passed to the agent |
model? | ModelString | Override the agent’s default model for this request. Must be in allowedModels if configured. |
maxOutputTokens? | number | Override the maximum model output tokens for this request. |
Promise<AgentResponse>
agent.stream(input)
Run the agent and stream the response. Returns a result with .toDataStreamResponse() for API routes.
| Property | Type | Description |
|---|---|---|
input? | string | Prompt string |
messages? | Message[] | Conversation message history |
context? | Record<string, unknown> | Additional context passed to the agent |
model? | ModelString | Override the agent’s default model for this request. Must be in allowedModels if configured. |
maxOutputTokens? | number | Override the maximum model output tokens for this request. |
onToolCall? | (toolCall: ToolCall) => void | Callback fired when a tool is invoked |
onChunk? | (chunk: string) => void | Callback fired for each text chunk |
onFinish? | (response: AgentResponse) => void | |
abortSignal? | AbortSignal |
Promise<AgentStreamResult>
agent.respond(request)
Handle an incoming HTTP request and return a streaming Response. Reads messages from the request body.
Returns: Promise<Response>
agent.getMemory()
Get the agent’s memory instance.
Returns: Memory<Message>
agent.getMemoryStats()
Get memory usage statistics (message count, estimated tokens, type).
Returns: Promise<{ totalMessages: number; estimatedTokens: number; type: string }>
agent.clearMemory()
Clear all stored messages from memory.
Returns: Promise<void>
Exports
Components
| Name | Description |
|---|---|
AgUiDetachedStartAcceptedSchema | |
AgUiDetachedStartRequestSchema | |
AgUiRequestSchema | |
AgUiResumeSignalSchema | |
AgUiRuntimeContextItemSchema | |
AgUiRuntimeInjectedToolSchema | |
AgUiRuntimeMessageSchema | |
AgUiRuntimeRequestSchema | |
AppendConversationRunEventsResponseSchema | |
CompleteConversationRunResponseSchema | |
ConversationMessageRecordSchema | |
ConversationRecordSchema | |
ConversationRunEventSchema | |
ConversationRunProjectionSchema | |
ConversationRunStatusSchema | |
ConversationRunTargetsSchema | |
HumanInputFieldSchema | |
HumanInputOptionSchema | |
HumanInputPendingRequestSchema | |
HumanInputRequestSchema | |
HumanInputResultSchema | |
InvokeAgentChildRunLifecycleCustomEventSchema | |
InvokeAgentChildRunLifecycleValueSchema | |
InvokeAgentChildRunStateDeltaSchema |
Functions
| Name | Description |
|---|---|
agent | Create an agent |
agentAsTool | Wrap agent as callable tool |
appendConversationRunEvents | |
appendHostedChildMirrorChunk | |
bootstrapConversationAgentRun | |
bootstrapHostedChildRun | |
buildAgUiBrowserFinalizeResponse | |
buildChatStreamChunkMessageMetadata | |
buildHostedChildConversationBody | |
buildInvokeAgentChildRunLifecycleCustomEvent | |
buildInvokeAgentChildRunProgressEvents | |
buildInvokeAgentChildRunStateDelta | |
closeHostedChildReasoningSegment | |
closeHostedChildTextSegment | |
createAgUiBrowserChunkEncoder | |
createAgUiBrowserEncoderState | |
createAgUiBrowserFinalizeTracker | |
createAgUiBrowserResponseStream | |
createAgUiCancelHandler | |
createAgUiChunkEncoderBridge | |
createAgUiDetachedStartHandler | |
createAgUiHandler | |
createAgUiHandler | |
createAgUiHandler | |
createAgUiResumeHandler | |
createAgUiRunErrorEvent | |
createAgUiRuntimeBrowserResponse | |
createAgUiRuntimeChatStreamEncoder | |
createAgUiRuntimeEventEncoder | |
createAgUiRuntimeHandler | |
createAgUiSseErrorResponse | |
createAgUiSseResponse | |
createAgUiTrackedBrowserResponse | |
createChatHandler | Create a POST handler for a chat API route. |
createChatHandler | |
createChatHandler | |
createConversationAgentRun | |
createConversationChildLifecycleAdapter | |
createConversationHostedLifecycleAdapter | |
createConversationHostedStreamLifecycleAdapter | |
createConversationHostedTerminalAdapter | |
createConversationMessage | |
createConversationRecord | |
createConversationRootRunContext | |
createConversationRootRunStartAdapter | |
createConversationRunContext | |
createConversationRunEventQueueController | |
createConversationRunMirror | |
createConversationRunStreamMirror | |
createMemory | Create memory (buffer, conversation, summary) |
createRedisMemory | Create Redis-backed memory |
createWorkflow | Create sequential agent workflow |
dedupeChatUiMessageChunks | |
defineAgentService | Reserve the public hosted agent-service signature before the runtime |
encodeConversationRunEvents | |
ensureConversationProjectLink | |
executeAgUiDetachedStart | |
expandAllowedRemoteToolNames | |
extractChatMessageMetadata | |
fetchConversationRecord | |
finalizeAgUiBrowserEvents | |
finalizeConversationAgentRun | |
finalizeHostedDetached | |
finalizeHostedResponse | |
flushConversationRunEventBatches | |
flushConversationRunEventQueue | |
getAgent | Get agent by ID |
getAgentsAsTools | Get agents as tools (multi-agent) |
getAllAgentIds | List registered agent IDs |
getConversationRun | |
getConversationRunEventJsonByteLength | |
getProviderNativeToolNames | |
getTextFromParts | Extract text from multi-part message |
getToolArguments | Extract parsed tool call args |
hasArgs | Check for parsed args on tool call |
hasInput | Check for raw input on tool call |
isActiveConversationRunStatus | |
isAlreadyMirroredHostedChunk | |
isAppendableConversationRunProjection | |
isCursorMismatchConversationRunAppendError | |
isIgnorableConversationRunAppendError | |
mapHostedStreamPartToChatUiChunks | |
mapRuntimeStreamEventToAgUiBrowserEvents | |
mergeToolCallInput | |
mergeToolInputDelta | |
monitorConversationRunStatus | |
monitorHostedChildRunStatus | |
normalizeAgUiBrowserRuntimeRequest | |
normalizeAgUiMessages | |
normalizeAgUiRuntimeMessages | |
normalizeChatMessageMetadata | |
normalizeChatUiMessageChunk | |
normalizeChatUiMessageStream | |
normalizeConversationRunEvent | |
normalizeConversationRunEvents | |
normalizeEncodedConversationRunEvents | |
parseAgUiRequest | |
parseAgUiRequestOrError | |
parseAgUiRuntimeRequest | |
parseAgUiRuntimeRequestOrError | |
parseAppendConversationRunEventsErrorBody | |
parseDataStreamSseEvents | |
parseToolInputObject | |
prepareConversationRootRunContext | |
prepareConversationRootRunLifecycle | |
prepareConversationRunChunkEvents | |
prepareConversationRunExternalEvents | |
prepareConversationRunStreamEvents | |
publishInvokeAgentChildRunProgress | |
recoverConversationRunAppendExecution | |
recoverConversationRunAppendFailure | |
recoverConversationRunCursorMismatch | |
registerAgent | Register agent for discovery |
resolveConversationRunTargets | |
resolveHostedChildTerminalErrorCode | |
resyncConversationRunAppendCursor | |
runHostedChildLifecycle | |
runHostedLifecycle | |
runHostedResponseStreamWithHeartbeat | |
startConversationRootRun | |
streamDataStreamEvents | |
stripLeadingEmptyObjectPlaceholder | |
toConversationHostedTerminalState | |
toConversationRunStreamEvent | |
toMirroredHostedStreamPart | |
waitForHumanInput |
Classes
| Name | Description |
|---|---|
AgentRuntime | Agent execution runtime |
AppendConversationRunEventsError | |
BufferMemory | In-memory message buffer |
ConversationMemory | Full conversation history |
ConversationRunEventEncoder | |
ConversationRunTerminalStateError | |
HostedChildTerminalStateError | |
HumanInputResumeError | |
InvalidHumanInputResultError | |
RedisMemory | Redis-backed persistent memory |
RunAlreadyExistsError | |
RunCancelledError | |
RunNotActiveError | |
RunResumeSessionManager | |
SummaryMemory | Compresses old messages into summaries |
WaitConflictError | |
WaitNotPendingError |
Types
| Name | Description |
|---|---|
ActiveConversationRunStatus | |
Agent | agent() return type |
AgentConfig | Agent configuration |
AgentContext | Agent handler context |
AgentContract | Phase-0 contract draft for the future framework-owned hosted agent service. |
AgentMessage | |
AgentMiddleware | Agent execution middleware |
AgentResponse | Agent execution response |
AgentServiceDefinition | Type-preserving service definition reserved ahead of the runtime |
AgentServiceServerConfig | Placeholder host-facing server config reserved for the future hosted service |
AgentStatus | Agent status (idle, running, etc.) |
AgentStreamResult | Streaming result (.toDataStreamResponse()) |
AgentSuggestion | |
AgentSuggestions | |
AgUiBrowserChunkEncoder | |
AgUiBrowserEncodedEvent | |
AgUiBrowserEncoderState | |
AgUiBrowserFinalizeTracker | |
AgUiBrowserResponseEncoder | |
AgUiBrowserResponseExecution | |
AgUiBrowserResponseRequestState | |
AgUiBrowserRunFinishedMetadata | |
AgUiCancelHandlerOptions | |
AgUiChunkEncoderBridge | |
AgUiContextItem | |
AgUiDetachedStartAccepted | |
AgUiDetachedStartHandlerOptions | |
AgUiDetachedStartRequest | |
AgUiHandlerConfigWithAgent | |
AgUiHandlerOptions | |
AgUiInjectedTool | |
AgUiRequest | |
AgUiResumeHandlerOptions | |
AgUiResumeSignal | |
AgUiRuntimeChatStreamEncoder | |
AgUiRuntimeChatStreamEncoderState | |
AgUiRuntimeContextItem | |
AgUiRuntimeEventEncoder | |
AgUiRuntimeHandlerConfig | |
AgUiRuntimeHandlerConfigWithAgent | |
AgUiRuntimeHandlerExecute | |
AgUiRuntimeHandlerExecuteInput | |
AgUiRuntimeHandlerOptions | |
AgUiRuntimeInjectedTool | |
AgUiRuntimeLifecycleContext | |
AgUiRuntimeMessage | |
AgUiRuntimeRequest | |
AgUiRuntimeStreamEvent | |
AgUiSseEvent | |
AppendConversationRunEventsResponse | |
BootstrapConversationAgentRunResult | |
BootstrapHostedChildRunInput | |
BootstrapHostedChildRunResult | |
BuildChatStreamChunkMessageMetadataInput | |
ChatHandlerBeforeStream | |
ChatHandlerBeforeStreamContext | |
ChatHandlerBeforeStreamResult | |
ChatHandlerConfigWithAgent | Options when passing an agent instance directly. |
ChatHandlerMessageInput | |
ChatHandlerOptions | Options for createChatHandler — customize the context passed to the agent. |
ChatMessageMetadata | |
ChatMessageMetadataUsage | |
ChatUiMessageChunk | |
ChildRunAudit | |
ChildRunAuditToolCall | |
ChildRunAuditToolResult | |
ConversationAgentRunUsage | |
ConversationChildLifecycleContext | |
ConversationHostedLifecycleFinalizeInput | |
ConversationHostedTerminalAdapter | |
ConversationHostedTerminalStateInput | |
ConversationMessageRecord | |
ConversationRecord | |
ConversationRootRunContext | |
ConversationRootRunDescriptor | |
ConversationRootRunLifecycle | |
ConversationRunAppendCursorResyncResult | |
ConversationRunAppendExecutionOutcome | |
ConversationRunAppendFailureOutcome | |
ConversationRunAppendRecoveryOutcome | |
ConversationRunBatchFlushOutcome | |
ConversationRunContext | |
ConversationRunEvent | |
ConversationRunEventQueueController | |
ConversationRunMirror | |
ConversationRunMirrorRetryScheduledState | |
ConversationRunMirrorSnapshot | |
ConversationRunMirrorStoppedState | |
ConversationRunProjection | |
ConversationRunQueueFlushOutcome | |
ConversationRunStreamMirror | |
ConversationRunTargets | |
CreateAgUiBrowserChunkEncoderOptions | |
CreateAgUiBrowserFinalizeTrackerOptions | |
CreateAgUiBrowserResponseStreamInput | |
CreateAgUiChunkEncoderBridgeOptions | |
CreateAgUiRuntimeBrowserResponseInput | |
CreateAgUiRuntimeChatStreamEncoderOptions | |
CreateAgUiRuntimeEventEncoderOptions | |
CreateAgUiTrackedBrowserResponseInput | |
CreateConversationHostedLifecycleAdapterOptions | |
CreateConversationHostedTerminalAdapterOptions | |
DurableRunSink | Transport-neutral durable run lifecycle sink reserved for hosted agent-service |
EdgeConfig | Agent-to-agent edge config |
ExecuteAgUiDetachedStartInput | |
FinalizeHostedDetachedOptions | |
FinalizeHostedResponseOptions | |
HostedChildChunkMirror | |
HostedChildConversationBodyInput | |
HostedChildLifecycleAdapter | |
HostedChildLifecycleRunnerOptions | |
HostedChildLifecycleRunResult | |
HostedChildLifecycleTerminalState | |
HostedChildMirrorPart | |
HostedChildMirrorState | |
HostedChildRunIdentifiers | |
HostedChildTerminalStatus | |
HostedDetachedFinalizationState | |
HostedLifecycleAdapter | |
HostedLifecycleExecution | |
HostedLifecycleRunnerOptions | |
HostedLifecycleRunResult | |
HostedLifecycleTerminalState | |
HostedResponseFinalizationState | |
HostedResponseStreamHeartbeat | |
HostedResponseStreamHeartbeatState | |
HostedResponseStreamWriter | |
HostedStreamPartForUiChunkMapping | |
HostedTerminalError | |
HostedUiChunkMappingOptions | |
HumanInputField | |
HumanInputFieldInput | |
HumanInputOption | |
HumanInputPendingRequest | |
HumanInputRequest | |
HumanInputRequestInput | |
HumanInputResult | |
InvokeAgentChildRunLifecycleCustomEvent | |
InvokeAgentChildRunLifecycleValue | |
InvokeAgentChildRunProgressEvent | |
InvokeAgentChildRunProgressInput | |
InvokeAgentChildRunStateDelta | |
Memory | Memory interface |
MemoryConfig | Memory creation config |
MemoryPersistence | Memory storage backend |
MemoryStats | Memory usage stats |
MessagePart | Multi-part message segment |
ModelProvider | Model provider interface |
ModelString | Model configuration string format: “provider/model-name” |
ModelTransportRequest | |
ModelTransportResolver | |
PrepareConversationRootRunLifecycleOptions | |
ProviderNativeToolInventoryOptions | |
RedisClient | Redis client interface (compatible with ioredis and node-redis) |
RedisMemoryConfig | Redis memory configuration |
ResolvedAgentConfig | |
ResolvedModelTransport | |
ResolvedRuntimeState | |
RunResumeSessionManagerOptions | |
RunSessionStatus | |
RuntimeStateRequest | |
RuntimeStateResolver | |
StreamToolCall | Streaming tool call |
SubmitResumeValueOutcome | |
TerminalConversationRunStatus | |
ToolCall | Completed tool call |
ToolCallPart | Tool call message segment |
ToolCallPartWithArgs | Tool call with parsed args |
ToolCallPartWithInput | Tool call with raw input |
ToolResultPart | Tool execution result segment |
WaitForHumanInputOptions | |
WorkflowConfig | createWorkflow config |
WorkflowResult | Completed workflow result |
WorkflowStep | Workflow step definition |
Constants
| Name | Description |
|---|---|
conversationRunEventTypes |
Related
veryfront/chat— Client-side chat UI for agentsveryfront/tool— Define tools for agentsveryfront/provider— Configure AI model providersveryfront/workflow— Orchestrate multi-agent workflows