Nodes/ComfyUI Griptape Nodes/Griptape Prompt Driver: Amazon Bedrock
ComfyUI Node

Griptape Prompt Driver: Amazon Bedrock

Put Claude and Titan inside a Griptape agent via AWS Bedrock

By griptape-ai·Created 2 years ago·Updated about a year ago· 238
Griptape Prompt Driver: Amazon Bedrock
    • DRIVER
    modelanthropic.claude-3-5-sonnet-20240620-v1:0
    max_attempts_on_fail2
    temperature0.10
    seed10342349342
    use_native_toolstrue
    max_tokens100
    min_p0.10
    top_k40
    aws_access_key_id_env_varAWS_ACCESS_KEY_ID
    aws_secret_access_key_env_varAWS_SECRET_ACCESS_KEY
    aws_default_region_env_varAWS_DEFAULT_REGION

    Every Griptape agent needs a brain, and the prompt driver is that brain. This is the version for Amazon Bedrock - which means it's for people who already live in AWS, because the setup is all AWS credentials and API access, not a friendly chat-app key. If you're not on AWS, this node is not for you. If you are, it's the cleanest way to make Claude or Titan models the reasoning engine of a ComfyUI workflow.

    Bedrock is worth knowing about even if you never touch this node: it's how AWS serves hosted Anthropic and Amazon models with per-request pricing and enterprise agreements. You get Anthropic's Claude 3.5 Sonnet and Opus, plus Amazon's own Titan text models, all behind one API.

    How it works

    The node builds a Griptape AmazonBedrockPromptDriver - the object that tells a Griptape agent how to call the model. It reads your AWS credentials from environment variables (or from the pack's Settings page), passes your sampling preferences along, and hands you the ready-made driver on its DRIVER output. Wire that into any agent configuration node or RAG module that accepts a PROMPT_DRIVER, and the agent suddenly thinks with Bedrock.

    The inputs that matter

    The driver exposes a lot, but a beginner only touches a few:

    • model - a dropdown. Default is anthropic.claude-3-5-sonnet-20240620-v1:0, with the other Claude 3 models and Titan text models listed. Pick by cost: Sonnet for daily work, Haiku when you're churning, Opus when quality matters more than the bill.
    • max_tokens - here's the one the author calls out: Bedrock tends to fail if this isn't given. The default is 100, which is fine for short answers but throttles anything long. If your agent replies seem cut off, raise this.
    • The three AWS fields: aws_access_key_id_env_var, aws_secret_access_key_env_var, and aws_default_region_env_var. These take the name of the environment variable, not the key itself - defaults of AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION are right unless you've named yours differently.

    temperature, seed, top_k, min_p, and max_attempts_on_fail are there for fine-tuning but the defaults are sane. The single output is DRIVER (type PROMPT_DRIVER).

    Installing it

    The pack install is the same as every Griptape node: ComfyUI Manager → search GriptapeComfyUI-Griptape → Install, then restart. Manual clone:

    cd ComfyUI/custom_nodes
    git clone https://github.com/griptape-ai/ComfyUI-Griptape
    

    Then add your AWS keys. You can set them in the pack's Settings page (Settings → Griptape), or export them in your environment before launching ComfyUI - the pack will pick up existing environment values automatically.

    Common issues

    The trap here is the env-var fields: type the variable name, not your actual key. Paste a real key into aws_access_key_id_env_var and the driver will look up an environment variable that doesn't exist and fail confusingly. Region matters too - make sure the region in AWS_DEFAULT_REGION is where your Bedrock models are enabled, or you'll get access-denied errors even with valid credentials.

    And the pack-wide gotcha: griptape[all] can clobber ComfyUI's torch on Nvidia boxes. If ComfyUI breaks after install, pip uninstall torch then pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121 fixes it.

    CategoryGriptape/Agent Drivers/Prompt

    Inputs (11)

    NameTypeDefaultDescription
    modeloptCOMBOanthropic.claude-3-5-sonnet-20240620-v1:07 options: anthropic.claude-3-5-sonnet-20240620-v1:0, anthropic.claude-3-opus-20240229-v1:0, anthropic.claude-3-sonnet-20240229-v1:0, anthropic.claude-3-haiku-20240307-v1:0, amazon.titan-text-premier-v1:0, amazon.titan-text-express-v1, +1
    max_attempts_on_failoptINT21–100Maximum attempts on failure
    temperatureoptFLOAT0.100–1Temperature for sampling
    seedoptINT10342349342Seed for random number generation
    use_native_toolsoptBOOLEANtrueUse native tools for the LLM.
    max_tokensoptINT100Maximum tokens to generate. Amazon Bedrock tends to fail if this isn't given.
    min_poptFLOAT0.100–1Minimum probability for sampling. Lower values will be more random.
    top_koptINT40Top k for sampling. Lower values are more deterministic.
    aws_access_key_id_env_varoptSTRINGAWS_ACCESS_KEY_IDEnter the name of the environment variable for your AWS_ACCESS_KEY_ID, not your actual key.
    aws_secret_access_key_env_varoptSTRINGAWS_SECRET_ACCESS_KEYEnter the name of the environment variable for your AWS_SECRET_ACCESS_KEY, not your actual key.
    aws_default_region_env_varoptSTRINGAWS_DEFAULT_REGIONEnter the name of the environment variable for your AWS_DEFAULT_REGION, not your actual region.

    Outputs (1)

    NameTypeDescription
    DRIVERPROMPT_DRIVER