claude-agent-sdk-python
CLAUDE.md8.2k starsChanged 5 months agoMITView on GitHub
Workflow jobs in this repository that call Claude run with three protections. Keep them when you add or edit a workflow. 1. Egress-firewall runner. The job has runs-on: ubuntu-24.04-firewall, a GitHub-hosted runner that filters the job's outbound network traffic. Do not move a job that calls Claude to another runner. 2. Network allow list. .github/egress-firewall.yaml lists the hosts those jobs may reach, besides any that GitHub's firewall allows by default. Keep mode: enforce, which is what makes the firewall block…
Trending
Less talk lately.about the whole repository
Who's talking about anthropics/claude-agent-sdk-python
- anthropics/claude-agent-sdk-typescript“Feature Request: API to retrieve historical messages when resuming a session”GitHub · Oct 6, 2025 · 67 reactions
- NousResearch/hermes-agent“[Feature]: Claude Agent SDK model provider with subscription OAuth (Codex-style)”GitHub · May 13, 2026 · 57 reactions
- A Hacker News story“Claude Agent SDK for Python”Hacker News · Sep 30, 2025 · 18 points
- openclaw/openclaw“[Feature]: Adopt @anthropic-ai/claude-agent-sdk for enhanced agent capabilities”GitHub · Feb 6, 2026 · 8 reactions
- aws/agentcore-cli“[Enhancement] Add claude-agent-sdk (Python) as a supported framework”GitHub · Apr 23, 2026 · 3 reactions
The biggest 5 of 31 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 31
Talked about on GitHub, Hacker News and Bluesky (31 times).
On GitHub · 29
- Oct 6, 2025Feature Request: API to retrieve historical messages when resuming a session — anthropics/claude-agent-sdk-typescript67 reactions · 3 comments
- May 13, 2026[Feature]: Claude Agent SDK model provider with subscription OAuth (Codex-style) — NousResearch/hermes-agent57 reactions · 20 comments
- Feb 6, 2026[Feature]: Adopt @anthropic-ai/claude-agent-sdk for enhanced agent capabilities — openclaw/openclaw8 reactions · 5 comments
- Apr 23, 2026[Enhancement] Add claude-agent-sdk (Python) as a supported framework — aws/agentcore-cli3 reactions · 1 comment
- Dec 16, 2025Instrumenting claude-agent-sdk in logfire — pydantic/logfire3 reactions
24 more on GitHub
- Oct 31, 2025BUG: Result field in type ResultMessage is string — severity1/claude-agent-sdk-go3 reactions · 2 comments
- Sep 28, 2026build(deps): bump the eval-python group across 1 directory with 6 updates — ethpandaops/panda2 reactions
- Mar 13, 2026[BUG] CLI does not emit can_use_tool control_request when --permission-prompt-tool stdio — anthropics/claude-code2 reactions · 6 comments
- Feb 18, 2026feat: Add Python instrumentation for Claude Agent SDK (claude-agent-sdk) — Arize-ai/openinference2 reactions
- Dec 17, 2025mcp server setup using cli — QwenLM/qwen-code2 reactions
- Oct 5, 2026chore: bump the python-minor-patch group across 5 directories with 7 updates — opencodos/background-agents1 reaction · 4 comments
- Oct 4, 2026chore(deps): bump claude-agent-sdk from 0.2.162 to 0.2.163 in the ai-sdks group across 1 directory — ArcReel/ArcReel1 reaction · 1 comment
- Oct 3, 2026chore(deps): bump claude-agent-sdk from 0.2.161 to 0.2.162 in the ai-sdks group — ArcReel/ArcReel1 reaction · 1 comment
- Oct 1, 2026chore(deps): bump the python-prod group with 5 updates — DataDog/airedale1 reaction
- Sep 3, 2026chore(deps): bump the python-prod group with 5 updates — DataDog/airedale1 reaction · 1 comment
- Aug 31, 2026chore(deps): bump the python-deps group in /agent/core with 4 updates — elyxlz/vesta1 reaction
- Aug 25, 2026chore(deps): bump the ai-sdks group across 1 directory with 3 updates — ArcReel/ArcReel1 reaction · 3 comments
- Aug 24, 2026chore(deps): bump the python-deps group in /agent/core with 4 updates — elyxlz/vesta1 reaction · 1 comment
- Aug 24, 2026chore(deps): bump the ai-sdks group across 1 directory with 2 updates — ArcReel/ArcReel1 reaction · 2 comments
- Aug 23, 2026chore(deps): bump claude-agent-sdk from 0.2.139 to 0.2.142 in the ai-sdks group — ArcReel/ArcReel1 reaction · 1 comment
- Aug 17, 2026chore(deps): bump the python-deps group in /agent/core with 4 updates — elyxlz/vesta1 reaction
- Aug 15, 2026chore(deps): bump the python-deps group across 1 directory with 5 updates — elyxlz/vesta1 reaction
- Aug 10, 2026chore(deps): bump the ai-sdks group across 1 directory with 3 updates — ArcReel/ArcReel1 reaction · 5 comments
- Jul 30, 2026chore(deps): bump the python-prod group with 5 updates — DataDog/airedale1 reaction · 1 comment
- Jul 23, 2026chore(deps): bump the python-prod group with 5 updates — DataDog/airedale1 reaction
- Jul 20, 2026chore(deps): bump the ai-sdks group across 1 directory with 3 updates — ArcReel/ArcReel1 reaction · 4 comments
- Mar 2, 2026chore(backend/deps): bump the production-dependencies group across 1 directory with 18 updates — Significant-Gravitas/AutoGPT1 reaction · 4 comments
- Feb 27, 2026chore(backend/deps): bump the production-dependencies group across 1 directory with 14 updates — Significant-Gravitas/AutoGPT1 reaction · 2 comments
- Oct 31, 2025Convert Claude SDK to Agent Framework — ksmuvva/Synthetic-data-generator1 reaction
On Hacker News · 1
- Sep 30, 2025Claude Agent SDK for Python18 points · 1 comment
On Bluesky · 1
- Oct 9, 2025anthropics / claude-agent-sdk-python https://github.com/anthropics/claude-agent-sdk-python — @pythonhub.dev2 likes and reposts
In this repositoryOne other file it gives its agents.
- verifySkill
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Keep them when you add or edit a workflow.
- Very specific: line 39
Keep mode: enforce, which is what makes the firewall block the rest.
- Very specific: line 41
Auto permission mode: Every step that runs the Claude Code action (uses: anthropics/claude-code-action, or a local action with a …
- Very specific: line 81
Keep each workflow's permissions: block minimal, and never print tokens or environment variables in workflow logs.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Workflow
# Lint and style
# Check for issues and fix automatically
python -m ruff check src/ tests/ scripts/ --fix
python -m ruff format src/ tests/ scripts/
# Typecheck
python -m mypy src/ scripts/
# Run all tests
python -m pytest tests/
# Run specific test file
python -m pytest tests/test_client.pyCodebase Structure
src/claude_agent_sdk/- Main packageclient.py- ClaudeSDKClient for interactive sessionsquery.py- One-shot query functiontypes.py- Type definitions_internal/- Internal implementation detailstransport/subprocess_cli.py- CLI subprocess managementmessage_parser.py- Message parsing logic
Security hardening for GitHub Actions
Workflow jobs in this repository that call Claude run with three protections. Keep them when you add or edit a workflow.
- Egress-firewall runner. The job has
runs-on: ubuntu-24.04-firewall, a GitHub-hosted runner that filters the job's outbound network traffic. Do not move a job that calls Claude to another runner. - Network allow list.
.github/egress-firewall.yamllists the hosts those jobs may reach, besides any that GitHub's firewall allows by default. Keepmode: enforce, which is what makes the firewall block the rest. Follow that file's header when you add a host. - Auto permission mode. Every step that runs the Claude Code action
(
uses: anthropics/claude-code-action, or a local action with aclaude_argsinput) passes--permission-mode autoinclaude_args. A tool call that needs permission and that the allowed tools do not cover then runs only if Claude Code's safety review passes it. Allow only the tools the job needs, and keep any--disallowedToolslist a step has. Useclaude-opus-4-6or a newer model: on an older one Claude Code falls back to its default permission mode.
claude.yml answers @claude mentions. The Claude Code action sets
--permission-mode acceptEdits for those, and the --permission-mode auto in
the workflow's claude_args, which comes after it, replaces it.
build-and-publish.yml's publish and release jobs hold the publishing
credentials (the PyPI token and the deploy key) and do not call Claude. Claude
writes the changelog in generate-changelog.yml, a job with none of those
credentials that runs after the upload to PyPI, and the release job takes only
CHANGELOG.md from it. Both jobs refuse that file unless it is a plain text file
with no credential-like strings in it. Keep it that way.
Exception (listed with its reason in an exemption table in
.github/scripts/check_workflow_hardening.py): test.yml's test-e2e job runs
on Linux, macOS and Windows. Its matrix uses ubuntu-24.04-firewall for Linux.
GitHub offers no such runner for macOS or Windows, so there the tests run
through .github/scripts/run-e2e-firewalled-macos.sh and
.github/scripts/run-e2e-firewalled-windows.ps1: as a separate
non-administrator user whose outbound traffic the OS firewall limits to the
Claude API. Keep running them that way. The check makes sure the matrix's only
Linux entry is ubuntu-24.04-firewall, but it does not look at those steps:
keep the two scripts by hand.
.github/workflows/workflow-hardening.yml fails when a job that runs the Claude
Code action or mentions ANTHROPIC_FEDERATION_RULE_ID breaks protection 1 or 3,
or when the allow list is missing, empty, not mode: enforce, or names a host
with *. It cannot see a job that calls Claude another way, so check new
workflows by hand too. If a job cannot meet protection 1 or 3, add it with the
reason to the matching exemption table in
.github/scripts/check_workflow_hardening.py. A job in EXEMPT_FROM_AUTO_MODE
must set no permission mode at all. Do not skip or weaken the check.
Keep each workflow's permissions: block minimal, and never print tokens or
environment variables in workflow logs.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

