Skip to content

Commit 096329d

Browse files
Merge branch 'main' into build/uv-poc
2 parents 581c8cd + 297ec5c commit 096329d

File tree

6 files changed

+848
-73
lines changed

6 files changed

+848
-73
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ Please try to include as much information as you can. Details like these are inc
2525
* Anything unusual about your environment or deployment
2626

2727

28+
## Finding contributions to work on
29+
Looking at the existing issues is a great way to find something to contribute to. We label issues that are well-defined and ready for community contributions with the "ready for contribution" label.
30+
31+
Check our [Ready for Contribution](../../issues?q=is%3Aissue%20state%3Aopen%20label%3A%22ready%20for%20contribution%22) issues for items you can work on.
32+
33+
Before starting work on any issue:
34+
1. Check if someone is already assigned or working on it
35+
2. Comment on the issue to express your interest and ask any clarifying questions
36+
3. Wait for maintainer confirmation before beginning significant work
37+
38+
2839
## Development Environment
2940

3041
This project uses [hatchling](https://hatch.pypa.io/latest/build/#hatchling) as the build backend and [hatch](https://hatch.pypa.io/latest/) for development workflow management.
@@ -70,7 +81,7 @@ This project uses [hatchling](https://hatch.pypa.io/latest/build/#hatchling) as
7081

7182
### Pre-commit Hooks
7283

73-
We use [pre-commit](https://pre-commit.com/) to automatically run quality checks before each commit. The hook will run `hatch run format`, `hatch run lint`, `hatch run test`, and `hatch run cz check` on when you make a commit, ensuring code consistency.
84+
We use [pre-commit](https://pre-commit.com/) to automatically run quality checks before each commit. The hook will run `hatch run format`, `hatch run lint`, `hatch run test`, and `hatch run cz check` when you make a commit, ensuring code consistency.
7485

7586
The pre-commit hook is installed with:
7687

@@ -122,75 +133,6 @@ To send us a pull request, please:
122133
8. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
123134

124135

125-
## Finding contributions to work on
126-
Looking at the existing issues is a great way to find something to contribute to.
127-
128-
You can check:
129-
- Our known bugs list in [Bug Reports](../../issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) for issues that need fixing
130-
- Feature requests in [Feature Requests](../../issues?q=is%3Aissue%20state%3Aopen%20label%3Aenhancement) for new functionality to implement
131-
132-
133-
## Dependency Management with uv lock
134-
135-
This project uses `uv lock` to ensure reproducible dependency resolution across all environments. The `uv.lock` file contains exact versions of all dependencies and **must be committed to git**.
136-
137-
### For Developers
138-
139-
**Initial Setup:**
140-
```bash
141-
# Install exact dependencies from lock file
142-
uv sync --dev
143-
```
144-
145-
**Daily Development:**
146-
```bash
147-
# Use locked dependencies for all commands
148-
uv run poe test
149-
uv run poe lint
150-
uv run poe format
151-
```
152-
153-
**Adding New Dependencies:**
154-
```bash
155-
# Add new dependency and update lock file
156-
uv add "new-package>=1.0.0"
157-
# The lock file is automatically updated
158-
git add pyproject.toml uv.lock
159-
git commit -m "feat: add new-package dependency"
160-
```
161-
162-
**Updating Dependencies:**
163-
```bash
164-
# Update to latest compatible versions
165-
uv lock
166-
167-
# Or upgrade to latest versions (major updates)
168-
uv lock --upgrade
169-
170-
# Always commit lock file changes
171-
git add uv.lock
172-
git commit -m "chore: update dependencies"
173-
```
174-
175-
### Why Lock Files Matter
176-
177-
- **Reproducible Builds**: Same exact dependencies across dev, CI, and production
178-
- **Faster CI**: Pre-resolved dependencies eliminate resolution time
179-
- **Security**: Pinned versions prevent supply chain attacks
180-
- **Team Consistency**: Everyone gets identical dependency trees
181-
182-
### Lock File Commands
183-
184-
| Command | Purpose |
185-
|---------|---------|
186-
| `uv sync --dev` | Install exact dependencies from lock file |
187-
| `uv sync` | Install production dependencies only |
188-
| `uv lock` | Update lock file with latest compatible versions |
189-
| `uv lock --upgrade` | Upgrade all dependencies to latest versions |
190-
191-
**Important**: Always commit `uv.lock` changes alongside `pyproject.toml` changes!
192-
193-
194136
## Code of Conduct
195137
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
196138
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact

src/strands/models/anthropic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class AnthropicConfig(TypedDict, total=False):
5555
For a complete list of supported parameters, see https://docs.anthropic.com/en/api/messages.
5656
"""
5757

58-
max_tokens: Required[str]
58+
max_tokens: Required[int]
5959
model_id: Required[str]
6060
params: Optional[dict[str, Any]]
6161

src/strands/multiagent/a2a/server.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
import uvicorn
1212
from a2a.server.apps import A2AFastAPIApplication, A2AStarletteApplication
13+
from a2a.server.events import QueueManager
1314
from a2a.server.request_handlers import DefaultRequestHandler
14-
from a2a.server.tasks import InMemoryTaskStore
15+
from a2a.server.tasks import InMemoryTaskStore, PushNotificationConfigStore, PushNotificationSender, TaskStore
1516
from a2a.types import AgentCapabilities, AgentCard, AgentSkill
1617
from fastapi import FastAPI
1718
from starlette.applications import Starlette
@@ -36,6 +37,12 @@ def __init__(
3637
serve_at_root: bool = False,
3738
version: str = "0.0.1",
3839
skills: list[AgentSkill] | None = None,
40+
# RequestHandler
41+
task_store: TaskStore | None = None,
42+
queue_manager: QueueManager | None = None,
43+
push_config_store: PushNotificationConfigStore | None = None,
44+
push_sender: PushNotificationSender | None = None,
45+
3946
):
4047
"""Initialize an A2A-compatible server from a Strands agent.
4148
@@ -52,6 +59,14 @@ def __init__(
5259
Defaults to False.
5360
version: The version of the agent. Defaults to "0.0.1".
5461
skills: The list of capabilities or functions the agent can perform.
62+
task_store: Custom task store implementation for managing agent tasks. If None,
63+
uses InMemoryTaskStore.
64+
queue_manager: Custom queue manager for handling message queues. If None,
65+
no queue management is used.
66+
push_config_store: Custom store for push notification configurations. If None,
67+
no push notification configuration is used.
68+
push_sender: Custom push notification sender implementation. If None,
69+
no push notifications are sent.
5570
"""
5671
self.host = host
5772
self.port = port
@@ -77,7 +92,10 @@ def __init__(
7792
self.capabilities = AgentCapabilities(streaming=True)
7893
self.request_handler = DefaultRequestHandler(
7994
agent_executor=StrandsA2AExecutor(self.strands_agent),
80-
task_store=InMemoryTaskStore(),
95+
task_store=task_store or InMemoryTaskStore(),
96+
queue_manager=queue_manager,
97+
push_config_store=push_config_store,
98+
push_sender=push_sender,
8199
)
82100
self._agent_skills = skills
83101
logger.info("Strands' integration with A2A is experimental. Be aware of frequent breaking changes.")

src/strands/tools/mcp/mcp_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from ...types.media import ImageFormat
3030
from ...types.tools import ToolResultContent, ToolResultStatus
3131
from .mcp_agent_tool import MCPAgentTool
32+
from .mcp_instrumentation import mcp_instrumentation
3233
from .mcp_types import MCPToolResult, MCPTransport
3334

3435
logger = logging.getLogger(__name__)
@@ -68,6 +69,7 @@ def __init__(self, transport_callable: Callable[[], MCPTransport]):
6869
Args:
6970
transport_callable: A callable that returns an MCPTransport (read_stream, write_stream) tuple
7071
"""
72+
mcp_instrumentation()
7173
self._session_id = uuid.uuid4()
7274
self._log_debug_with_thread("initializing MCPClient connection")
7375
self._init_future: futures.Future[None] = futures.Future() # Main thread blocks until future completes

0 commit comments

Comments
 (0)