Skip to main content

Self-hosted

You can subclass a RespondAgent to create a simple agent that can be passed into StreamingConversation has the following interface: Here’s one that responds with the same message no matter what is said to it:
See our other agent implementations for more guidance!

Hosted (deprecated)

NOTE: The hosted RESTfulAgent is being deprecated. Our library lets you easily host your agent so that the Vocode backend can use it to generate responses. Users will be responsible for implementing a RESTfulAgent.

RESTful Implementation (deprecated)

Here is an example implementation of a RESTfulAgent that just echoes back whatever input it receives. Note that the respond method is expecting a RESTfulAgentOutput return value. The conversation_id parameter lets you store state about a single conversation across multiple calls.

Run your agent

This sets up a FastAPI with either a POST endpoint or a websocket route at /respond. We’ll use this in the next step.

Setting up your AgentConfig

Now that your agent is running, you’ll need to host it somewhere so that the Vocode backend can hit it. There are a variety of options to do this, here we’ll describe using ngrok since it’s the quickest. Replit is also a great option for this.