
Security News
/Company News
Socket Is Sponsoring Composer and Packagist
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.
@agenite/bedrock
Advanced tools
AWS Bedrock provider for Agenite, enabling seamless integration with Amazon's foundation models through the Bedrock runtime.
npm install @agenite/bedrock
import { BedrockProvider } from '@agenite/bedrock';
// Initialize the provider
const provider = new BedrockProvider({
model: 'anthropic.claude-3-5-haiku-20241022-v1:0',
region: 'us-west-2',
});
// Generate a simple response
const result = await provider.generate(
'What are the main features of Llama 2?'
);
console.log(result);
// Use streaming for real-time responses
const generator = provider.stream('Tell me about AWS Bedrock.');
for await (const chunk of generator) {
if (chunk.type === 'text') {
process.stdout.write(chunk.text);
}
}
interface BedrockProviderOptions {
model: string; // Bedrock model ID
region: string; // AWS region
temperature?: number; // Temperature for response generation
maxTokens?: number; // Maximum tokens in response
topP?: number; // Top P sampling parameter
}
anthropic.claude-3-5-haiku-20241022-v1:0anthropic.claude-3-sonnet-20240229-v1:0anthropic.claude-instant-v1amazon.titan-text-express-v1amazon.titan-text-lite-v1const provider = new BedrockProvider({
model: `us.anthropic.claude-3-7-sonnet-20250219-v1:0`,
region: 'us-east-2',
converseCommandConfig: {
additionalModelRequestFields: {
reasoning_config: {
type: 'enabled',
budget_tokens: 1024,
},
},
inferenceConfig: {
temperature: 1,
},
},
});
import { BedrockProvider } from '@agenite/bedrock';
import type { ToolDefinition } from '@agenite/llm';
// Define a calculator tool
const calculatorTool: ToolDefinition = {
name: 'calculator',
description: 'Perform basic arithmetic operations',
inputSchema: {
type: 'object',
properties: {
operation: {
type: 'string',
enum: ['add', 'subtract', 'multiply', 'divide'],
},
a: { type: 'number' },
b: { type: 'number' },
},
required: ['operation', 'a', 'b'],
},
};
// Initialize provider with tool support
const provider = new BedrockProvider({
model: 'anthropic.claude-3-5-haiku-20241022-v1:0',
region: 'us-west-2',
});
// Use tool in conversation
const messages = [
{
role: 'user',
content: [{ type: 'text', text: 'What is 123 multiplied by 456?' }],
},
];
const generator = provider.iterate(messages, {
tools: [calculatorTool],
stream: true,
systemPrompt:
'You are a helpful AI assistant with access to a calculator tool.',
});
// Process streaming response with tool usage
for await (const chunk of generator) {
if (chunk.type === 'text') {
process.stdout.write(chunk.text);
} else if (chunk.type === 'toolUse') {
console.log('Tool Use:', chunk);
}
}
// Maintain conversation history
let messages = [];
const result = await provider.generate(messages, {
systemPrompt: 'You are a helpful AI assistant.',
});
messages.push(
{ role: 'user', content: [{ type: 'text', text: 'Hello!' }] },
result
);
class BedrockProvider implements LLMProvider {
constructor(options: BedrockProviderOptions);
generate(
messages: string | BaseMessage[],
options?: GenerateOptions
): Promise<BaseMessage>;
stream(
messages: string | BaseMessage[],
options?: StreamOptions
): AsyncGenerator<StreamChunk>;
iterate(
messages: string | BaseMessage[],
options?: StreamOptions
): AsyncGenerator<StreamChunk>;
}
interface BaseMessage {
role: 'user' | 'assistant' | 'system';
content: ContentBlock[];
}
type ContentBlock = TextBlock | ToolUseBlock | ToolResultBlock;
Check out the examples directory for more:
basic-chat.ts - Simple chat interactiontool-usage.ts - Advanced tool integration exampleaws configure
Ensure your AWS account has access to Bedrock and the required models.
Set up IAM permissions for Bedrock access:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": "*"
}
]
}
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
FAQs
AWS Bedrock provider for Agenite
The npm package @agenite/bedrock receives a total of 96 weekly downloads. As such, @agenite/bedrock popularity was classified as not popular.
We found that @agenite/bedrock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.

Research
/Security News
Benign-looking npm packages split malicious functionality across a dependency chain that deploys a cross-platform RAT targeting Alibaba developers.

Research
/Security News
Two Joyfill npm beta releases contain an import-time implant that uses blockchain transactions to retrieve a remote-access trojan.