Skip to content

AWS Bedrock Agents: using the VIDAI Control Plane as the backend

Bedrock Agents themselves consume a foundation model that AWS serves natively. The pattern for routing through the control plane is to point your agent action groups' Lambda functions (or any downstream call your agent makes) at the control plane via the OpenAI-compatible endpoint. The agent's orchestration prompts still run on Bedrock's native foundation model; every downstream tool call the agent makes flows through us.

TL;DR — Action-group Lambda

Inside an action-group Lambda that needs to call an LLM:

import os
from openai import OpenAI

client = OpenAI(
    base_url=os.environ["VIDAI_BASE_URL"],   # https://your-vidai-server.example.com/v1
    api_key=os.environ["VIDAI_API_KEY"],
)

def lambda_handler(event, context):
    resp = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": event["input"]}],
    )
    return {"response": resp.choices[0].message.content}

Set VIDAI_BASE_URL and VIDAI_API_KEY as Lambda environment variables (encrypted with KMS, or fetched from Secrets Manager at cold-start).

Prerequisites

  • An AWS account with Bedrock enabled and permission to create Agent action groups.
  • Lambda function backing the action group with internet egress to your control plane URL (VPC endpoint or public routing).
  • Control plane base URL and an API key from API Keys.

Attribution

Every downstream call from the Lambda authenticates with the single VIDAI API key stored in the function's env or Secrets Manager. Create an application on the Applications page named after the Bedrock agent (e.g. bedrock-support-agent), mint an agent inside it, and use that agent's key. The "Chargeback by application" section on the Chargeback tab then reports the Bedrock agent's spend as its own line item.

Using a non-Bedrock model for the agent itself

Bedrock Agent's orchestration model must be a Bedrock-hosted foundation model — that call doesn't go through the control plane. If you want the orchestration model routed too, model your agent in a framework that runs outside Bedrock (LangGraph, CrewAI, AutoGen, OpenAI Agents SDK) — each has its own guide in this section — and use Bedrock only as an upstream provider on the control plane's Providers page.

Custom Bedrock Marketplace models

Models published via Bedrock Marketplace (with an SDK-compatible inference endpoint) can be called from Bedrock alongside foundation models. If you use them from your action-group Lambda, the pattern above applies unchanged.

Verify it works

Test the action group directly in the Bedrock console:

  1. Open your agent → Test.
  2. Trigger an intent that invokes the action group.
  3. Check CloudWatch for the Lambda logs and confirm the OpenAI client call returned.
  4. Check the control plane's Request Logs for a row attributed to the Lambda's API key.

If something's off

Raise an issue at github.com/vidaiUK/vidai-quickstart/issues with the Lambda config (masking key + region) and the CloudWatch log excerpt around the failing call. We'll get it sorted.

Where to go next