Skip to content

Commit 0ec2df5

Browse files
authored
Release - v0.1.4 (strands-agents#91)
1 parent 9ebc3cc commit 0ec2df5

File tree

25 files changed

+1154
-852
lines changed

25 files changed

+1154
-852
lines changed

.github/workflows/test-lint-pr.yml

Lines changed: 16 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,96 +6,57 @@ on:
66
types: [opened, synchronize, reopened, ready_for_review, review_requested, review_request_removed]
77
push:
88
branches: [ main ] # Also run on direct pushes to main
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
912

1013
jobs:
11-
check-approval:
12-
name: Check if PR has contributor approval
13-
runs-on: ubuntu-latest
14-
permissions:
15-
pull-requests: read
16-
# Skip this check for direct pushes to main
17-
if: github.event_name == 'pull_request'
18-
outputs:
19-
approved: ${{ steps.check-approval.outputs.approved }}
20-
steps:
21-
- name: Check if PR has been approved by a contributor
22-
id: check-approval
23-
uses: actions/github-script@v7
24-
with:
25-
script: |
26-
const APPROVED_ASSOCIATION = ['COLLABORATOR', 'CONTRIBUTOR', 'MEMBER', 'OWNER']
27-
const PR_AUTHOR_ASSOCIATION = context.payload.pull_request.author_association;
28-
const { data: reviews } = await github.rest.pulls.listReviews({
29-
owner: context.repo.owner,
30-
repo: context.repo.repo,
31-
pull_number: context.issue.number,
32-
});
33-
34-
const isApprovedContributor = APPROVED_ASSOCIATION.includes(PR_AUTHOR_ASSOCIATION);
35-
36-
// Check if any contributor has approved
37-
const isApproved = reviews.some(review =>
38-
review.state === 'APPROVED' && APPROVED_ASSOCIATION.includes(review.author_association)
39-
) || isApprovedContributor;
40-
41-
core.setOutput('approved', isApproved);
42-
43-
if (!isApproved) {
44-
core.notice('This PR does not have approval from a Contributor. Workflow will not run test jobs.');
45-
return false;
46-
}
47-
48-
return true;
49-
5014
unit-test:
5115
name: Unit Tests - Python ${{ matrix.python-version }} - ${{ matrix.os-name }}
52-
needs: check-approval
5316
permissions:
5417
contents: read
55-
# Only run if PR is approved or this is a direct push to main
56-
if: github.event_name == 'push' || needs.check-approval.outputs.approved == 'true'
5718
strategy:
5819
matrix:
5920
include:
6021
# Linux
6122
- os: ubuntu-latest
62-
os-name: linux
23+
os-name: 'linux'
6324
python-version: "3.10"
6425
- os: ubuntu-latest
65-
os-name: linux
26+
os-name: 'linux'
6627
python-version: "3.11"
6728
- os: ubuntu-latest
68-
os-name: linux
29+
os-name: 'linux'
6930
python-version: "3.12"
7031
- os: ubuntu-latest
71-
os-name: linux
32+
os-name: 'linux'
7233
python-version: "3.13"
7334
# Windows
7435
- os: windows-latest
75-
os-name: windows
36+
os-name: 'windows'
7637
python-version: "3.10"
7738
- os: windows-latest
78-
os-name: windows
39+
os-name: 'windows'
7940
python-version: "3.11"
8041
- os: windows-latest
81-
os-name: windows
42+
os-name: 'windows'
8243
python-version: "3.12"
8344
- os: windows-latest
84-
os-name: windows
45+
os-name: 'windows'
8546
python-version: "3.13"
86-
# MacOS - latest only; not enough runners for MacOS
47+
# MacOS - latest only; not enough runners for macOS
8748
- os: macos-latest
88-
os-name: macos
89-
python-version: "3.13"
90-
fail-fast: false
49+
os-name: 'macOS'
50+
python-version: "3.13"
51+
fail-fast: true
9152
runs-on: ${{ matrix.os }}
9253
env:
9354
LOG_LEVEL: DEBUG
9455
steps:
9556
- name: Checkout code
9657
uses: actions/checkout@v4
9758
with:
98-
ref: ${{ github.event.pull_request.head.sha }} # Explicitly define which commit to checkout
59+
ref: ${{ github.event.pull_request.head.sha }} # Explicitly define which commit to check out
9960
persist-credentials: false # Don't persist credentials for subsequent actions
10061
- name: Set up Python
10162
uses: actions/setup-python@v5
@@ -108,14 +69,11 @@ jobs:
10869
id: tests
10970
run: hatch test tests --cover
11071
continue-on-error: false
111-
11272
lint:
11373
name: Lint
11474
runs-on: ubuntu-latest
115-
needs: check-approval
11675
permissions:
11776
contents: read
118-
if: github.event_name == 'push' || needs.check-approval.outputs.approved == 'true'
11977
steps:
12078
- name: Checkout code
12179
uses: actions/checkout@v4

CONTRIBUTING.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,22 @@ This project uses [hatchling](https://hatch.pypa.io/latest/build/#hatchling) as
3131

3232
### Setting Up Your Development Environment
3333

34-
1. Install development dependencies:
34+
1. Entering virtual environment using `hatch` (recommended), then launch your IDE in the new shell.
3535
```bash
36-
pip install -e ".[dev]" && pip install -e ".[litellm]
36+
hatch shell dev
3737
```
3838

39+
Alternatively, install development dependencies in a manually created virtual environment:
40+
```bash
41+
pip install -e ".[dev]" && pip install -e ".[litellm]"
42+
```
43+
44+
3945
2. Set up pre-commit hooks:
4046
```bash
4147
pre-commit install -t pre-commit -t commit-msg
4248
```
43-
This will automatically run formatters and convention commit checks on your code before each commit.
49+
This will automatically run formatters and conventional commit checks on your code before each commit.
4450

4551
3. Run code formatters manually:
4652
```bash
@@ -117,7 +123,7 @@ To send us a pull request, please:
117123

118124

119125
## Finding contributions to work on
120-
Looking at the existing issues is a great way to find something to contribute on.
126+
Looking at the existing issues is a great way to find something to contribute to.
121127

122128
You can check:
123129
- Our known bugs list in [Bug Reports](../../issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) for issues that need fixing

STYLE_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ logger.debug("field1=<%s>, field2=<%s>, ... | human readable message", field1, f
2626
- This is an optimization to skip string interpolation when the log level is not enabled
2727

2828
1. **Messages**:
29-
- Add human readable messages at the end of the log
29+
- Add human-readable messages at the end of the log
3030
- Use lowercase for consistency
3131
- Avoid punctuation (periods, exclamation points, etc.) to reduce clutter
3232
- Keep messages concise and focused on a single statement

pyproject.toml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "strands-agents"
7-
version = "0.1.3"
7+
version = "0.1.4"
88
description = "A model-driven approach to building AI agents in just a few lines of code"
99
readme = "README.md"
1010
requires-python = ">=3.10"
@@ -33,9 +33,9 @@ dependencies = [
3333
"pydantic>=2.0.0,<3.0.0",
3434
"typing-extensions>=4.13.2,<5.0.0",
3535
"watchdog>=6.0.0,<7.0.0",
36-
"opentelemetry-api>=1.33.0,<2.0.0",
37-
"opentelemetry-sdk>=1.33.0,<2.0.0",
38-
"opentelemetry-exporter-otlp-proto-http>=1.33.0,<2.0.0",
36+
"opentelemetry-api>=1.30.0,<2.0.0",
37+
"opentelemetry-sdk>=1.30.0,<2.0.0",
38+
"opentelemetry-exporter-otlp-proto-http>=1.30.0,<2.0.0",
3939
]
4040

4141
[project.urls]
@@ -54,7 +54,7 @@ dev = [
5454
"commitizen>=4.4.0,<5.0.0",
5555
"hatch>=1.0.0,<2.0.0",
5656
"moto>=5.1.0,<6.0.0",
57-
"mypy>=0.981,<1.0.0",
57+
"mypy>=1.15.0,<2.0.0",
5858
"pre-commit>=3.2.0,<4.2.0",
5959
"pytest>=8.0.0,<9.0.0",
6060
"pytest-asyncio>=0.26.0,<0.27.0",
@@ -69,15 +69,18 @@ docs = [
6969
litellm = [
7070
"litellm>=1.69.0,<2.0.0",
7171
]
72+
llamaapi = [
73+
"llama-api-client>=0.1.0,<1.0.0",
74+
]
7275
ollama = [
7376
"ollama>=0.4.8,<1.0.0",
7477
]
75-
llamaapi = [
76-
"llama-api-client>=0.1.0,<1.0.0",
78+
openai = [
79+
"openai>=1.68.0,<2.0.0",
7780
]
7881

7982
[tool.hatch.envs.hatch-static-analysis]
80-
features = ["anthropic", "litellm", "llamaapi", "ollama"]
83+
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai"]
8184
dependencies = [
8285
"mypy>=1.15.0,<2.0.0",
8386
"ruff>=0.11.6,<0.12.0",
@@ -100,7 +103,7 @@ lint-fix = [
100103
]
101104

102105
[tool.hatch.envs.hatch-test]
103-
features = ["anthropic", "litellm", "llamaapi", "ollama"]
106+
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai"]
104107
extra-dependencies = [
105108
"moto>=5.1.0,<6.0.0",
106109
"pytest>=8.0.0,<9.0.0",
@@ -114,6 +117,11 @@ extra-args = [
114117
"-vv",
115118
]
116119

120+
[tool.hatch.envs.dev]
121+
dev-mode = true
122+
features = ["dev", "docs", "anthropic", "litellm", "llamaapi", "ollama"]
123+
124+
117125

118126
[[tool.hatch.envs.hatch-test.matrix]]
119127
python = ["3.13", "3.12", "3.11", "3.10"]

src/strands/event_loop/error_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def handle_input_too_long_error(
7474
"""Handle 'Input is too long' errors by truncating tool results.
7575
7676
When a context window overflow exception occurs (input too long for the model), this function attempts to recover
77-
by finding and truncating the most recent tool results in the conversation history. If trunction is successful, the
77+
by finding and truncating the most recent tool results in the conversation history. If truncation is successful, the
7878
function will make a call to the event loop.
7979
8080
Args:

src/strands/handlers/tool_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def preprocess(
4646
def process(
4747
self,
4848
tool: Any,
49+
*,
4950
model: Model,
5051
system_prompt: Optional[str],
5152
messages: List[Any],

src/strands/models/bedrock.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,21 @@ def __init__(
112112
session = boto_session or boto3.Session(
113113
region_name=region_name or os.getenv("AWS_REGION") or "us-west-2",
114114
)
115-
client_config = boto_client_config or BotocoreConfig(user_agent_extra="strands-agents")
115+
116+
# Add strands-agents to the request user agent
117+
if boto_client_config:
118+
existing_user_agent = getattr(boto_client_config, "user_agent_extra", None)
119+
120+
# Append 'strands-agents' to existing user_agent_extra or set it if not present
121+
if existing_user_agent:
122+
new_user_agent = f"{existing_user_agent} strands-agents"
123+
else:
124+
new_user_agent = "strands-agents"
125+
126+
client_config = boto_client_config.merge(BotocoreConfig(user_agent_extra=new_user_agent))
127+
else:
128+
client_config = BotocoreConfig(user_agent_extra="strands-agents")
129+
116130
self.client = session.client(
117131
service_name="bedrock-runtime",
118132
config=client_config,
@@ -132,7 +146,7 @@ def get_config(self) -> BedrockConfig:
132146
"""Get the current Bedrock Model configuration.
133147
134148
Returns:
135-
The Bedrok model configuration.
149+
The Bedrock model configuration.
136150
"""
137151
return self.config
138152

0 commit comments

Comments
 (0)