Agents & Context Graphs
Define agent personas and versioned context graphs (state machines) that power conversation flows.
How Agents & Context Graphs Relate to Services
Agent Management
Create an Agent
Create a new agent for the given organization. No default version for the agent will be created, so one must later to create a version for this agent so it can be used in a service.
Permissions
This endpoint requires the following permissions:
Organization:CreateAgentfor the new agent.
The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.
Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.
An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
[]The name of the new agent.
Succeeded.
Invalid authorization credentials.
Missing required permissions.
The specified organization does not exist.
An Agent with the same name already exists.
Invalid request path parameter or request body failed validation.
The user has exceeded the rate limit of 10 requests per minute for this endpoint.
The service is going through temporary maintenance.
List Agents
Return a list of agents for the organization.
Permissions
This endpoint may be impacted by the following permissions:
- Only agents that the authenticated user has the
Organization:GetAgentpermission on will be returned.
The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.
Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.
An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
Whether the agent is deprecated.
The IDs of the agents to filter for.
[]The maximum number of agents to return.
10The continuation token from the previous request used to retrieve the next page of agents.
0The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
[]Succeeded.
Whether there are more agents to retrieve.
A token to supply to the next request to retrieve the next page of agents. Only populated if has_more is True.
Invalid authorization credentials.
Missing required permissions.
The specified organization does not exist.
Invalid request path parameter or query parameter failed validation.
The user has exceeded the rate limit of 20 requests per minute for this endpoint.
The service is going through temporary maintenance.
Create an Agent Version
Create a new version of the given agent. If there's no existing versions, all fields in the request must be filled and they will be used to create the initial version of the agent. Otherwise, only fill the fields that need to be updated, and the new version will retain other fields from the previous latest version.
Permissions
This endpoint requires the following permissions:
Organization:CreateAgentVersionfor the new version of the agent.
The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.
Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.
An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
The ID of the agent to create a new version for.
^[a-f0-9]{24}$The version number of the new agent version. If specified, this endpoint throws an error if the next version of the agent in the database doesn't equal to the value of this parameter.
The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
[]The agent's initials.
Information about the agent's identity.
A description of the agent's background.
A list of behavioral guidelines that this agent follows.
A list of descriptions that illustrate the communication styles of this agent.
The Cartesia voice config for the agent. If set to null, it is not updated.
Succeeded.
Attempt to create the initial version for an agent, but not all fields in the request object are defined. Or, the specified voice ID doesn't exist.
Invalid authorization credentials.
Missing required permissions.
The specified organization or agent does not exist.
The specified version is not the expected next version for the agent.
Invalid request path parameter, request body, or request query parameter failed validation.
The user has exceeded the rate limit of 10 requests per minute for this endpoint.
The service is going through temporary maintenance.
Delete an Agent
Delete the specified agent from the organization. In practice, this endpoint marks the agent as deprecated, but will not delete this agent nor any of its versions. It does prevent new services (or inactive services to be activated) from using this agent.
An error will be raised if this endpoint is called when an active service still utilizes this agent. However, any ongoing conversation using this agent will continue to work.
Permissions:
Organization:DeleteAgentfor the agent to delete.
The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.
Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.
An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
The ID of the agent to delete
^[a-f0-9]{24}$The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
[]Succeeded.
An active service exists that utilizes this agent.
Invalid authorization credentials.
Missing required permissions.
The specified organization or agent does not exist.
The specified agent is already deleted
Invalid request path parameter failed validation.
The user has exceeded the rate limit of 10 requests per minute for this endpoint.
The service is going through temporary maintenance.
No content
Get Agent Versions
Retrieve the versions of an agent.
Permissions
This endpoint requires the following permissions:
Organization:GetAgentfor the agent to retrieve.
The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.
Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.
An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
The ID of the agent.
^[a-f0-9]{24}$The versions of the agent to retrieve. One can specify an exact version to retrieve, which is either the version number or latest, which retrieves the latest version. Alternatively, one can specify a range of inclusive lower and upper bound for the version number separated by -, and every version within the range would be retrieved.
1The maximum number of agent versions to return.
10The continuation token from the previous request used to retrieve the next page of agent version.
0The fields to sort the versions by. Supported fields are version. Specify a + before the field name to indicate ascending sorting and - for descending sorting. Multiple fields can be specified to break ties.
[]The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
[]Succeeded.
Whether there are more agent versions to retrieve.
A token to supply to the next request to retrieve the next page of agent versions. Only populated if has_more is True.
Invalid authorization credentials.
Missing required permissions.
Specified organization or agent is not found.
Invalid request path parameter or request query parameter failed validation.
The user has exceeded the rate limit of 20 requests per minute for this endpoint.
The service is going through temporary maintenance.
Context Graph Management
Create a Context Graph
Create a service hierarchical state machine
Create a new state machine for the given organization. No default version for the state machine will be created, so one must later create a version for this state machine so it can be used in a service.
Permissions
This endpoint requires the following permissions:
Organization:CreateServiceHierarchicalStateMachinefor the new service hierarchical state machine.
The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.
Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.
An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
[]The name of the new state machine.
Succeeded.
Invalid authorization credentials.
Missing required permissions.
The specified organization does not exist.
A state machine with the same name already exists.
Invalid request path parameter or request body failed validation.
The user has exceeded the rate limit of 10 requests per minute for this endpoint.
The service is going through temporary maintenance.
List Context Graphs
Get service hierarchical state machines for an organization
Return a list of service hierarchical state machines for the organization.
Permissions
This endpoint may be impacted by the following permissions:
- Only state machines that the authenticated user has the
Organization:GetServiceHierarchicalStateMachinepermission on will be returned.
The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.
Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.
An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
Whether the state machine is deprecated.
The IDs of the state machines to filter for.
[]The maximum number of service hierarchical state machines to return.
50The continuation token from the previous request used to retrieve the next page of state machines.
0The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
[]Succeeded.
Whether there are more state machines to fetch.
A token to supply to the next request to retrieve the next page of state machines. Only populated if has_more is True.
Invalid authorization credentials.
Missing required permissions.
The specified organization does not exist.
Invalid request path parameter or query parameter failed validation.
The user has exceeded the rate limit of 20 requests per minute for this endpoint.
The service is going through temporary maintenance.
Create a Context Graph Version
Create a service hierarchical state machine version
Create a new version for the given service hierarchical state machine. The new version will be created with the supplied data. It needs to satisfy the following constraints:
- Each action state must have at least one action.
- For action and decision states, each exit condition's
next_statemust either be a string that exists in the states and cannot be the same as the current state, or a 2-tuple of strings, with the first string of the form{external_service_hierarchical_state_machine_reference.external_state_name}, and the second string the jumpback state which must be a state in the states. - For
recall,reflection, andtool_callstates,next_statemust either be a string that exists in the states and cannot be the same as the current state, or a 2-tuple of strings, with the first string of the form{external_service_hierarchical_state_machine_reference.external_state_name}, and the second string the jumpback state which must be a state in the states. - The terminal state cannot have exit conditions and must have exactly one action.
See the per-request-field documentation for more field-specific constraints.
Due to the complexity of the state machine data structure, this endpoint provides a dry_run parameter. If set to True, the endpoint will check the supplied state machine would pass validations,
but does not actually create a new version. In this case, the endpoint returns an empty response with a 201 status code.
Permissions:
This endpoint requires the following permissions:
Organization:CreateServiceHierarchicalStateMachineVersionfor the service hierarchical state machine.
The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.
Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.
An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
The ID of the service hierarchical state machine to create a new version for.
^[a-f0-9]{24}$The version number of the new state machine version. If specified, this endpoint throws an error if the next version of the state machine in the database doesn't equal to the value of this parameter.
Whether to perform a dry run of the operation.
falseThe Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
[]A description of the service hierarchical state machine.
The state a new user will be in when a session starts. This must be an action state, and must be an internal state.
^[A-Za-z0-9_]+$The state a returning user will be in when a session starts. This must be an action state, and must be an internal state.
^[A-Za-z0-9_]+$The state the user will be in when the session ends. This must be an action state, and must be an internal state.
^[A-Za-z0-9_]+$A list of guidelines for how the agent will navigate between subgoals and exit conditions within this state. This is injected into the intra_state_navigation_guidelines field of every action state.
A list of guidelines for how the agent will behave when engaging with user. This is injected into the action_guidelines field of every action state.
A list of guidelines for how the agent will not behave when engaging with user. This is injected into the boundary_constraints field of every action state.
Succeeded.
The specified state machine version depends on another state machine that either doesn't exist or is deprecated
Invalid authorization credentials.
Missing required permissions.
The specified organization, state machine, or tool does not exist.
The specified version number is not the expected next version for the state machine.
Invalid request path parameterl, request body, or request query parameter failed validation.
The user has exceeded the rate limit of 10 requests per minute for this endpoint.
The service is going through temporary maintenance.
Delete a Context Graph
Delete a service hierarchical state machine
Delete the specified state machine from the organization. In practice, this endpoint marks the state machine as deprecated, but will not delete this state machine nor any of its versions. It does prevent new services (or inactive services to be activated) from using this state machine.
An error will be raised if this endpoint is called when an active service still utilizes this state machine. However, any ongoing conversation using this state machine, as well as any state machine version that depends on this state machine will continue to work.
Permissions:
Organization:DeleteServiceHierarchicalStateMachinefor the state machine to delete.
The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.
Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.
An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
The ID of the state machine to delete
^[a-f0-9]{24}$The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
[]Succeeded.
An active service exists that utilizes this state machine.
Invalid authorization credentials.
Missing required permissions.
The specified organization or state machine does not exist.
The specified state machine is already deleted
Invalid request path parameter failed validation.
The user has exceeded the rate limit of 10 requests per minute for this endpoint.
The service is going through temporary maintenance.
No content
Get Context Graph Versions
Get service hierarchical state machine versions
Retrieve the versions of a state machine.
Permissions
This endpoint requires the following permissions:
Organization:GetServiceHierarchicalStateMachinefor the state machine to retrieve.
The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.
Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the SignInWithAPIKey endpoint.
An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
The ID of the state machine.
^[a-f0-9]{24}$The versions of the state machine to retrieve. One can specify an exact version to retrieve, which is either the version number or latest, which retrieves the latest version. Alternatively, one can specify a range of inclusive lower and upper bound for the version number separated by -, and every version within the range would be retrieved.
1The maximum number of state machine versions to return.
10The continuation token from the previous request used to retrieve the next page of state machine versions.
0The fields to sort the versions by. Supported fields are version. Specify a + before the field name to indicate ascending sorting and - for descending sorting. Multiple fields can be specified to break ties.
[]The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
[]Succeeded.
Whether there are more state machine versions to retrieve.
A token to supply to the next request to retrieve the next page of state machine versions. Only populated if has_more is True.
Invalid authorization credentials.
Missing required permissions.
Specified organization or service hierarchical state machine is not found.
Invalid request path parameter or request query parameter failed validation.
The user has exceeded the rate limit of 20 requests per minute for this endpoint.
The service is going through temporary maintenance.
Typical Workflow
Related
Last updated
Was this helpful?

