HttpAgent
TheHttpAgent extends AbstractAgent to provide HTTP-based connectivity to
remote AI agents. It handles the request/response cycle and transforms the HTTP
event stream into standard Agent User Interaction Protocol events.
Configuration
When creating an HTTP agent, you need to provide anHttpAgentConfig object:
Creating an HttpAgent
Methods
runAgent()
Executes the agent by making an HTTP request to the configured endpoint.Parameters
Theparameters argument follows the standard RunAgentParameters interface.
The optional subscriber parameter allows you to provide an
AgentSubscriber for handling events during this
specific run.
Return Value
subscribe()
Adds an AgentSubscriber to handle events across multiple agent runs.unsubscribe() method to remove the subscriber when
no longer needed.
abortRun()
Cancels the current HTTP request using the AbortController.Protected Methods
requestInit()
Configures the HTTP request. Override this method to customize how requests are made.run()
Implements the abstractrun() method from AbstractAgent using HTTP requests.
Properties
url: The endpoint URL for the agent serviceheaders: HTTP headers to include with requestsabortController: AbortController instance for request cancellation