inputComponent property of the agent:
inputComponent is to submit a request to your Agent Endpoint, which should trigger a new run. Please keep in mind that Studio doesn’t listen to the response from your Agent (it might be your custom format). It only displays live changes based on the data you sent to AgentView via av.createRun or av.updateRun calls. For example, if your Agent Endpoint is streaming each token, but it only calls av.updateRun at the end of the stream, then AgentView will see update only at the end of the stream.
<UserMessageInput /> is simple component from AgentView Design System that displays a text input, send and cancel buttons. You can provide your custom one whenever you need to.
Here are inputComponent properties:
| Prop | Description | Type |
|---|---|---|
session | Current session object | Session |
token | A user token | string |
submit | A thin wrapper on top of native browser fetch, that manages state and simplifies code. | (url: string, body: Record<string, any>, init?: RequestInit) => Promise<Response> |
cancel | If you use submit, it cancels the request properly | () => void |
isRunning | If you use submit, it properly handles information whether the component should be disabled | boolean |
submit function
submit is a thin wrapper on top of native browser fetch function that reduces a lot of boilerplate code:
- sets
POSTmethod andContent-Type: application/jsonheader - accepts
bodysecond parameter as a JSON - if you call
cancelit properly handles cancellation - properly computes
isRunningbased on session and request state
submit returns a Response object like fetch, and its 3rd parameter init? is the same as you would pass to fetch function (second param).