Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In the next section we will show how a Sager can create and use their own agents with a “hello world” example.

Creating a Custom Agent

Login to Sage LLM AWS account

The first step will be connecting to the AWS account where custom agents are deployed and managed.

  1. Start by logging in with JumpCloud: https://console.jumpcloud.com/login

  2. Select: aws-sso-organization

    firefox_0wUGWTo0Dx.pngImage Removed

  3. Select: org-sagebase-synapsellm-prod

    firefox_yMCrGU2kh4.pngImage Removed

  4. Select: LlmDeveloper

  5. From the top right corner, ensure you are in us-east-1 (N. Virginia)

    firefox_QwF4I0ZwRJ.pngImage Removed

If you do not see option for: org-sagebase-synapsellm-prod and LLMDevelop, please open an IT ticket to request access to the account.

Create a Hello-World Agent

We will be using CloudFormation to handle all of the details of creating an our hello-world bedrock agent.

...

Code Block
languagejson
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "A simlesimple 'hello world' bedrock agent.",
  "Parameters": {
    "agentName": {
      "Description": "Provide a unique name for this bedrock agent.",
      "Type": "String",
      "AllowedPattern": "^([0-9a-zA-Z][_-]?){1,100}$"
    }
  },
  "Resources": {
    "bedrockAgent": {
      "Type": "AWS::Bedrock::Agent",
      "Properties": {
        "AgentName": {
          "Ref": "agentName"
        },
        "AgentResourceRoleArn": "arn:aws:iam::050451359079:role/bedrock-agent-role-bedrockAgentRole-uVdCv8WImmcJ",
        "AutoPrepare": true,
        "Description": "A simple 'hello world' bedrock agent that will reply with 'world' when given a 'hello'",
        "FoundationModel": "anthropic.claude-3-sonnet-20240229-v1:0",
        "IdleSessionTTLInSeconds": 3600,
        "Instruction": "You are a helpful test agent that when greeted with: 'hello' will always response with: 'world'",
        "SkipResourceInUseCheckOnDelete": true
      }
    }
  }
}

...

  1. Create a token file that contains your personal access token with the following template:

    Code Block
    languagetext
    Authorization: Bearer <paste youre personal access token here>
    Content-Type: application/json; charset=utf8
  2. Open a command prompt with access to curl and setup the following:

    Code Block
    curl -X PUT 'https://repo-prod.prod.sagebase.org/repo/v1/agent/registration' \
     -H @C:/Users/John/.synapse/non-admin-token.txt \
     -H "Content-Type: application/json; charset=utf8" \
     --data-raw '{"awsAgentId":"I6DE8ZTR25"}'
  1. You will need to replace: C:/Users/John/.synapse/non-admin-token.txt with the path to the token file you created in step 1.

  2. You will also need to replace the awsAgetnId with your own agent ID from step 17. of the previous section.

  3. Once curl command is setup correctly, pres enter to execute it. If successful you should receive a response similar to:

    Code Block
    languagejson
    {"agentRegistrationId":"9","awsAgentId":"I6DE8ZTR25","awsAliasId":"TSTALIASID","registeredOn":"2024-11-15T02:27:18.846Z","type":"CUSTOM"}

  4. Make sure that resulting awsAgentId matches your agent’s ID, and record the resulting agentRegistrationId.

  5. Now that we have an agent registration ID for our new agent we can test our agent in production using the following URL (replace the '9' with the agentrRegistrationId you received in step 5):

    Code Block
    https://www.synapse.org/Chat:initialMessage=hello&agentRegistrationId=9

...

Congratulations! At this point you have successfully created your new hello-world agent and successfully registered it with Synapse. Finally, by providing your agent registration ID in in the UI, you should have successfully started a new conversation with your agent in production Synapse!

...