How SailPoint makes use of Anthropic’s Claude on Amazon Bedrock to routinely generate TypeScript code for SaaS connectors
Generative AI is revolutionizing the best way builders strategy programming by offering clever help and automation all through the coding course of. With the facility of superior language fashions and machine studying (ML) algorithms, generative AI can perceive the context and intent behind a programmer’s code, providing useful recommendations, finishing code snippets, and even producing complete features or modules primarily based on high-level descriptions. This know-how empowers builders to give attention to higher-level problem-solving and structure, whereas the AI handles the tedious and repetitive features of coding. One of many key benefits of huge language fashions (LLMs) in programming is their means to be taught from the huge quantities of current code and programming patterns they have been skilled on. This data permits them to generate context-aware code, detect potential bugs or vulnerabilities, and supply optimizations to enhance code high quality and efficiency.
On this publish, we spotlight how the AWS Generative AI Innovation Center collaborated with SailPoint Technologies to construct a generative AI-based coding assistant that makes use of Anthropic’s Claude Sonnet on Amazon Bedrock to assist speed up the event of software as a service (SaaS) connectors.
Amazon Bedrock is a completely managed service that gives a alternative of high-performing basis fashions (FMs) from main AI corporations like AI21 Labs, Anthropic, Cohere, Meta, Mistral AI, Stability AI, and Amazon via a single API, together with a broad set of capabilities to construct generative AI functions with safety, privateness, and accountable AI.
SailPoint makes a speciality of enterprise id safety options. Over 3,000 enterprises worldwide use SailPoint to assist defend towards immediately’s dynamic, identity-centric cyber threats whereas enhancing productiveness and effectivity. Their merchandise are designed to handle and safe entry to functions and information via the lens of id, at velocity and scale, for customers inside a corporation and for exterior events resembling non-employees. SailPoint’s unified, clever, and extensible setting gives complete id governance capabilities, together with entry certifications, coverage administration, entry request and provisioning, password administration, and information entry governance. This helps organizations make certain the proper people have the proper entry to the proper assets on the proper occasions, thereby imposing safety insurance policies and compliance necessities. Based in 2005, SailPoint has grown to be a key participant in id safety, serving clients globally throughout varied industries.
SailPoint connectors and SaaS connectivity
SailPoint’s id safety options interface with varied software program as a service (SaaS) functions to retrieve the mandatory info, resembling account and entry info, from an id safety standpoint. Every SaaS software implements these functionalities in barely other ways and may expose their implementation via REST-based net APIs which can be usually supported by OpenAPI specifications. SailPoint connectors are TypeScript modules that interface with a SaaS software and map the related id safety info (resembling accounts and entitlements) to a standardized format understood by SailPoint. Primarily based on the APIs uncovered by the appliance, SailPoint connectors can create, replace, and delete entry on these accounts. SailPoint connectors assist handle person identities and their entry rights throughout completely different environments inside a corporation, supporting the group’s compliance and safety efforts.
Though a typical connector exposes a number of features, for this publish, we give attention to growing the checklist person perform of a connector that connects to an API endpoint for itemizing customers, retrieving all of the customers, and remodeling them into the format required by SailPoint.
Within the following sections, we element how we used Anthropic’s Claude Sonnet on Amazon Bedrock to routinely create the checklist person connector, a vital part of the broader SaaS connectivity.
Understanding the checklist person connector
Connectors are modules that may connect with an exterior service and retrieve and replace related info from a SaaS software. To raised perceive how connectors are constructed, we give an instance of the connector perform that connects to DocuSign’s REST API’s getUsers endpoint. The next TypeScript code defines an asynchronous perform listUsers that retrieves a listing of person accounts from an exterior API and constructs a structured output for every person:
The next is a breakdown of what every a part of the code does:
- Imports – The code imports a number of varieties and interfaces from
@sailpoint/connector-sdk
. These embraceContext, Response, StdAccountListHandler, and StdAccountListOutput
, that are used to deal with the enter and output of the perform in a standardized manner inside a SailPoint setting. - Operate definition –
listUsers
is outlined as an asynchronous perform appropriate with theStdAccountListHandler
It makes use of theContext
to entry configuration particulars like API keys and the bottom URL, and aResponse
to construction the output. - Retrieve API key and host URL – These are extracted from the
context
parameter. They’re used to authenticate and assemble the request URL. - URL building – The perform constructs the preliminary URL utilizing the hostUrl and
organizationId
from thecontext
. This URL factors to an endpoint that returns customers related to a particular group. - Loop via pages – The
whereas
loop continues so long as there are extra pages of knowledge (hasMore
is true). It serves the next features:- Fetch information – Contained in the
whereas
loop, afetch
request is made to the API endpoint. The request contains anAuthorization
header that makes use of theapiKey
. The API’s response is transformed to JSON format. - Course of customers – Contained in the
whereas
loop, it extracts person information from the API response. The method loops via every person, developing anStdAccountListOutput
object for every one. This object contains person identifiers and attributes like person names, names, standing, electronic mail, and group IDs. - Pagination – Contained in the whereas loop, it checks if there’s a subsequent web page URL within the pagination info (
outcomes.paging.subsequent
). If it exists, it updates theurl
for the subsequent iteration of the loop. If not, it units hasMore to false to cease the loop.
- Fetch information – Contained in the
Understanding this instance helps us perceive the step-by-step technique of constructing this perform in a connector. We goal to breed this course of utilizing an LLM with a immediate chaining technique.
Generate a TypeScript connector utilizing an LLM immediate chain
There are a number of approaches to utilizing pre-trained LLMs for code technology, with various ranges of complexity:
- Single immediate – You should utilize fashions like Anthropic’s Claude to generate code by direct prompting. These fashions can generate code in quite a lot of languages, together with TypeScript, however they don’t inherently possess domain-specific data related to the duty of constructing a connector. All of the required info, together with API specs and formatting directions, have to be supplied within the immediate, much like the directions that might be given to a developer. Nevertheless, LLMs are likely to battle when given a protracted checklist of complicated directions. It’s additionally troublesome for the immediate engineer to know which steps are difficult for the LLM.
- Agentic frameworks with LLMs – Brokers are a complicated framework that may use instruments to carry out a sequence of complicated duties. On this case, the agent begins by breaking down the person requests into steps, searches for mandatory info utilizing instruments (a data base or net browser), and autonomously generates code from begin to end. Though they’re highly effective, these frameworks are complicated to implement, typically unstable of their conduct, and fewer controllable in comparison with different strategies. Brokers additionally require many LLM calls to carry out a activity, which makes them slightly sluggish in apply. Within the case the place the logic to carry out a activity is a set sequence of steps, brokers usually are not an environment friendly choice.
- Immediate chain – An answer that finds a very good trade-off between the 2 earlier approaches entails utilizing a immediate chaining approach. This technique breaks the complicated downside right into a sequence of extra manageable steps and integrates them to craft the ultimate code. Every step has clear directions which can be simpler for the LLM to comply with, and a human within the loop can management the output of every step and proper the LLM if wanted. This strategy strikes a stability between flexibility and management, avoiding the extremes of the opposite two strategies.
We initially examined the LLM’s means to generate connector code primarily based on a single immediate and realized that it struggles to generate code that addresses all features of the issue, resembling pagination or nested information buildings. To verify the LLM would cowl all the mandatory elements of the connector features, and since making a connector follows a set sequence of steps, immediate chaining was essentially the most pure strategy to enhance the generated code.
The chain we used for connector technology consists of the next high-level steps:
- Parse the information mannequin of the API response into prescribed TypeScript courses.
- Generate the perform for person flattening within the format anticipated by the connector interface.
- Perceive the pagination of the API specs and formulate a high-level answer.
- Generate the code for the
ListUsers
perform by combining all of the intermediate steps.
Step 1 is used as an enter to Step 2, however Step 3 is separate. Each Step 2 and Step 3 outcomes are fed to Step 4 for the ultimate consequence. The next diagram illustrates this workflow.
Within the following sections, we are going to dive into the prompting strategies we used for every of those steps.
System immediate
The system immediate is a vital part of LLM prompting that usually gives the preliminary context to information the mannequin’s response. For all of the prompts within the chain, we used the next system immediate:
Extra particularly, the system immediate is used to ascertain the function of the LLM (skilled net developer), give it a normal aim (perceive API specs and write TypeScript code), give high-level directions (add feedback within the code) and set boundaries (don’t make up info).
Information mannequin parsing
On this step, we immediate the LLM to know the construction of the API response and create TypeScript courses similar to the objects within the response. Though this step isn’t strictly mandatory for producing the response, it could assist the LLM immensely in producing an accurate connector. Much like chain-of-thought reasoning for arithmetic issues, it’s forcing the LLM to “assume” earlier than responding.
This step presents two main advantages:
- Verbose API response simplification – API responses specified within the documentation may be fairly verbose. By changing the response construction into TypeScript courses, we compress the data into fewer strains of code, making it extra concise and easier for the LLM to grasp. This step helps be certain that the important info is prominently displayed initially.
- Dealing with fragmented person responses – In some APIs, the person response consists of a number of fragments due to the reuse of knowledge buildings. The OpenAPI specification makes use of the
$ref
tag to reference these reusable elements. By changing the person response into TypeScript courses, we are able to consolidate all of the related info right into a single location. This consolidation simplifies the downstream steps by offering a centralized supply of data.
We use the next activity immediate to transform the API response into prescribed TypeScript courses:
Within the previous immediate template, the variable {api_spec}
is changed with the API specification of the endpoint. A particular instance for a DocuSign ListUsers
endpoint is supplied within the appendix.
The next code is an instance of the LLM-generated courses when utilized to the DocuSign API specs. This has been parsed out of the <data-model>
tags.
Person flattening perform technology
The anticipated construction for every person is an object consisting of two properties: an identifier and a dictionary of attributes. The attributes dictionary is a map that associates string keys with both primitive attributes (quantity, Boolean, or string) or an array of primitive attributes. due to the potential for arbitrarily nested JSON object buildings within the response, we use the capabilities of an LLM to generate a person flattening and conversion perform. Each the person ID and the attributes are extracted from the response. By using this strategy, we successfully separate the intricate activity of changing the person construction from the REST API response into the required format for the SailPoint connector SDK (hereafter known as the connector SDK).
The advantages of this strategy are twofold. First, it permits for a cleaner and extra modular code design, as a result of the complicated conversion course of is abstracted away from the principle code base. Second, it allows larger flexibility and adaptableness, as a result of the conversion perform may be modified or regenerated to accommodate adjustments within the API response construction or the connector SDK necessities, with out necessitating intensive modifications to the encircling code base.
We use the next immediate to generate the conversion perform, which takes as enter the information mannequin generated within the earlier step:
Within the previous immediate template, we substitute the {data_model}
variable with the information mannequin of TypeScript courses extracted within the earlier technology step of parsing the information mannequin.
The next code is an instance of the LLM-generated person flattening perform when utilized to the DocuSign API:
Pagination understanding
As talked about earlier, the REST API can implement a number of pagination schemes. Usually, the pagination particulars aren’t explicitly talked about. Throughout the growth of the chain, we discovered that when there are a number of pagination schemes, the LLM would combine up components of various pagination schemes and output code that isn’t coherent and generally additionally comprises errors. As a result of looping over the paged outcomes is an important step, we separate out this step within the code technology to let the LLM perceive the pagination scheme applied by the API and formulate its response at a excessive degree earlier than outputting the code. This enables the LLM to assume step-by-step in formulating the response. This step generates the intermediate reasoning, which is fed into the subsequent and ultimate step: producing the checklist customers perform code.
We use the next immediate to get the pagination logic. As a result of we’re utilizing Anthropic’s Claude Sonnet on Amazon Bedrock, we ask the LLM to output the logic in XML format, which is thought to be an environment friendly technique to construction info for that mannequin.
Within the previous immediate template, the variable {api_spec}
is changed with the API specification. An instance of the DocuSign API is supplied within the appendix on the finish of this publish. The variable {api_info}
may be changed with extra API documentation in pure language, which is left as an empty string within the DocuSign instance.
The next is the LLM’s response for the pagination logic extraction within the case of the DocuSign API, parsed out of the <pagination-logic>
tags:
ListUsers perform technology
This ultimate step within the chain combines the data extracted within the earlier steps along with the person flattening perform generated within the earlier steps to formulate the ultimate response, which is the TypeScript perform that retrieves a listing of customers from the supplied API.
We use the next immediate to generate the whole TypeScript perform:
On this immediate, we substitute {flatten_user_function}
with the flattenUser
that was generated earlier and {pagination_logic}
with the one which was generated earlier. We offer a template for the listUsers
perform to ensure the ultimate output meets the necessities for the connector perform. The ensuing output is the next listUsers
perform, which makes use of the flattenUser
perform from earlier:
Classes discovered
On this publish, we demonstrated how LLMs can tackle complicated code technology issues by using varied core prompting ideas and the immediate chaining approach. Though LLMs excel at following clearly outlined directions and producing small code snippets, this use case concerned a considerable quantity of contextual info within the type of API specs and person directions. Our findings from this train are the next:
- Decomposing complicated issues – Breaking down a posh code technology downside into a number of intermediate steps of decrease complexity enhances the LLM’s efficiency. Offering a single complicated immediate may end up in the LLM lacking some directions. The immediate chaining strategy enhances the robustness of the technology, sustaining higher adherence to directions.
- Iterative optimization – This technique permits for iterative optimization of intermediate steps. Every a part of the chain may be refined independently earlier than shifting to the subsequent step. LLMs may be delicate to minor adjustments in directions, and adjusting one facet can unintentionally have an effect on different goals. Immediate chaining presents a scientific technique to optimize every step independently.
- Dealing with complicated selections – Within the part on understanding pagination, we illustrated how LLMs can purpose via varied choices and make complicated selections earlier than producing code. As an example, when the enter API specification helps a number of pagination schemes, we prompted the LLM to resolve on the pagination strategy earlier than implementing the code. With direct code technology, with out utilizing an intermediate reasoning step, the LLM tended to combine components of various pagination schemes, leading to inconsistent output. By forcing decision-making first, in pure language, we achieved extra constant and correct code technology.
By means of automated code technology, SailPoint was in a position to dramatically cut back connector growth time from hours or days to mere minutes. The strategy additionally democratizes code growth, so that you don’t want deep TypeScript experience or intimate familiarity with SailPoint’s connector SDK. By accelerating connector technology, SailPoint considerably shortens the general buyer onboarding course of. This streamlined workflow not solely saves useful developer time but in addition allows sooner integration of various techniques, in the end permitting clients to make use of SailPoint’s id safety options extra quickly and successfully.
Conclusion
Our AI-powered answer for producing connector code opens up new prospects for integrating with REST APIs. By automating the creation of connectors from API specs, builders can quickly construct sturdy connections to any REST API, saving developer time and decreasing the time to worth for onboarding new clients. As demonstrated on this publish, this know-how can considerably streamline the method of working with various APIs, permitting groups to give attention to utilizing the information and performance these APIs present slightly than getting overwhelmed by connector code particulars. Take into account how such an answer may improve your personal API integration efforts—it might be the important thing to extra environment friendly and efficient use of the myriad APIs out there in immediately’s interconnected digital panorama.
Concerning the Authors
Erik Huckle is the product lead for AI at SailPoint, the place he works to unravel vital buyer issues within the id safety ecosystem via generative AI and information applied sciences. Previous to SailPoint, Erik co-founded a startup in robotic automation and later joined AWS as the primary product rent at Amazon One. Erik mentors native startups and serves as a board member and tech committee lead for a EdTech nonprofit group.
Tyler McDonnell is the engineering head of AI at SailPoint, the place he leads the event of AI options to drive innovation and impression in id safety world. Previous to SailPoint, Tyler led machine studying analysis and engineering groups at a number of early to late-stage startups and revealed work in domains spanning software program upkeep, info retrieval, and deep studying. He’s keen about constructing merchandise that use AI to convey optimistic impression to actual individuals and issues.
Anveshi Charuvaka is a Senior Utilized Scientist on the Generative AI Innovation Heart, the place he helps clients undertake Generative AI by implementing options for his or her vital enterprise challenges. With a PhD in Machine Studying and over a decade of expertise, he makes a speciality of making use of revolutionary machine studying and generative AI strategies to handle complicated real-world issues.
Aude Genevay is a Senior Utilized Scientist on the Generative AI Innovation Heart, the place she helps clients sort out vital enterprise challenges and create worth utilizing generative AI. She holds a PhD in theoretical machine studying and enjoys turning cutting-edge analysis into real-world options.
Mofijul Islam is an Utilized Scientist II on the AWS Generative AI Innovation Heart, the place he helps clients sort out complicated, customer-centric analysis challenges utilizing generative AI, giant language fashions (LLM), multi-agent studying, and multimodal studying. He holds a PhD in machine studying from the College of Virginia, the place his work targeted on multimodal machine studying, multilingual NLP, and multitask studying. His analysis has been revealed in top-tier conferences like NeurIPS, ICLR, AISTATS, and AAAI, in addition to IEEE and ACM Transactions.
Yasin Khatami is a Senior Utilized Scientist on the Generative AI Innovation Heart. With greater than a decade of expertise in synthetic intelligence (AI), he implements state-of-the-art AI merchandise for AWS clients to drive effectivity and worth for buyer platforms. His experience is in generative AI, giant language fashions (LLM), multi-agent strategies, and multimodal studying.
Karthik Ram is a Principal Options Architect with Amazon Internet Providers primarily based in Columbus, Ohio. He works with Impartial Software program Distributors (ISVs) to construct safe and revolutionary cloud options, together with serving to with their merchandise and fixing their enterprise issues utilizing data-driven approaches. Karthik’s space of depth is Cloud Safety with a give attention to Infrastructure Safety and menace detection.
Appendix
The next API specs have been used for the experiments on this publish: