Files
harness-sdk/vended_tools
Mackenzie ZastrowandStrands Agent f43172a253 Re-implement conversation-manager as a hook provider (#222)
* refactor: simplify test helpers and use createMockAgent

- Use hooks.addHook() instead of manual registerCallbacks()
- Create createMockAgent() helper in fixtures
- Simplify test helpers to use invokeCallbacks directly
- Update all tests to use createMockAgent helper
- Make all tests properly async with await

Addresses PR review feedback.
refactor: keep conversationManager as first-class config option

- Restore conversationManager to AgentConfig and Agent class
- Agent automatically registers conversation manager hooks internally
- Update tests to use HookRegistryImplementation and focus on behavior
- Remove public mentions of hooks from conversation manager docs
- Simplify NullConversationManager tests to focus on behavior

This maintains conversationManager as a top-level concept while using
hooks internally as an implementation detail.
refactor!: convert conversation managers to hook providers

BREAKING CHANGE: Removed ConversationManager base class and Agent.conversationManager field.
Conversation managers are now hook providers that must be registered via the hooks config.

Changes:
- Added retryModelCall field to AfterModelCallEvent for retry control
- Converted NullConversationManager to HookProvider (0 hooks registered)
- Converted SlidingWindowConversationManager to HookProvider with AfterInvocationEvent and AfterModelCallEvent callbacks
- Removed Agent.conversationManager field and related config
- Updated Agent retry logic to use retryModelCall flag instead of catching ContextWindowOverflowError
- Added messages field to AgentData interface for hook access
- Deleted ConversationManager base class and ConversationContext interface
- Updated public API exports to remove ConversationManager

Migration:
Before: new Agent({ conversationManager: new SlidingWindowConversationManager() })
After: new Agent({ hooks: [new SlidingWindowConversationManager()] })

Resolves: #210

* refactor: address PR review feedback

- Create MockAgentData interface with optional messages and state
- Update createMockAgent to accept interface-based parameter
- Update all test usages to use object syntax
- Add retryModelCall tests to agent.hook.test.ts
- Update test helpers to use registry.addHook(manager)

Addresses review comments on PR #222

---------

Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>
2025-11-20 14:19:39 +00:00
..

Vended Tools

This directory contains optional tools that are provided as part of the Strands SDK but are not required dependencies of the core SDK.

What are Vended Tools?

Vended tools are pre-built, production-ready tools that developers can optionally use with their agents.

Available Tools

Bash

A robust tool for executing bash shell commands in Node.js environments with persistent session support.

Location: vended_tools/bash/

Key Features:

  • Persistent bash sessions with state management
  • Separate stdout and stderr capture
  • Configurable command timeouts (default: 120 seconds)
  • Session restart capability
  • Isolated sessions per agent instance
  • Node.js only (requires child_process module)

Security Warning: Executes arbitrary commands without sandboxing. Only use with trusted input and consider sandboxing for production.

Usage:

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

const agent = new Agent({
  model: new BedrockModel({
    region: 'us-east-1',
  }),
  tools: [bash],
})

// Execute commands
await agent.invoke('List all files in the current directory')

See bash/README.md for complete documentation.

Notebook

A comprehensive tool for managing text notebooks within agent invocations. Supports creating, reading, writing, listing, and clearing notebooks with full state persistence.

Location: vended_tools/notebook/

Key Features:

  • Multiple named notebooks
  • String replacement and line insertion
  • Line range reading with negative index support
  • State persistence across agent invocations
  • Universal browser and server support

Usage:

import { notebook } from '@strands-agents/sdk/vended_tools/notebook'
import { ToolRegistry } from '@strands-agents/sdk'

const agent = new Agent({
  model: new BedrockModel({
    region: 'us-east-1',
  }),
  tools: [notebook],
})

// Create a task list
await agent.invoke('Create a notebook called "tasks" with 1 "Write code" task')

See notebook/README.md for complete documentation.

File Editor

A filesystem editor tool for viewing, creating, and editing files programmatically. Supports string replacement and line insertion.

Location: vended_tools/file_editor/

Key Features:

  • View files with line numbers and line range support
  • Create new files with content
  • String-based find and replace
  • Line-based text insertion
  • Directory viewing
  • Path security validation
  • Configurable file size limits

Usage:

import { fileEditor } from '@strands-agents/sdk/vended_tools/file_editor'

const agent = new Agent({
  model: new BedrockModel({ region: 'us-east-1' }),
  tools: [fileEditor],
})

await agent.invoke('Create a new file called /tmp/test.txt with "Hello World"')
await agent.invoke('Replace "Hello" with "Hi" in /tmp/test.txt')

See file_editor/README.md for complete documentation.

Contributing

When adding new vended tools:

  1. Create a new directory under vended_tools/
  2. Include implementation, types, and tests
  3. Add a README.md in the tool's directory
  4. Update this README to list the new tool
  5. Ensure 80%+ test coverage
  6. Follow the existing patterns from other vended tools

Directory Structure

vended_tools/
├── README.md                    # This file
├── bash/                        # Bash command execution tool
│   ├── __tests__/
│   │   └── bash.test.ts         # Unit tests
│   ├── bash.ts                  # Implementation
│   ├── types.ts                 # Type definitions
│   ├── index.ts                 # Public exports
│   └── README.md                # Documentation
├── notebook/                    # Text notebook management tool
│   ├── __tests__/
│   │   └── notebook.test.ts     # Unit tests
│   ├── notebook.ts              # Implementation
│   ├── types.ts                 # Type definitions
│   ├── index.ts                 # Public exports
│   └── README.md                # Documentation
└── you-new-tool/                # Your new tool
    ├── __tests__/
    │   └── you-new-tool.test.ts # Unit tests
    ├── you-new-tool.ts          # Implementation
    ├── types.ts                 # Type definitions
    ├── index.ts                 # Public exports
    └── README.md                # Documentation