Skip to content

Commit 6f8c6a5

Browse files
authored
Merge branch 'strands-agents:main' into main
2 parents 3cdaa71 + be57089 commit 6f8c6a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4429
-753
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
## Description
2-
[Provide a detailed description of the changes in this PR]
2+
<!-- Provide a detailed description of the changes in this PR -->
33

44
## Related Issues
5-
[Link to related issues using #issue-number format]
5+
6+
<!-- Link to related issues using #issue-number format -->
67

78
## Documentation PR
8-
[Link to related associated PR in the agent-docs repo]
9+
10+
<!-- Link to related associated PR in the agent-docs repo -->
911

1012
## Type of Change
11-
- Bug fix
12-
- New feature
13-
- Breaking change
14-
- Documentation update
15-
- Other (please describe):
1613

17-
[Choose one of the above types of changes]
14+
<!-- Choose one of the following types of changes, delete the rest -->
1815

16+
Bug fix
17+
New feature
18+
Breaking change
19+
Documentation update
20+
Other (please describe):
1921

2022
## Testing
21-
[How have you tested the change?]
2223

23-
* `hatch fmt --linter`
24-
* `hatch fmt --formatter`
25-
* `hatch test --all`
26-
* Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
24+
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
2725

26+
- [ ] I ran `hatch run prepare`
2827

2928
## Checklist
3029
- [ ] I have read the CONTRIBUTING document
31-
- [ ] I have added tests that prove my fix is effective or my feature works
30+
- [ ] I have added any necessary tests that prove my fix is effective or my feature works
3231
- [ ] I have updated the documentation accordingly
33-
- [ ] I have added an appropriate example to the documentation to outline the feature
32+
- [ ] I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
3433
- [ ] My changes generate no new warnings
3534
- [ ] Any dependent changes have been merged and published
3635

36+
----
37+
3738
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Secure Integration test
2+
3+
on:
4+
pull_request_target:
5+
branches: main
6+
7+
jobs:
8+
authorization-check:
9+
permissions: read-all
10+
runs-on: ubuntu-latest
11+
outputs:
12+
approval-env: ${{ steps.collab-check.outputs.result }}
13+
steps:
14+
- name: Collaborator Check
15+
uses: actions/github-script@v7
16+
id: collab-check
17+
with:
18+
result-encoding: string
19+
script: |
20+
try {
21+
const permissionResponse = await github.rest.repos.getCollaboratorPermissionLevel({
22+
owner: context.repo.owner,
23+
repo: context.repo.repo,
24+
username: context.payload.pull_request.user.login,
25+
});
26+
const permission = permissionResponse.data.permission;
27+
const hasWriteAccess = ['write', 'admin'].includes(permission);
28+
if (!hasWriteAccess) {
29+
console.log(`User ${context.payload.pull_request.user.login} does not have write access to the repository (permission: ${permission})`);
30+
return "manual-approval"
31+
} else {
32+
console.log(`Verifed ${context.payload.pull_request.user.login} has write access. Auto Approving PR Checks.`)
33+
return "auto-approve"
34+
}
35+
} catch (error) {
36+
console.log(`${context.payload.pull_request.user.login} does not have write access. Requiring Manual Approval to run PR Checks.`)
37+
return "manual-approval"
38+
}
39+
check-access-and-checkout:
40+
runs-on: ubuntu-latest
41+
needs: authorization-check
42+
environment: ${{ needs.authorization-check.outputs.approval-env }}
43+
permissions:
44+
id-token: write
45+
pull-requests: read
46+
contents: read
47+
steps:
48+
- name: Configure Credentials
49+
uses: aws-actions/configure-aws-credentials@v4
50+
with:
51+
role-to-assume: ${{ secrets.STRANDS_INTEG_TEST_ROLE }}
52+
aws-region: us-east-1
53+
mask-aws-account-id: true
54+
- name: Checkout head commit
55+
uses: actions/checkout@v4
56+
with:
57+
ref: ${{ github.event.pull_request.head.sha }} # Pull the commit from the forked repo
58+
persist-credentials: false # Don't persist credentials for subsequent actions
59+
- name: Set up Python
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: '3.10'
63+
- name: Install dependencies
64+
run: |
65+
pip install --no-cache-dir hatch
66+
- name: Run integration tests
67+
env:
68+
AWS_REGION: us-east-1
69+
AWS_REGION_NAME: us-east-1 # Needed for LiteLLM
70+
id: tests
71+
run: |
72+
hatch test tests-integ
73+
74+

pyproject.toml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ classifiers = [
2828
dependencies = [
2929
"boto3>=1.26.0,<2.0.0",
3030
"botocore>=1.29.0,<2.0.0",
31-
"docstring_parser>=0.15,<0.16.0",
31+
"docstring_parser>=0.15,<1.0",
3232
"mcp>=1.8.0,<2.0.0",
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",
3636
"opentelemetry-api>=1.30.0,<2.0.0",
3737
"opentelemetry-sdk>=1.30.0,<2.0.0",
38-
"opentelemetry-exporter-otlp-proto-http>=1.30.0,<2.0.0",
3938
]
4039

4140
[project.urls]
@@ -59,15 +58,14 @@ dev = [
5958
"pytest>=8.0.0,<9.0.0",
6059
"pytest-asyncio>=0.26.0,<0.27.0",
6160
"ruff>=0.4.4,<0.5.0",
62-
"swagger-parser>=1.0.2,<2.0.0",
6361
]
6462
docs = [
6563
"sphinx>=5.0.0,<6.0.0",
6664
"sphinx-rtd-theme>=1.0.0,<2.0.0",
6765
"sphinx-autodoc-typehints>=1.12.0,<2.0.0",
6866
]
6967
litellm = [
70-
"litellm>=1.69.0,<2.0.0",
68+
"litellm>=1.72.6,<2.0.0",
7169
]
7270
llamaapi = [
7371
"llama-api-client>=0.1.0,<1.0.0",
@@ -78,13 +76,23 @@ ollama = [
7876
openai = [
7977
"openai>=1.68.0,<2.0.0",
8078
]
79+
otel = [
80+
"opentelemetry-exporter-otlp-proto-http>=1.30.0,<2.0.0",
81+
]
82+
a2a = [
83+
"a2a-sdk>=0.2.6",
84+
"uvicorn>=0.34.2",
85+
"httpx>=0.28.1",
86+
"fastapi>=0.115.12",
87+
"starlette>=0.46.2",
88+
]
8189

8290
[tool.hatch.version]
8391
# Tells Hatch to use your version control system (git) to determine the version.
8492
source = "vcs"
8593

8694
[tool.hatch.envs.hatch-static-analysis]
87-
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai"]
95+
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai", "otel"]
8896
dependencies = [
8997
"mypy>=1.15.0,<2.0.0",
9098
"ruff>=0.11.6,<0.12.0",
@@ -100,14 +108,15 @@ format-fix = [
100108
]
101109
lint-check = [
102110
"ruff check",
103-
"mypy -p src"
111+
# excluding due to A2A and OTEL http exporter dependency conflict
112+
"mypy -p src --exclude src/strands/multiagent"
104113
]
105114
lint-fix = [
106115
"ruff check --fix"
107116
]
108117

109118
[tool.hatch.envs.hatch-test]
110-
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai"]
119+
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai", "otel"]
111120
extra-dependencies = [
112121
"moto>=5.1.0,<6.0.0",
113122
"pytest>=8.0.0,<9.0.0",
@@ -123,20 +132,35 @@ extra-args = [
123132

124133
[tool.hatch.envs.dev]
125134
dev-mode = true
126-
features = ["dev", "docs", "anthropic", "litellm", "llamaapi", "ollama"]
135+
features = ["dev", "docs", "anthropic", "litellm", "llamaapi", "ollama", "otel"]
127136

137+
[tool.hatch.envs.a2a]
138+
dev-mode = true
139+
features = ["dev", "docs", "anthropic", "litellm", "llamaapi", "ollama", "a2a"]
128140

141+
[tool.hatch.envs.a2a.scripts]
142+
run = [
143+
"pytest{env:HATCH_TEST_ARGS:} tests/multiagent/a2a {args}"
144+
]
145+
run-cov = [
146+
"pytest{env:HATCH_TEST_ARGS:} tests/multiagent/a2a --cov --cov-config=pyproject.toml {args}"
147+
]
148+
lint-check = [
149+
"ruff check",
150+
"mypy -p src/strands/multiagent/a2a"
151+
]
129152

130153
[[tool.hatch.envs.hatch-test.matrix]]
131154
python = ["3.13", "3.12", "3.11", "3.10"]
132155

133-
134156
[tool.hatch.envs.hatch-test.scripts]
135157
run = [
136-
"pytest{env:HATCH_TEST_ARGS:} {args}"
158+
# excluding due to A2A and OTEL http exporter dependency conflict
159+
"pytest{env:HATCH_TEST_ARGS:} {args} --ignore=tests/multiagent/a2a"
137160
]
138161
run-cov = [
139-
"pytest{env:HATCH_TEST_ARGS:} --cov --cov-config=pyproject.toml {args}"
162+
# excluding due to A2A and OTEL http exporter dependency conflict
163+
"pytest{env:HATCH_TEST_ARGS:} --cov --cov-config=pyproject.toml {args} --ignore=tests/multiagent/a2a"
140164
]
141165

142166
cov-combine = []
@@ -165,7 +189,15 @@ test = [
165189
test-integ = [
166190
"hatch test tests-integ {args}"
167191
]
168-
192+
prepare = [
193+
"hatch fmt --linter",
194+
"hatch fmt --formatter",
195+
"hatch test --all"
196+
]
197+
test-a2a = [
198+
# required to run manually due to A2A and OTEL http exporter dependency conflict
199+
"hatch -e a2a run run {args}"
200+
]
169201

170202
[tool.mypy]
171203
python_version = "3.10"
@@ -249,4 +281,4 @@ style = [
249281
["instruction", ""],
250282
["text", ""],
251283
["disabled", "fg:#858585 italic"]
252-
]
284+
]

src/strands/agent/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@
88

99
from .agent import Agent
1010
from .agent_result import AgentResult
11-
from .conversation_manager import ConversationManager, NullConversationManager, SlidingWindowConversationManager
11+
from .conversation_manager import (
12+
ConversationManager,
13+
NullConversationManager,
14+
SlidingWindowConversationManager,
15+
SummarizingConversationManager,
16+
)
1217

1318
__all__ = [
1419
"Agent",
1520
"AgentResult",
1621
"ConversationManager",
1722
"NullConversationManager",
1823
"SlidingWindowConversationManager",
24+
"SummarizingConversationManager",
1925
]

0 commit comments

Comments
 (0)