Have your agent communicate with an External API
ExecuteExternalActionVocodeActionConfig
description
and input_schema
!
processing_mode
: We currently only support muted
, which makes the agent silent while processing the request.
name
: the name of the external action — this has no impact on the functionality of action itself.
description
: Used by the Function Calling API to determine when to make the External Action call itself. See the description
field section below for more info!
url
: The API request is sent to this URL in the format
defined below in Responding to External Action API Requests
input_schema
: A JSON Schema for the payload to send to the External API. See the input_schema
field section below for more info!
speak_on_send
: if True
, then the underlying LLM will generate a message to be spoken as the
API request is being sent.
speak_on_receive
: if True
, then the agent will speak once it receives a result from the API Response. If the response does not contain an agent_message
(see Response Formatting), the agent will query the LLM for the message to speak.
signature_secret
: a base64 encoded string to enable request validation, see the Signature Validation section below for more info
input_schema
Fieldinput_schema
field is a JSON Schema form the payload to send to the External API.
For example, in the Meeting Assistant Example below we formed the following JSON schema:
length
(string): either “30m” or “1hr”time
(string): a regex pattern defining a time ending in a zero with am
/pm
on the end ie: 10:30am
input_schema
JSON schema must be an object
- this is so we can use JSON to send over parameters to the user’s API.description
Fielddescription
is best used to descibe your External Action’s purpose. As its passed through directly to the LLM, its the best way to convey instructions to the underlying Vocode Agent.
For example, in the Meeting Assistant Example below we want to book a meeting for 30 minutes to an hour so we set the description as Book a meeting for a 30 minute or 1 hour call.
description
field is passed through and heavily affects how functions are triggered and queried,
so we recommend treating it similar to prompting for an LLM!url
during the course of a phone call based on the configuration noted above
The Vocode API will wait a maximum of 10 seconds before timing out the request.
In particular, Vocode will issue a POST request to url
with a JSON payload that specifically matches input_schema
. Using the Meeting Assistant Example below, the request will contain:
x-vocode-signature
) in the outbound request, so the receiving API can validate the identity of the incoming request. The signature secret is used to sign the request and ensure the validity of the x-vocode-signature
field, and therefore must be securely managed.
This should be set as a base64-encoded string and we recommend a longer length as well, using the following snippet as an example:
result
is a payload containing the result of the action on the user’s side, and can be in any formatagent_message
optionally contains a message that will be synthesized into audio and sent back to the phone call. Note this means the LLM will not be queried to send a message (see Configuring the External Action above for more info)fastapi dev app.py
will run the server @ http://127.0.0.1:8000
and can be used for external actions locally!
DefaultActionFactory
already supports external actions.