-
Notifications
You must be signed in to change notification settings - Fork 94
Add multi-agent shared state docs #265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
result = graph( | ||
"Analyze customer data", | ||
invocation_state={ | ||
"api_key": "secret-key-123", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove references to api keys/tool-configs from invocation_state usages?
The python-tools section update is good, but the examples throughout the other pages should be updated as well
4. **Custom Parameters**: Pass any additional data that hooks might need | ||
|
||
```python | ||
from strands.experimental.hooks import BeforeToolInvocationEvent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been updated, lets point to the main location
from strands.experimental.hooks import BeforeToolInvocationEvent | |
from strands.hooks import BeforeToolCallEvent |
user_id="user123", | ||
session_id="sess456", | ||
environment="staging" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we give an example where we are passing a non-json serializable object through invocation state? Right now, its not really clear what its benefit is over AgentState
Description
This PR documents the new multi-agent shared state feature that allows passing
invocation_state
to Graph and Swarm patterns. The feature enables sharing configuration, credentials, and context data across all agents in multi-agent patterns without exposing this information to the LLM.Type of Change
Motivation and Context
Following the implementation of PR #816 in the SDK, this documentation update is needed to help developers understand how to use the new
invocation_state
parameter with multi-agent patterns. The feature addresses a key customer need for sharing configuration and credentials across agents while maintaining proper separation of concerns.The original SDK PR introduced kwargs support to Graph and Swarm, allowing developers to pass shared state that gets propagated to all agents, tools, and hooks without being visible in LLM prompts.
Areas Affected
docs/user-guide/concepts/multi-agent/graph.md
- Added "Shared State" sectiondocs/user-guide/concepts/multi-agent/swarm.md
- Added "Shared State" sectiondocs/user-guide/concepts/tools/python-tools.md
- Added "Accessing Invocation State in Tools" sectiondocs/user-guide/concepts/agents/hooks.md
- Added "Accessing Invocation State in Hooks" sectionScreenshots
N/A - Documentation changes only
Checklist
mkdocs serve
Additional Notes
This documentation covers three key integration points for the shared state feature:
invocation_state
and what gets propagatedToolContext.invocation_state
The documentation emphasizes the important distinction between:
invocation_state
Cross-references between sections help developers understand the complete integration story across the framework.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.