Nick CleggandStrands Agent 3ff835a85f feat: Generalize BaseModelConfig and update OpenAI to use max_completion_tokens (#284)
* feat: generalize BaseModelConfig and update OpenAI to use max_completion_tokens

- Add common configuration parameters to BaseModelConfig:
  - maxTokens: Maximum tokens to generate in response
  - temperature: Controls randomness in generation
  - topP: Controls diversity via nucleus sampling
- Update OpenAI to use max_completion_tokens instead of max_tokens
- Update test assertions to reflect new API parameter
- Add comprehensive TSDoc documentation for all parameters

Resolves: #25

* docs: enhance model config documentation for Bedrock and OpenAI

- Add comprehensive TSDoc for maxTokens, temperature, topP in BedrockModelConfig
- Add comprehensive TSDoc for maxTokens, temperature, topP in OpenAIModelConfig
- Include provider-specific details (e.g., temperature ranges)
- Add API documentation links for both providers
- Clarify parameter behavior and recommendations

This improves consistency with BaseModelConfig documentation and provides
better guidance for users configuring model providers.

Related to: #25

* docs: simplify model config documentation

- Remove detailed descriptions from BaseModelConfig
- Remove detailed descriptions from BedrockModelConfig
- Remove detailed descriptions from OpenAIModelConfig
- Keep only brief descriptions and @see links for all parameters
- Makes documentation more concise and maintainable

Addresses review feedback in PR #284

---------

Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>
2025-12-01 00:52:42 +00:00
2025-09-18 17:13:27 -07:00
2025-11-07 15:54:24 -05:00
2025-09-18 17:13:27 -07:00
2025-09-18 17:13:27 -07:00
2025-11-26 19:36:20 +00:00
2025-11-07 15:54:24 -05:00

Strands Agents - TypeScript SDK

A model-driven approach to building AI agents in TypeScript/JavaScript.

GitHub commit activity GitHub open issues GitHub open pull requests License NPM Version

Documentation ◆ Samples ◆ Python SDK ◆ Tools ◆ Agent Builder ◆ MCP Server

Strands Agents is a simple yet powerful SDK that takes a model-driven approach to building and running AI agents. The TypeScript SDK brings key features from the Python Strands framework to Node.js environments, enabling type-safe agent development for everything from simple assistants to complex workflows.

Feature Overview

  • Lightweight & Flexible: Simple agent loop that works seamlessly in Node.js.
  • Type-Safe Tools: Define tools easily using Zod schemas for robust input validation.
  • Model Agnostic: First-class support for Amazon Bedrock and OpenAI, with more providers coming.
  • Built-in MCP: Native support for Model Context Protocol (MCP) clients, enabling access to external tools and servers.

Quick Start

# Install Strands Agents
npm install @strands-agents/sdk
import { Agent } from '@strands-agents/sdk'

// Create agent (uses default Amazon Bedrock provider)
const agent = new Agent()

// Invoke
const result = await agent.invoke('What is the square root of 1764?')
console.log(result)

Note

: For the default Amazon Bedrock model provider, you'll need AWS credentials configured and model access enabled for Claude 4.5 Sonnet in your region.

Installation

Ensure you have Node.js 20+ installed, then:

npm install @strands-agents/sdk

Features at a Glance

Type-Safe Tools

Easily build tools using the tool helper and zod for schema definition. This ensures the LLM provides exactly the data structure your code expects.

import { Agent, tool } from '@strands-agents/sdk'
import { z } from 'zod'

const weatherTool = tool({
  name: 'get_weather',
  description: 'Get the current weather for a specific location.',
  inputSchema: z.object({
    location: z.string().describe('The city and state, e.g., San Francisco, CA'),
  }),
  callback: (input) => {
    // input is fully typed based on the Zod schema above
    return `The weather in ${input.location} is 72°F and sunny.`
  },
})

const agent = new Agent({
  tools: [weatherTool],
})

await agent.invoke('What is the weather in San Francisco?')

MCP Support

Seamlessly integrate Model Context Protocol (MCP) servers to give your agents access to external systems and tools. The SDK includes built-in support for MCP clients.

import { Agent, McpClient, StdioClientTransport } from '@strands-agents/sdk'

// Create a client for a local MCP server
const chromeDevtools = new McpClient({
  transport: new StdioClientTransport({
    command: 'npx',
    args: ['-y', 'chrome-devtools-mcp'],
  }),
})

const agent = new Agent({
  systemPrompt: 'You are a helpful assistant using MCP tools.',
  tools: [chromeDevtools], // Pass the MCP client directly as a tool source
})

await agent.invoke('Use a random tool from the MCP server.')

Multiple Model Providers

Switch between model providers easily.

Amazon Bedrock (Default)

import { Agent, BedrockModel } from '@strands-agents/sdk'

const model = new BedrockModel({
  region: 'us-east-1',
  modelId: 'anthropic.claude-3-5-sonnet-20240620-v1:0',
})

const agent = new Agent({ model })

OpenAI

import { Agent } from '@strands-agents/sdk'
import { OpenAIModel } from '@strands-agents/sdk/openai'

// Automatically uses process.env.OPENAI_API_KEY and defaults to gpt-4o
const model = new OpenAIModel()

const agent = new Agent({ model })

Streaming Responses

Access the response as it is generated using the stream method:

const agent = new Agent()

console.log('Agent response stream:')
for await (const event of agent.stream('Tell me a story about a brave toaster.')) {
  console.log('[Event]', event.type)
}

Documentation

For detailed guidance, tutorials, and concept overviews (shared between Python and TypeScript), please visit the Strands Agents Documentation.

Contributing ❤️

We welcome contributions! See our Contributing Guide for details on:

  • Development setup and environment
  • Testing and code quality standards
  • Pull request process
  • Code of Conduct
  • Security issue reporting

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Security

See CONTRIBUTING for more information on reporting security issues.

Languages
Python 43%
TypeScript 41.7%
MDX 12.1%
Astro 2%
JavaScript 0.6%
Other 0.6%