Create a new Agent.
Unique identifier for the agent (lowercase letters, numbers, hyphens, underscores)
Optionaloptions: AgentOptionsOptional configuration including metadata
Whether a non-streaming chat handler is registered.
Whether a streaming chat handler is registered.
Whether a non-streaming invoke handler is registered.
Whether a streaming invoke handler is registered.
Get the agent's metadata.
Handle a non-streaming chat request.
The conversation messages
Optionalctx: ContextOptional request context
The response
Handle a streaming chat request.
The conversation messages
Optionalctx: ContextOptional request context
An async generator yielding chunks
Handle a non-streaming invoke request.
The input data from the request
Optionalctx: ContextOptional request context
The response
Handle a streaming invoke request.
The input data from the request
Optionalctx: ContextOptional request context
An async generator yielding chunks
Register a non-streaming chat handler.
Function that processes chat requests
The agent instance for chaining
Register a non-streaming invoke handler.
Function that processes invoke requests
The agent instance for chaining
Get agent information for discovery.
String representation for debugging.
Agent class for defining invoke and chat handlers.
Use separate handlers for non-streaming and streaming responses:
onInvoke/onChatfor non-streamingonInvokeStream/onChatStreamfor streamingExample