Build Identity-Aware Agents With Amazon AgentCore and Descope

Build Identity-Aware Agents With Amazon AgentCore and Descope

Kevin Gao

Head of AI Strategy and DX

Table of Contents

Amazon Bedrock AgentCore is AWS’s managed platform for running agents in production. AgentCore Identity manages workload identities, stores credentials in a token vault, and validates inbound JWTs. This covers the needs of most agents that live in AWS.

Descope resolves this with cloud-neutral agent identity management, a credential vault that works across every runtime, and an authorization server that covers what Cognito doesn’t.

What Descope adds to AgentCore

The Descope Agentic Identity Hub provides several capabilities (Policies, Connections, cloud-neutral agent directory) that address specific gaps in AgentCore’s native identity capabilities.

Cloud-neutral agent directory

The Descope Agentic Identity Hub is a single repository for every agent in your fleet: the agent on AgentCore, the Vertex AI agent, the Foundry agent, the LangGraph prototype. Descope lets you manage these agents in the same directory, with one policy engine and unified audit trails.

One credential manager

Descope Connections vault OAuth tokens for third-party services and static API keys for internal systems. Descope also handles authentication for users. Federate your corporate IdP through SSO, and agent access dies with the directory account when someone leaves.

Resource authorization beyond Cognito

Your MCP servers and backend APIs need an authorization server. Descope MCP Auth implements the MCP authorization spec with OAuth 2.1, including DCR and Client ID Metadata Documents (CIMD).

Integrating Descope and AgentCore

To get started building with Descope and AgentCore:

  1. Create a Descope project. Sign up and copy your Project ID.
  2. Connect your corporate IdP. Follow the setup guide for your Corporate IdP within the SSO Setup Suite.
  3. Create an Agentic Client. Go to Clients, click + Add Client, and name it.
  4. Define your Resources. Go to Resources, and create an API or MCP Server resource.
  5. Configure Connections for services. Go to Connections and pick a third-party service or create a connection.
  6. Point AgentCore at Descope. Set discoveryUrl to your Discovery URL in your AgentCore deployment.

User authentication and agent invocation

First, create the Client in Descope that represents your Bedrock agent and configure Inbound Auth in the AWS console.

response = agentcore_runtime.configure(
    entrypoint="agentcore_agent.py",
    authorizer_configuration={
        "customJWTAuthorizer": {
            "discoveryUrl": f"https://api.descope.com/v1/apps/{os.getenv('DESCOPE_PROJECT_ID')}/.well-known/openid-configuration",
            "allowedClients": [os.getenv("DESCOPE_CLIENT_ID")],
            "allowedAudience": [os.getenv("DESCOPE_AUDIENCE")]
        }
    }
)

Fetching credentials inside agent tools

Inside agent tools, credential retrieval depends on the target. For Descope-protected resources, the agent performs OAuth Token Exchange.

def exchange_for_resource_token(user_access_token: str, resource: str, scopes: list[str]) -> str:
    # exchange user's access token for a scoped access token
    resp = requests.post(DESCOPE_TOKEN_URL, data={
        "grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
        "client_id": os.getenv("DESCOPE_CLIENT_ID"),
        "client_secret": os.getenv("DESCOPE_CLIENT_SECRET"),
        "subject_token": user_access_token,
        "resource": resource,
        "scope": " ".join(scopes),
    })
    return resp.json()["access_token"]

Start building with Descope and AgentCore

Descope gives them one identity layer across every cloud they touch, with policy evaluated at token issuance. Together, they separate where an agent runs from what it’s allowed to do.

FAQs on Amazon Bedrock AgentCore and Descope

What does Descope add to Amazon Bedrock AgentCore?

Descope provides a cloud-neutral agent directory, issuance-time policy enforcement, a credential vault that works across runtimes, and an OAuth 2.1 authorization server for your resources and MCP servers.