POST
/
v4
/
agents
/
execute

Authorizations

x-api-key
string
headerrequired

Body

application/json
model
enum<string>
required

The ID of the model to use for the agent. We only support the models listed here so far.

Available options:
gpt-4,
gpt-4-0613,
gpt-4-32k,
gpt-4-32k-0613,
gpt-3.5-turbo,
gpt-3.5-turbo-0613,
gpt-3.5-turbo-16k,
gpt-3.5-turbo-16k-0613,
claude-instant-1,
claude-instant-1.1,
claude-2,
claude-2.0
tools
object[]
required

The list of specs of tools that the agent can use. Each spec must contain a name key set to the name of the tool, a description key set to the description of the tool, and an arguments key set to a JSON Schema compliant object describing the tool arguments.

The name and description of each tool is used by the agent to decide when to use certain tools. Because some queries are complex and may require multiple tools to complete, it is important to make these descriptions as informative as possible. If a tool is not being chosen when it should, it is common practice to tune the description of the tool to make it more apparent to the agent when the tool can be used effectively.

messages
object[]
required

The list of messages in the conversation.

Expand each message type to see how it works and when to use it. Most conversations should begin with a single user message.

memory_strategy
object

The memory strategy to use for the agent. A memory strategy is a way to prevent the underlying LLM's context limit from being exceeded. Each memory strategy uses a different technique to condense the input message list into a smaller payload for the underlying LLM.

We only support the Last K memory strategy right now, but will be adding new strategies soon.

model_parameters
object

Configuration parameters for the agent model, such as temperature, max_tokens, and stop_sequences.

If not specified, the default value are:

  • temperature: 0.2
  • max_tokens: None (limited by the model's max tokens)
  • stop_sequences: None
instructions
string
default: You are an AI assistant that helps users with their questions. You can answer questions directly or acquire information from any of the attached tools to assist you. Always answer the user's most recent query to the best of your knowledge. When asked about what tools are available, you must list each attached tool's name and description. When asked about what you can do, mention that in addition to your normal capabilities, you can also use the attached tools by listing their names and descriptions. You cannot use any other tools other than the ones provided to you explicitly.

The initial instructions to provide to the agent.

Use this to guide the agent to act in more specific ways. For example, if you have specific rules you want to restrict the agent to follow you can specify them here. For example, if I want the agent to always use certain tools before others, I can write that rule in these instructions.

Good prompt engineering is crucial to getting performant results from the agent. If you are having trouble getting the agent to perform well, try writing more specific instructions here before trying more expensive techniques such as swapping in other models or finetuning the underlying LLM.

Response

200 - application/json
action
enum<string>
required

The action that the agent performed.

The context will contain a key for each action that the agent can perform. However, only the key corresponding to the action that the agent actually performed will have a populated value. The rest of the values will be null.

Available options:
tool_request,
content
context
object
required

Context object containing the output payload. This will contain a key for all actions that the agent can perform. However, only the key corresponding to the action that the agent performed have a populated value. The rest of the values will be null.