bedrock-agentcore 0.1.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -114
- package/dist/src/_utils/endpoints.d.ts +28 -0
- package/dist/src/_utils/endpoints.d.ts.map +1 -0
- package/dist/src/_utils/endpoints.js +44 -0
- package/dist/src/_utils/endpoints.js.map +1 -0
- package/dist/src/identity/client.d.ts +40 -0
- package/dist/src/identity/client.d.ts.map +1 -0
- package/dist/src/identity/client.js +109 -0
- package/dist/src/identity/client.js.map +1 -0
- package/dist/src/identity/index.d.ts +22 -0
- package/dist/src/identity/index.d.ts.map +1 -0
- package/dist/src/identity/index.js +24 -0
- package/dist/src/identity/index.js.map +1 -0
- package/dist/src/identity/types.d.ts +82 -0
- package/dist/src/identity/types.d.ts.map +1 -0
- package/dist/src/identity/types.js +5 -0
- package/dist/src/identity/types.js.map +1 -0
- package/dist/src/identity/wrappers.d.ts +54 -0
- package/dist/src/identity/wrappers.d.ts.map +1 -0
- package/dist/src/identity/wrappers.js +95 -0
- package/dist/src/identity/wrappers.js.map +1 -0
- package/dist/src/runtime/app.d.ts +144 -0
- package/dist/src/runtime/app.d.ts.map +1 -0
- package/dist/src/runtime/app.js +485 -0
- package/dist/src/runtime/app.js.map +1 -0
- package/dist/src/runtime/client.d.ts +154 -0
- package/dist/src/runtime/client.d.ts.map +1 -0
- package/dist/src/runtime/client.js +319 -0
- package/dist/src/runtime/client.js.map +1 -0
- package/dist/src/runtime/context.d.ts +33 -0
- package/dist/src/runtime/context.d.ts.map +1 -0
- package/dist/src/runtime/context.js +49 -0
- package/dist/src/runtime/context.js.map +1 -0
- package/dist/src/runtime/index.d.ts +8 -0
- package/dist/src/runtime/index.d.ts.map +1 -0
- package/dist/src/runtime/index.js +7 -0
- package/dist/src/runtime/index.js.map +1 -0
- package/dist/src/runtime/types.d.ts +429 -0
- package/dist/src/runtime/types.d.ts.map +1 -0
- package/dist/src/runtime/types.js +26 -0
- package/dist/src/runtime/types.js.map +1 -0
- package/dist/src/tools/browser/client.d.ts +19 -0
- package/dist/src/tools/browser/client.d.ts.map +1 -1
- package/dist/src/tools/browser/client.js +56 -0
- package/dist/src/tools/browser/client.js.map +1 -1
- package/dist/src/tools/browser/index.d.ts +1 -1
- package/dist/src/tools/browser/index.d.ts.map +1 -1
- package/dist/src/tools/browser/index.js.map +1 -1
- package/dist/src/tools/browser/integrations/strands/click-tool.d.ts +20 -0
- package/dist/src/tools/browser/integrations/strands/click-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/click-tool.js +33 -0
- package/dist/src/tools/browser/integrations/strands/click-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/evaluate-tool.d.ts +20 -0
- package/dist/src/tools/browser/integrations/strands/evaluate-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/evaluate-tool.js +34 -0
- package/dist/src/tools/browser/integrations/strands/evaluate-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/get-html-tool.d.ts +19 -0
- package/dist/src/tools/browser/integrations/strands/get-html-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/get-html-tool.js +32 -0
- package/dist/src/tools/browser/integrations/strands/get-html-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/get-text-tool.d.ts +19 -0
- package/dist/src/tools/browser/integrations/strands/get-text-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/get-text-tool.js +32 -0
- package/dist/src/tools/browser/integrations/strands/get-text-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/index.d.ts +25 -0
- package/dist/src/tools/browser/integrations/strands/index.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/index.js +25 -0
- package/dist/src/tools/browser/integrations/strands/index.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/navigate-tool.d.ts +21 -0
- package/dist/src/tools/browser/integrations/strands/navigate-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/navigate-tool.js +41 -0
- package/dist/src/tools/browser/integrations/strands/navigate-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/screenshot-tool.d.ts +29 -0
- package/dist/src/tools/browser/integrations/strands/screenshot-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/screenshot-tool.js +52 -0
- package/dist/src/tools/browser/integrations/strands/screenshot-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/tools.d.ts +119 -0
- package/dist/src/tools/browser/integrations/strands/tools.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/tools.js +141 -0
- package/dist/src/tools/browser/integrations/strands/tools.js.map +1 -0
- package/dist/src/tools/browser/integrations/strands/type-tool.d.ts +22 -0
- package/dist/src/tools/browser/integrations/strands/type-tool.d.ts.map +1 -0
- package/dist/src/tools/browser/integrations/strands/type-tool.js +37 -0
- package/dist/src/tools/browser/integrations/strands/type-tool.js.map +1 -0
- package/dist/src/tools/browser/integrations/vercel-ai/tools.d.ts +1 -1
- package/dist/src/tools/browser/integrations/vercel-ai/tools.js +1 -1
- package/dist/src/tools/browser/live-view/BrowserLiveView.d.ts +10 -0
- package/dist/src/tools/browser/live-view/BrowserLiveView.d.ts.map +1 -0
- package/dist/src/tools/browser/live-view/BrowserLiveView.js +180 -0
- package/dist/src/tools/browser/live-view/BrowserLiveView.js.map +1 -0
- package/dist/src/tools/browser/live-view/index.d.ts +4 -0
- package/dist/src/tools/browser/live-view/index.d.ts.map +1 -0
- package/dist/src/tools/browser/live-view/index.js +3 -0
- package/dist/src/tools/browser/live-view/index.js.map +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/README.md +26 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcv-ui/EULA.txt +403 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcv-ui/README.md +57 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcv-ui/dcv-ui.js +7 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcv-ui/third-party-licenses.txt +145 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/EULA.txt +403 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/README.md +50 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/dcv/broadwayh264decoder-worker.js +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/dcv/jsmpegdecoder-worker.js +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/dcv/lz4decoder-worker.js +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/dcv/microphoneprocessor.js +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/dcv.js +33 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/lib/broadway/Decoder.js +850 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/lib/jsmpeg/jsmpeg.min.js +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/lib/lz4/lz4_decoder.js +12 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-esm/third-party-licenses.txt +1068 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/EULA.txt +403 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/README.md +50 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/dcv/broadwayh264decoder-worker.js +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/dcv/jsmpegdecoder-worker.js +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/dcv/lz4decoder-worker.js +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/dcv/microphoneprocessor.js +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/dcv.js +33 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/lib/broadway/Decoder.js +850 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/lib/jsmpeg/jsmpeg.min.js +1 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/lib/lz4/lz4_decoder.js +12 -0
- package/dist/src/tools/browser/live-view/nice-dcv-web-client-sdk/dcvjs-umd/third-party-licenses.txt +1068 -0
- package/dist/src/tools/browser/live-view/scaling.d.ts +9 -0
- package/dist/src/tools/browser/live-view/scaling.d.ts.map +1 -0
- package/dist/src/tools/browser/live-view/scaling.js +13 -0
- package/dist/src/tools/browser/live-view/scaling.js.map +1 -0
- package/dist/src/tools/browser/types.d.ts +152 -0
- package/dist/src/tools/browser/types.d.ts.map +1 -1
- package/dist/src/tools/code-interpreter/client.d.ts +2 -0
- package/dist/src/tools/code-interpreter/client.d.ts.map +1 -1
- package/dist/src/tools/code-interpreter/client.js +31 -25
- package/dist/src/tools/code-interpreter/client.js.map +1 -1
- package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.d.ts +28 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.js +47 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-code-tool.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.d.ts +27 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.js +42 -0
- package/dist/src/tools/code-interpreter/integrations/strands/execute-command-tool.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.d.ts +33 -0
- package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.js +78 -0
- package/dist/src/tools/code-interpreter/integrations/strands/file-operations-tool.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/index.d.ts +32 -0
- package/dist/src/tools/code-interpreter/integrations/strands/index.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/index.js +32 -0
- package/dist/src/tools/code-interpreter/integrations/strands/index.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/tools.d.ts +94 -0
- package/dist/src/tools/code-interpreter/integrations/strands/tools.d.ts.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/strands/tools.js +112 -0
- package/dist/src/tools/code-interpreter/integrations/strands/tools.js.map +1 -0
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.d.ts +2 -2
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-code-tool.js +2 -2
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.d.ts +2 -2
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/execute-command-tool.js +2 -2
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.d.ts +3 -3
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/file-operations-tool.js +2 -2
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.d.ts +1 -1
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/index.js +1 -1
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.d.ts +1 -1
- package/dist/src/tools/code-interpreter/integrations/vercel-ai/tools.js +1 -1
- package/package.json +69 -14
package/README.md
CHANGED
|
@@ -1,156 +1,144 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
</
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
Bedrock AgentCore SDK
|
|
10
|
-
</h1>
|
|
11
|
-
|
|
12
|
-
<h2>
|
|
13
|
-
Deploy your local AI agent to Bedrock AgentCore with zero infrastructure
|
|
14
|
-
</h2>
|
|
15
|
-
|
|
16
|
-
<div align="center">
|
|
17
|
-
<a href="https://github.com/aws/bedrock-agentcore-sdk-typescript/graphs/commit-activity"><img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/aws/bedrock-agentcore-sdk-typescript"/></a>
|
|
18
|
-
<a href="https://github.com/aws/bedrock-agentcore-sdk-typescript/issues"><img alt="GitHub open issues" src="https://img.shields.io/github/issues/aws/bedrock-agentcore-sdk-typescript"/></a>
|
|
19
|
-
<a href="https://github.com/aws/bedrock-agentcore-sdk-typescript/pulls"><img alt="GitHub open pull requests" src="https://img.shields.io/github/issues-pr/aws/bedrock-agentcore-sdk-typescript"/></a>
|
|
20
|
-
<a href="https://github.com/aws/bedrock-agentcore-sdk-typescript/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/aws/bedrock-agentcore-sdk-typescript"/></a>
|
|
21
|
-
<a href="https://www.npmjs.com/package/bedrock-agentcore"><img alt="npm version" src="https://img.shields.io/npm/v/bedrock-agentcore"/></a>
|
|
22
|
-
<a href="https://nodejs.org"><img alt="Node.js versions" src="https://img.shields.io/node/v/bedrock-agentcore"/></a>
|
|
23
|
-
</div>
|
|
2
|
+
<a href="https://aws.amazon.com/bedrock/agentcore/">
|
|
3
|
+
<img width="150" height="150" alt="Bedrock AgentCore" src="https://github.com/user-attachments/assets/b8b9456d-c9e2-45e1-ac5b-760f21f1ac18" />
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
<h1>Bedrock AgentCore SDK for TypeScript</h1>
|
|
7
|
+
|
|
8
|
+
<p>Deploy AI agents to AWS with VM-level isolation and zero infrastructure</p>
|
|
24
9
|
|
|
25
10
|
<p>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
◆ <a href="https://github.com/aws/bedrock-agentcore-sdk-typescript">TypeScript SDK</a>
|
|
32
|
-
◆ <a href="https://github.com/aws/bedrock-agentcore-starter-toolkit">Starter Toolkit</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/bedrock-agentcore"><img alt="npm version" src="https://img.shields.io/npm/v/bedrock-agentcore"/></a>
|
|
12
|
+
<a href="https://www.typescriptlang.org/"><img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-5.5+-blue"/></a>
|
|
13
|
+
<a href="https://nodejs.org/"><img alt="Node.js" src="https://img.shields.io/badge/Node.js-20+-green"/></a>
|
|
14
|
+
<a href="https://github.com/aws/bedrock-agentcore-sdk-typescript/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/badge/License-Apache%202.0-blue"/></a>
|
|
15
|
+
</p>
|
|
33
16
|
|
|
17
|
+
<p>
|
|
18
|
+
<a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/what-is-bedrock-agentcore.html">Documentation</a>
|
|
19
|
+
|
|
|
20
|
+
<a href="https://github.com/awslabs/bedrock-agentcore-samples-typescript">Samples</a>
|
|
21
|
+
|
|
|
22
|
+
<a href="https://github.com/aws/bedrock-agentcore-sdk-python">Python SDK</a>
|
|
34
23
|
</p>
|
|
35
24
|
</div>
|
|
36
25
|
|
|
37
|
-
|
|
38
|
-
Amazon Bedrock AgentCore enables you to deploy and operate highly effective agents securely, at scale using any framework and model. With Amazon Bedrock AgentCore, developers can accelerate AI agents into production with the scale, reliability, and security, critical to real-world deployment. AgentCore provides tools and capabilities to make agents more effective and capable, purpose-built infrastructure to securely scale agents, and controls to operate trustworthy agents. Amazon Bedrock AgentCore services are composable and work with popular open-source frameworks and any model, so you don’t have to choose between open-source flexibility and enterprise-grade security and reliability.
|
|
39
|
-
|
|
40
|
-
**What you get with Bedrock AgentCore:**
|
|
41
|
-
- ✅ **Keep your agent logic** - Works with Strands, LangGraph, CrewAI, Autogen, custom frameworks
|
|
42
|
-
- ✅ **Zero infrastructure management** - No servers, containers, or scaling concerns
|
|
43
|
-
- ✅ **Enterprise-grade platform** - Built-in auth, memory, observability, security
|
|
44
|
-
- ✅ **Production-ready deployment** - Reliable, scalable, compliant hosting
|
|
26
|
+
---
|
|
45
27
|
|
|
46
|
-
##
|
|
47
|
-
- 🚀 **Runtime** - Secure and session isolated compute: **[Runtime Quick Start](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-get-started-toolkit.html)**
|
|
48
|
-
- 🧠 **Memory** - Persistent knowledge across sessions: **[Memory Quick Start](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/memory-get-started.html)**
|
|
49
|
-
- 🔗 **Gateway** - Transform APIs into MCP tools: **[Gateway Quick Start](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-quick-start.html)**
|
|
50
|
-
- 💻 **Code Interpreter** - Secure sandboxed execution: **[Code Interpreter Quick Start](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter-getting-started.html)**
|
|
51
|
-
- 🌐 **Browser** - Cloud-based web automation: **[Browser Quick Start](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/browser-onboarding.html)**
|
|
52
|
-
- 📊 **Observability** - OpenTelemetry tracing: **[Observability Quick Start](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/observability-get-started.html)**
|
|
53
|
-
- 🔐 **Identity** - AWS & third-party auth: **[Identity Quick Start](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/identity-getting-started-cognito.html)**
|
|
28
|
+
## Why AgentCore?
|
|
54
29
|
|
|
55
|
-
|
|
30
|
+
- **Zero infrastructure** — No servers to provision, no containers to manage, no scaling to configure.
|
|
31
|
+
- **Session isolation** — Each agent session runs in its own VM. No shared state, no noisy neighbors.
|
|
32
|
+
- **Long-lived sessions** — Sessions persist across requests. Your agent maintains context without external storage.
|
|
33
|
+
- **Managed tools** — Secure code execution and browser automation, ready to use.
|
|
34
|
+
- **Credential management** — Centralized API keys and OAuth tokens, injected at runtime.
|
|
56
35
|
|
|
57
|
-
|
|
36
|
+
### Framework Compatibility
|
|
58
37
|
|
|
59
|
-
|
|
38
|
+
The SDK is designed to work with any agent framework. Here's how:
|
|
60
39
|
|
|
61
|
-
|
|
62
|
-
|
|
40
|
+
- **Runtime** — Deploy agents built with any framework. The `BedrockAgentCoreApp` accepts any request handler — plug in [Strands Agents](https://strandsagents.com), [Vercel AI SDK](https://ai-sdk.dev), [LangChain](https://js.langchain.com), or your own custom logic.
|
|
41
|
+
- **Tools** — Code Interpreter and Browser tools include built-in integrations for [Strands Agents](https://strandsagents.com) and [Vercel AI SDK](https://ai-sdk.dev), so tools can be passed directly to those frameworks' agents. For other frameworks, use the core clients (`CodeInterpreter`, `PlaywrightBrowser`) directly and wire them into your own tool definitions.
|
|
42
|
+
- **Identity** — Credential wrappers (`withAccessToken`, `withApiKey`) work with any async function, regardless of framework.
|
|
63
43
|
|
|
64
|
-
|
|
65
|
-
// Core client (framework-agnostic)
|
|
66
|
-
import { CodeInterpreterClient } from 'bedrock-agentcore/code-interpreter'
|
|
67
|
-
// Methods: startSession, stopSession, executeCode, writeFiles, readFiles,
|
|
68
|
-
// listFiles, deleteFiles, executeCommand
|
|
69
|
-
```
|
|
44
|
+
---
|
|
70
45
|
|
|
71
|
-
|
|
72
|
-
Automate web browsing with cloud-based browser automation (compatible with Playwright, Puppeteer, and other browser automation SDKs):
|
|
46
|
+
## Quick Start
|
|
73
47
|
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
import { PlaywrightBrowser } from 'bedrock-agentcore/browser/playwright'
|
|
77
|
-
// Methods: startSession, stopSession, navigate, click, fill, type, getText,
|
|
78
|
-
// getHtml, screenshot, evaluate, waitForSelector, back, forward
|
|
48
|
+
```bash
|
|
49
|
+
npm install bedrock-agentcore @strands-agents/sdk
|
|
79
50
|
```
|
|
80
51
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
### Installation
|
|
52
|
+
```typescript
|
|
53
|
+
import { BedrockAgentCoreApp } from 'bedrock-agentcore/runtime'
|
|
54
|
+
import { Agent, BedrockModel } from '@strands-agents/sdk'
|
|
55
|
+
import { z } from 'zod'
|
|
86
56
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
57
|
+
const agent = new Agent({
|
|
58
|
+
model: new BedrockModel({ modelId: 'global.amazon.nova-2-lite-v1:0' }),
|
|
59
|
+
})
|
|
90
60
|
|
|
91
|
-
|
|
92
|
-
|
|
61
|
+
const app = new BedrockAgentCoreApp({
|
|
62
|
+
invocationHandler: {
|
|
63
|
+
requestSchema: z.object({ prompt: z.string() }),
|
|
64
|
+
process: async function* (request) {
|
|
65
|
+
for await (const event of agent.stream(request.prompt)) {
|
|
66
|
+
if (event.type === 'modelContentBlockDeltaEvent' && event.delta?.type === 'textDelta') {
|
|
67
|
+
yield { event: 'message', data: { text: event.delta.text } }
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
})
|
|
93
73
|
|
|
94
|
-
|
|
95
|
-
npm install playwright
|
|
74
|
+
app.run()
|
|
96
75
|
```
|
|
97
76
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
- Access to any large language model like models available in AWS Bedrock
|
|
77
|
+
`BedrockAgentCoreApp` creates an AgentCore Runtime-compliant server—handling request parsing, streaming responses, and session management for seamless deployment.
|
|
78
|
+
|
|
79
|
+
---
|
|
102
80
|
|
|
81
|
+
## Tools
|
|
103
82
|
|
|
104
|
-
|
|
83
|
+
Give your agent secure code execution with three lines:
|
|
105
84
|
|
|
106
85
|
```typescript
|
|
107
|
-
import {
|
|
108
|
-
import {
|
|
109
|
-
import { CodeInterpreterTools } from 'bedrock-agentcore/code-interpreter/vercel-ai'
|
|
110
|
-
import { BrowserTools } from 'bedrock-agentcore/browser/vercel-ai'
|
|
111
|
-
|
|
112
|
-
const codeInterpreter = new CodeInterpreterTools()
|
|
113
|
-
const browser = new BrowserTools()
|
|
114
|
-
|
|
115
|
-
const agent = new ToolLoopAgent({
|
|
116
|
-
model: bedrock('global.anthropic.claude-sonnet-4-20250514-v1:0'),
|
|
117
|
-
tools: {
|
|
118
|
-
...codeInterpreter.tools,
|
|
119
|
-
...browser.tools,
|
|
120
|
-
},
|
|
121
|
-
})
|
|
86
|
+
import { CodeInterpreterTools } from 'bedrock-agentcore/experimental/code-interpreter/strands'
|
|
87
|
+
import { Agent, BedrockModel } from '@strands-agents/sdk'
|
|
122
88
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
89
|
+
const codeInterpreter = new CodeInterpreterTools({ region: 'us-east-1' })
|
|
90
|
+
|
|
91
|
+
const agent = new Agent({
|
|
92
|
+
model: new BedrockModel({ modelId: 'global.amazon.nova-2-lite-v1:0' }),
|
|
93
|
+
tools: codeInterpreter.tools,
|
|
126
94
|
})
|
|
127
95
|
|
|
128
|
-
|
|
96
|
+
// Agent can now execute code in a secure sandboxed environment
|
|
129
97
|
```
|
|
130
98
|
|
|
131
|
-
|
|
99
|
+
---
|
|
132
100
|
|
|
133
|
-
##
|
|
101
|
+
## Features
|
|
134
102
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
103
|
+
- **Runtime** — Secure, session-isolated compute → [Examples](https://github.com/awslabs/bedrock-agentcore-samples-typescript/tree/main/primitives/runtime)
|
|
104
|
+
- **Code Interpreter** — Execute Python/JS/TS in a sandbox → [Examples](https://github.com/awslabs/bedrock-agentcore-samples-typescript/tree/main/primitives/tools/code-interpreter)
|
|
105
|
+
- **Browser** — Cloud-based web automation → [Examples](https://github.com/awslabs/bedrock-agentcore-samples-typescript/tree/main/primitives/tools/browser)
|
|
106
|
+
- **Identity** — Manage API keys and OAuth tokens → [Examples](https://github.com/awslabs/bedrock-agentcore-samples-typescript/tree/main/primitives/identity)
|
|
107
|
+
- **Memory** — Persistent knowledge across sessions (coming soon)
|
|
108
|
+
- **Gateway** — Transform APIs into MCP tools (coming soon)
|
|
109
|
+
- **Observability** — OpenTelemetry tracing (coming soon)
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Installation
|
|
139
114
|
|
|
140
|
-
Or try the Next.js app with streaming UI:
|
|
141
115
|
```bash
|
|
142
|
-
|
|
116
|
+
npm install bedrock-agentcore
|
|
143
117
|
```
|
|
144
118
|
|
|
145
|
-
## 🏗️ Deployment
|
|
146
119
|
|
|
147
|
-
|
|
120
|
+
**Prerequisites:** Node.js 20+, [AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), [AgentCore access](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-regions.html)
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Deployment
|
|
125
|
+
|
|
126
|
+
- [Sample Applications](https://github.com/awslabs/bedrock-agentcore-samples-typescript) — Working examples with deployment templates
|
|
127
|
+
- [CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/AWS_BedrockAgentCore.html) — Infrastructure as code
|
|
128
|
+
- [AWS CDK](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore-readme.html) — Infrastructure as code
|
|
129
|
+
- [Deployment Guide](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/getting-started-custom.html) — Step-by-step walkthrough
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Resources
|
|
134
|
+
|
|
135
|
+
- [AgentCore Documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/what-is-bedrock-agentcore.html)
|
|
136
|
+
- [Python SDK](https://github.com/aws/bedrock-agentcore-sdk-python)
|
|
148
137
|
|
|
149
|
-
|
|
138
|
+
---
|
|
150
139
|
|
|
140
|
+
## License
|
|
151
141
|
|
|
152
|
-
|
|
142
|
+
Apache 2.0 — see [LICENSE](LICENSE)
|
|
153
143
|
|
|
154
|
-
|
|
155
|
-
- **Contributing:** See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
156
|
-
- **Security:** See [SECURITY.md](SECURITY.md)
|
|
144
|
+
[Contributing](CONTRIBUTING.md) · [Security](SECURITY.md)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for constructing AWS service endpoints.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Gets the data plane endpoint for the Bedrock AgentCore service.
|
|
6
|
+
*
|
|
7
|
+
* The endpoint can be overridden using the BEDROCK_AGENTCORE_DATA_PLANE_ENDPOINT
|
|
8
|
+
* environment variable. Otherwise, it follows the standard AWS endpoint pattern.
|
|
9
|
+
*
|
|
10
|
+
* @param region - AWS region (e.g., 'us-west-2', 'us-east-1')
|
|
11
|
+
* @returns Full HTTPS endpoint URL
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const endpoint = getDataPlaneEndpoint('us-west-2')
|
|
16
|
+
* // Returns: 'https://bedrock-agentcore.us-west-2.amazonaws.com'
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* With environment variable override:
|
|
21
|
+
* ```typescript
|
|
22
|
+
* process.env.BEDROCK_AGENTCORE_DATA_PLANE_ENDPOINT = 'https://custom-endpoint.example.com'
|
|
23
|
+
* const endpoint = getDataPlaneEndpoint('us-west-2')
|
|
24
|
+
* // Returns: 'https://custom-endpoint.example.com'
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function getDataPlaneEndpoint(region: string): string;
|
|
28
|
+
//# sourceMappingURL=endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../src/_utils/endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAc3D"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for constructing AWS service endpoints.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Environment variable for overriding the data plane endpoint.
|
|
6
|
+
*/
|
|
7
|
+
const ENDPOINT_OVERRIDE_ENV = 'BEDROCK_AGENTCORE_DATA_PLANE_ENDPOINT';
|
|
8
|
+
/**
|
|
9
|
+
* Gets the data plane endpoint for the Bedrock AgentCore service.
|
|
10
|
+
*
|
|
11
|
+
* The endpoint can be overridden using the BEDROCK_AGENTCORE_DATA_PLANE_ENDPOINT
|
|
12
|
+
* environment variable. Otherwise, it follows the standard AWS endpoint pattern.
|
|
13
|
+
*
|
|
14
|
+
* @param region - AWS region (e.g., 'us-west-2', 'us-east-1')
|
|
15
|
+
* @returns Full HTTPS endpoint URL
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const endpoint = getDataPlaneEndpoint('us-west-2')
|
|
20
|
+
* // Returns: 'https://bedrock-agentcore.us-west-2.amazonaws.com'
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* With environment variable override:
|
|
25
|
+
* ```typescript
|
|
26
|
+
* process.env.BEDROCK_AGENTCORE_DATA_PLANE_ENDPOINT = 'https://custom-endpoint.example.com'
|
|
27
|
+
* const endpoint = getDataPlaneEndpoint('us-west-2')
|
|
28
|
+
* // Returns: 'https://custom-endpoint.example.com'
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function getDataPlaneEndpoint(region) {
|
|
32
|
+
// Validate region is not empty
|
|
33
|
+
if (!region || region.trim() === '') {
|
|
34
|
+
throw new Error('Region cannot be empty');
|
|
35
|
+
}
|
|
36
|
+
// Check for environment variable override
|
|
37
|
+
const override = process.env[ENDPOINT_OVERRIDE_ENV];
|
|
38
|
+
if (override) {
|
|
39
|
+
return override;
|
|
40
|
+
}
|
|
41
|
+
// Return standard AWS endpoint pattern
|
|
42
|
+
return `https://bedrock-agentcore.${region}.amazonaws.com`;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../../src/_utils/endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,qBAAqB,GAAG,uCAAuC,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,+BAA+B;IAC/B,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC3C,CAAC;IAED,0CAA0C;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;IACnD,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,uCAAuC;IACvC,OAAO,6BAA6B,MAAM,gBAAgB,CAAA;AAC5D,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IdentityClient for AgentCore Identity operations
|
|
3
|
+
*/
|
|
4
|
+
import type { OAuth2TokenRequest, ApiKeyRequest } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Client for interacting with Amazon Bedrock AgentCore Identity service.
|
|
7
|
+
* Provides methods for managing workload identities, credential providers,
|
|
8
|
+
* and retrieving OAuth2 tokens and API keys.
|
|
9
|
+
*/
|
|
10
|
+
export declare class IdentityClient {
|
|
11
|
+
private readonly dataPlaneClient;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new IdentityClient instance
|
|
14
|
+
* @param region - AWS region (defaults to AWS_REGION env var)
|
|
15
|
+
* @throws Error if region cannot be determined
|
|
16
|
+
*/
|
|
17
|
+
constructor(region?: string);
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves an OAuth2 access token from AgentCore Identity.
|
|
20
|
+
* Handles both M2M (immediate) and USER_FEDERATION (polling) flows.
|
|
21
|
+
*
|
|
22
|
+
* @param request - OAuth2 token request parameters
|
|
23
|
+
* @returns OAuth2 access token
|
|
24
|
+
* @throws Error if token retrieval fails or times out
|
|
25
|
+
*/
|
|
26
|
+
getOAuth2Token(request: OAuth2TokenRequest): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Polls for OAuth2 token until available or timeout
|
|
29
|
+
*/
|
|
30
|
+
private pollForToken;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves an API key from AgentCore Identity token vault.
|
|
33
|
+
*
|
|
34
|
+
* @param request - API key request parameters
|
|
35
|
+
* @returns API key string
|
|
36
|
+
* @throws Error if API key retrieval fails
|
|
37
|
+
*/
|
|
38
|
+
getApiKey(request: ApiKeyRequest): Promise<string>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/identity/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAKnE;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwB;IAExD;;;;OAIG;gBACS,MAAM,CAAC,EAAE,MAAM;IAU3B;;;;;;;OAOG;IACG,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAsClE;;OAEG;YACW,YAAY;IA6B1B;;;;;;OAMG;IACG,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;CAczD"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IdentityClient for AgentCore Identity operations
|
|
3
|
+
*/
|
|
4
|
+
import { BedrockAgentCoreClient, GetResourceOauth2TokenCommand, GetResourceApiKeyCommand, } from '@aws-sdk/client-bedrock-agentcore';
|
|
5
|
+
const POLLING_INTERVAL_MS = 5000; // 5 seconds
|
|
6
|
+
const POLLING_TIMEOUT_MS = 600000; // 10 minutes
|
|
7
|
+
/**
|
|
8
|
+
* Client for interacting with Amazon Bedrock AgentCore Identity service.
|
|
9
|
+
* Provides methods for managing workload identities, credential providers,
|
|
10
|
+
* and retrieving OAuth2 tokens and API keys.
|
|
11
|
+
*/
|
|
12
|
+
export class IdentityClient {
|
|
13
|
+
dataPlaneClient;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new IdentityClient instance
|
|
16
|
+
* @param region - AWS region (defaults to AWS_REGION env var)
|
|
17
|
+
* @throws Error if region cannot be determined
|
|
18
|
+
*/
|
|
19
|
+
constructor(region) {
|
|
20
|
+
const resolvedRegion = region || process.env.AWS_REGION;
|
|
21
|
+
if (!resolvedRegion) {
|
|
22
|
+
throw new Error('AWS region must be specified either as a parameter or via AWS_REGION environment variable');
|
|
23
|
+
}
|
|
24
|
+
this.dataPlaneClient = new BedrockAgentCoreClient({ region: resolvedRegion });
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves an OAuth2 access token from AgentCore Identity.
|
|
28
|
+
* Handles both M2M (immediate) and USER_FEDERATION (polling) flows.
|
|
29
|
+
*
|
|
30
|
+
* @param request - OAuth2 token request parameters
|
|
31
|
+
* @returns OAuth2 access token
|
|
32
|
+
* @throws Error if token retrieval fails or times out
|
|
33
|
+
*/
|
|
34
|
+
async getOAuth2Token(request) {
|
|
35
|
+
const command = new GetResourceOauth2TokenCommand({
|
|
36
|
+
resourceCredentialProviderName: request.providerName,
|
|
37
|
+
scopes: request.scopes,
|
|
38
|
+
oauth2Flow: request.authFlow,
|
|
39
|
+
workloadIdentityToken: request.workloadIdentityToken,
|
|
40
|
+
resourceOauth2ReturnUrl: request.callbackUrl,
|
|
41
|
+
forceAuthentication: request.forceAuthentication,
|
|
42
|
+
sessionUri: request.sessionUri,
|
|
43
|
+
customState: request.customState,
|
|
44
|
+
customParameters: request.customParameters,
|
|
45
|
+
});
|
|
46
|
+
const response = await this.dataPlaneClient.send(command);
|
|
47
|
+
// M2M flow - token returned immediately
|
|
48
|
+
if (response.accessToken) {
|
|
49
|
+
return response.accessToken;
|
|
50
|
+
}
|
|
51
|
+
// USER_FEDERATION flow - authorization URL returned
|
|
52
|
+
if (response.authorizationUrl) {
|
|
53
|
+
// Invoke callback if provided
|
|
54
|
+
if (request.onAuthUrl) {
|
|
55
|
+
await request.onAuthUrl(response.authorizationUrl);
|
|
56
|
+
}
|
|
57
|
+
// Poll for token
|
|
58
|
+
return this.pollForToken({
|
|
59
|
+
...request,
|
|
60
|
+
sessionUri: response.sessionUri,
|
|
61
|
+
forceAuthentication: false,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
throw new Error('Identity service did not return a token or authorization URL');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Polls for OAuth2 token until available or timeout
|
|
68
|
+
*/
|
|
69
|
+
async pollForToken(request) {
|
|
70
|
+
const startTime = Date.now();
|
|
71
|
+
while (Date.now() - startTime < POLLING_TIMEOUT_MS) {
|
|
72
|
+
await new Promise((resolve) => globalThis.setTimeout(resolve, POLLING_INTERVAL_MS));
|
|
73
|
+
const command = new GetResourceOauth2TokenCommand({
|
|
74
|
+
resourceCredentialProviderName: request.providerName,
|
|
75
|
+
scopes: request.scopes,
|
|
76
|
+
oauth2Flow: request.authFlow,
|
|
77
|
+
workloadIdentityToken: request.workloadIdentityToken,
|
|
78
|
+
sessionUri: request.sessionUri,
|
|
79
|
+
resourceOauth2ReturnUrl: request.callbackUrl,
|
|
80
|
+
customState: request.customState,
|
|
81
|
+
customParameters: request.customParameters,
|
|
82
|
+
});
|
|
83
|
+
const response = await this.dataPlaneClient.send(command);
|
|
84
|
+
if (response.accessToken) {
|
|
85
|
+
return response.accessToken;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
throw new Error(`Polling timed out after ${POLLING_TIMEOUT_MS / 1000} seconds. User may not have completed authorization.`);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Retrieves an API key from AgentCore Identity token vault.
|
|
92
|
+
*
|
|
93
|
+
* @param request - API key request parameters
|
|
94
|
+
* @returns API key string
|
|
95
|
+
* @throws Error if API key retrieval fails
|
|
96
|
+
*/
|
|
97
|
+
async getApiKey(request) {
|
|
98
|
+
const command = new GetResourceApiKeyCommand({
|
|
99
|
+
resourceCredentialProviderName: request.providerName,
|
|
100
|
+
workloadIdentityToken: request.workloadIdentityToken,
|
|
101
|
+
});
|
|
102
|
+
const response = await this.dataPlaneClient.send(command);
|
|
103
|
+
if (!response.apiKey) {
|
|
104
|
+
throw new Error(`No API key returned for provider: ${request.providerName}`);
|
|
105
|
+
}
|
|
106
|
+
return response.apiKey;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/identity/client.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentCore Identity SDK
|
|
3
|
+
*
|
|
4
|
+
* Provides identity and credential management for AI agents.
|
|
5
|
+
* Supports inbound authentication (SigV4, JWT) and outbound authentication (OAuth2, API keys).
|
|
6
|
+
*
|
|
7
|
+
* @example HOF wrapper usage
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { withAccessToken } from '@aws/bedrock-agentcore-sdk';
|
|
10
|
+
*
|
|
11
|
+
* const myTool = withAccessToken({
|
|
12
|
+
* providerName: 'github',
|
|
13
|
+
* scopes: ['repo'],
|
|
14
|
+
* authFlow: 'M2M',
|
|
15
|
+
* })(async (input: string, token: string) => {
|
|
16
|
+
* // Token automatically injected
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export { withAccessToken, withApiKey } from './wrappers.js';
|
|
21
|
+
export * from './types.js';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG3D,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentCore Identity SDK
|
|
3
|
+
*
|
|
4
|
+
* Provides identity and credential management for AI agents.
|
|
5
|
+
* Supports inbound authentication (SigV4, JWT) and outbound authentication (OAuth2, API keys).
|
|
6
|
+
*
|
|
7
|
+
* @example HOF wrapper usage
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { withAccessToken } from '@aws/bedrock-agentcore-sdk';
|
|
10
|
+
*
|
|
11
|
+
* const myTool = withAccessToken({
|
|
12
|
+
* providerName: 'github',
|
|
13
|
+
* scopes: ['repo'],
|
|
14
|
+
* authFlow: 'M2M',
|
|
15
|
+
* })(async (input: string, token: string) => {
|
|
16
|
+
* // Token automatically injected
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
// Higher-order functions for wrapping tools
|
|
21
|
+
export { withAccessToken, withApiKey } from './wrappers.js';
|
|
22
|
+
// All type definitions
|
|
23
|
+
export * from './types.js';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,4CAA4C;AAC5C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE3D,uBAAuB;AACvB,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for AgentCore Identity SDK
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Request parameters for retrieving an OAuth2 access token
|
|
6
|
+
*/
|
|
7
|
+
export interface OAuth2TokenRequest {
|
|
8
|
+
/** Name of the credential provider */
|
|
9
|
+
providerName: string;
|
|
10
|
+
/** OAuth2 scopes to request */
|
|
11
|
+
scopes: string[];
|
|
12
|
+
/** Authentication flow type */
|
|
13
|
+
authFlow: 'M2M' | 'USER_FEDERATION';
|
|
14
|
+
/** Workload identity token for authentication */
|
|
15
|
+
workloadIdentityToken: string;
|
|
16
|
+
/** OAuth2 callback URL (must be pre-registered) */
|
|
17
|
+
callbackUrl?: string | undefined;
|
|
18
|
+
/** Force re-authentication even if token exists in vault */
|
|
19
|
+
forceAuthentication?: boolean | undefined;
|
|
20
|
+
/** Session URI for polling subsequent requests */
|
|
21
|
+
sessionUri?: string | undefined;
|
|
22
|
+
/** Custom state for callback validation */
|
|
23
|
+
customState?: string | undefined;
|
|
24
|
+
/** Custom parameters for authorization request */
|
|
25
|
+
customParameters?: Record<string, string> | undefined;
|
|
26
|
+
/** Callback invoked when authorization URL is returned */
|
|
27
|
+
onAuthUrl?: ((url: string) => void | Promise<void>) | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Request parameters for retrieving an API key
|
|
31
|
+
*/
|
|
32
|
+
export interface ApiKeyRequest {
|
|
33
|
+
/** Name of the credential provider */
|
|
34
|
+
providerName: string;
|
|
35
|
+
/** Workload identity token for authentication */
|
|
36
|
+
workloadIdentityToken: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Configuration for withAccessToken HOF wrapper
|
|
40
|
+
*/
|
|
41
|
+
export interface OAuth2WrapperConfig {
|
|
42
|
+
/**
|
|
43
|
+
* Workload identity token for authentication.
|
|
44
|
+
* Optional - if not provided, automatically falls back to context.workloadAccessToken
|
|
45
|
+
* when called within a request handler. If neither is available, an error is thrown.
|
|
46
|
+
*/
|
|
47
|
+
workloadIdentityToken?: string | undefined;
|
|
48
|
+
/** Name of the credential provider */
|
|
49
|
+
providerName: string;
|
|
50
|
+
/** OAuth2 scopes to request */
|
|
51
|
+
scopes: string[];
|
|
52
|
+
/** Authentication flow type */
|
|
53
|
+
authFlow: 'M2M' | 'USER_FEDERATION';
|
|
54
|
+
/** Callback invoked when authorization URL is returned */
|
|
55
|
+
onAuthUrl?: ((url: string) => void | Promise<void>) | undefined;
|
|
56
|
+
/** Force re-authentication even if token exists in vault */
|
|
57
|
+
forceAuthentication?: boolean | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* OAuth2 callback URL (must be pre-registered).
|
|
60
|
+
* Optional - if not provided, automatically falls back to context.oauth2CallbackUrl
|
|
61
|
+
* when called within a request handler.
|
|
62
|
+
*/
|
|
63
|
+
callbackUrl?: string | undefined;
|
|
64
|
+
/** Custom state for callback validation */
|
|
65
|
+
customState?: string | undefined;
|
|
66
|
+
/** Custom parameters for authorization request */
|
|
67
|
+
customParameters?: Record<string, string> | undefined;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Configuration for withApiKey HOF wrapper
|
|
71
|
+
*/
|
|
72
|
+
export interface ApiKeyWrapperConfig {
|
|
73
|
+
/**
|
|
74
|
+
* Workload identity token for authentication.
|
|
75
|
+
* Optional - if not provided, automatically falls back to context.workloadAccessToken
|
|
76
|
+
* when called within a request handler. If neither is available, an error is thrown.
|
|
77
|
+
*/
|
|
78
|
+
workloadIdentityToken?: string | undefined;
|
|
79
|
+
/** Name of the credential provider */
|
|
80
|
+
providerName: string;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=types.d.ts.map
|