python-sdk
Guide work on the Strands Python SDK: agent loop, tools, models, MCP, memory, sessions, hooks, interventions, plugins, sandbox, telemetry, multi-agent graphs, snapshots, checkpoints, and Python tests.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- python-sdk
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Guide work on the Strands Python SDK: agent loop, tools, models, MCP, memory, sessions, hooks, interventions, plugins, sandbox, telemetry, multi-agent graphs, snapshots, checkpoints, and Python tests.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/api-reference.md10.4 KB
- 参考文档references/overview.md3.1 KB
- 参考文档references/testing-and-maintenance.md4.1 KB
- 参考文档references/troubleshooting.md7.5 KB
- 参考文档references/workflows.md6.3 KB
- 脚本scripts/python-core-check.sh8.8 KB
03 SKILL.md 正文
Python SDK
Use this sub-skill for Strands Python SDK work in the strands-agents package
and its Python source tree.
Start here
- Read overview.md to confirm scope, package identity, and exclusions.
- Read api-reference.md for verified signatures, exports, extras, and provider surfaces.
- Read workflows.md for the smallest safe path for the task.
- Read testing-and-maintenance.md before changing code or tests.
- Read troubleshooting.md when the task is about recovery or diagnosis.
- Run python-core-check.sh for import and signature sanity; add
--pytestonly in a Strands Agents checkout with test dependencies installed.
Use this sub-skill for
Agent, invocation, event loop, concurrency, limits, structured output, checkpoints, snapshots, and direct tool calls.@tool, tool schemas,ToolContext, tool loading, tool providers, executors, and MCP client integration.- Model providers, model config validation, streaming, token counting, context-window behavior, and provider error translation.
- Conversation managers, context manager strategies, memory manager, sessions, storage, hooks, interventions, plugins, sandbox, and telemetry.
- Multi-agent graph, swarm, A2A, shared result/state objects, and multi-agent hook/plugin behavior.
- Python unit tests, focused integration-test selection, package extras, and Python-specific coding conventions.
Route elsewhere
- TypeScript SDK implementation or Node/browser package checks: use typescript-sdk.
- Docs-site authoring, snippets,
sourceLinks, generated API docs, or navigation: use docs-site. - The docs-search MCP server package and its
search_docs/fetch_doctools: use mcp-server. - AWS test-infra or live provider credentials: treat as optional and credential-bound unless explicitly requested.
Operating rules
- Prefer verified signatures and package metadata from the bundled references over memory.
- Public package surfaces should be declared through
__all__; heavy optional providers should remain lazy-loaded. - Use precise types,
X | Noneoptionals, coded# type: ignore[code], Google-style docstrings, and specific exceptions. - Provider boundaries translate vendor context-window and throttling errors to typed SDK exceptions and chain the original cause.
- Hook events use shared names and before/after ordering; compare sibling TypeScript behavior before changing cross-SDK event names.
- Keep provider credentials, network services, AWS resources, and optional backend extras explicit in the verification handoff.
Fast path
- Identify the owning subsystem and read the closest reference section.
- Inspect the target file and smallest behavior test for line-level confirmation; do not widen to unrelated provider or integration surfaces.
- Run the import/signature smoke helper first, then the smallest relevant pytest slice.
- If a task changes public API, check docs and TypeScript parity before final handoff.
- Record skipped provider, credential, network, or AWS-backed checks instead of implying broad integration coverage.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).