feat: add claude-agent-sdk single-agent and multi-agent patterns with READMEs#45
feat: add claude-agent-sdk single-agent and multi-agent patterns with READMEs#45kaleko merged 12 commits intoawslabs:mainfrom
Conversation
| - **Gateway auth**: OAuth2 client credentials flow via Cognito for machine-to-machine authentication | ||
| - **Gateway resilience**: If Gateway is unavailable, the agent continues without Gateway tools | ||
|
|
||
| ## Differences from Strands / LangGraph Patterns |
There was a problem hiding this comment.
I understand the differences, but my main question is why there are differences? For example why didn't we make the claude-sdk example use AgentCore Memory, single agent, and why we need an in-process MCP server for this? Would be useful to explain why the differences in the docs/code
| # Claude Agent SDK dependencies | ||
| claude-agent-sdk | ||
| bedrock-agentcore | ||
| bedrock-agentcore-starter-toolkit |
There was a problem hiding this comment.
This is an interesting dependency... definitely needed?
There was a problem hiding this comment.
Do we want to make this claude-agent-sdk-single-agent instead of having multiple agents, so it is more apples to apples with the existing patterns? Then we can include a readme or commented code showing how to extend it to multiple agents?
|
Latest scan for commit: Security Scan ResultsScan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies: Column Explanations: Severity Levels (S/C/H/M/L/I):
Other Columns:
Scanner Results:
Severity Thresholds (Thresh Column):
Threshold Source: Values in parentheses indicate where the threshold is configured:
Statistics calculation:
Detailed FindingsShow 18 actionable findingsFinding 1: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 2: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 3: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 4: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 5: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 6: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 7: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 8: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 9: python.jwt.security.unverified-jwt-decode.unverified-jwt-decode
Description: Code Snippet: Finding 10: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 11: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 12: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 13: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 14: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 15: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 16: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 17: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal
Description: Code Snippet: Finding 18: python.jwt.security.unverified-jwt-decode.unverified-jwt-decode
Description: Code Snippet: Report generated by Automated Security Helper (ASH) at 2026-03-11T19:28:00+00:00 |
Add a minimal claude-agent-sdk pattern alongside strands and langgraph, featuring Code Interpreter via in-process MCP server, a code-analyst subagent for Task-based delegation, Gateway integration, and a dedicated frontend SSE parser. CDK backend-stack updated with CLAUDE_CODE_USE_BEDROCK env var and zip deployment validation.
- Validate STACK_NAME format to prevent SSM parameter path injection - Validate required payload fields (prompt, runtimeSessionId) with proper error response - Wrap gateway URL retrieval in try/except to avoid crashes when gateway is unavailable
Covers features, architecture, file structure, tools, streaming events, session management, subagent usage, deployment, security, and comparison with strands/langgraph patterns.
Cover features, architecture, file structure, tools, streaming events, memory integration, security, deployment, and dependencies for both patterns.
…tterns Separates the claude-agent-sdk pattern into two distinct patterns: - claude-agent-sdk-single-agent: standalone agent with Code Interpreter and Gateway tools - claude-agent-sdk-multi-agent: adds subagent delegation via Task tool + code-analyst subagent
There was a problem hiding this comment.
I think all of the changes in this file can be reverted in lieu of latest force-push to main to fix frontend bugs.
There was a problem hiding this comment.
I think all of the changes in this file can be reverted in lieu of latest force-push to main to fix frontend bugs.
There was a problem hiding this comment.
I think all of the changes in this file can be reverted in lieu of latest force-push to main to fix frontend bugs. I believe the exact same fix was already pushed.
…rrors - Add get_gateway_access_token() using @requires_access_token decorator to utils/auth.py, fixing ImportError on agent startup - ChatMessage.tsx: prefix unused sessionId param with underscore - config.test.ts: add TSConfig interface and cast parseJSONC results - property-auth-routing.test.tsx: cast mock user objects to User type
…mory Instead of round-tripping claude_session_id through the frontend, maintain an in-memory runtimeSessionId -> claude_session_id mapping on the backend. Both are lost on container restart, so in-memory storage is sufficient. No frontend changes required.
Upstream excluded src/test from tsc (e609a28), making these fixes unnecessary. Reverting to match upstream.
Disable Bash, Write, Read, Edit, NotebookEdit, WebFetch, Glob, Grep, EnterWorktree, and Skill via disallowed_tools in ClaudeAgentOptions. The agent now operates exclusively through Code Interpreter MCP tools and Gateway tools. Added documentation explaining the configuration and how to re-enable tools.
…E_USE_BEDROCK env var - Add precondition to prevent zip deployment with claude-agent-sdk patterns - Add conditional CLAUDE_CODE_USE_BEDROCK=1 environment variable - Add is_claude_agent_sdk local flag Mirrors CDK backend-stack.ts changes from PR #45.
Summary
claude-agent-sdkagent patterns alongside strands and langgraph:claude-agent-sdk-single-agent: Standalone agent with Code Interpreter via in-process MCP server, Gateway integration, session management viaclaude_session_id, and secure JWT-based user identity extractionclaude-agent-sdk-multi-agent: Extends the single-agent pattern with subagent delegation — includes acode-analystsubagent for Task-based delegation via the Task toolCLAUDE_CODE_USE_BEDROCKenv var for both patterns and validation preventing zip deployment (requires Node.js + claude-code CLI)runtimeSessionIdtoclaude_session_idon the backend, no frontend round-trip neededdisallowed_toolsso the agent operates exclusively through Code Interpreter and Gateway MCP tools. Documentation explains how to re-enable individual tools.claude-agent-sdk==0.1.48and@anthropic-ai/claude-code@2.1.73for reproducible buildsChanged files
Single-agent pattern (
patterns/claude-agent-sdk-single-agent/):agent.py— main entrypoint withClaudeSDKClient,RequestContextsecurity, Code Interpreter MCP, Gateway, server-side session map,disallowed_toolsconfigurationcode_int_mcp/— in-process MCP server wrapping AgentCore Code Interpreter API (server, client, models)Dockerfile— Python 3.11 + Node.js +@anthropic-ai/claude-code@2.1.73requirements.txt—claude-agent-sdk==0.1.48, bedrock-agentcore, pydantic, PyJWT, etc.README.md— full pattern documentation including built-in tool configurationMulti-agent pattern (
patterns/claude-agent-sdk-multi-agent/):agents/subagents.py—code-analystsubagent definition viaAgentDefinitionagent.py— adds Task tool and subagent orchestration to the single-agent baseREADME.md— full pattern documentation including subagent usage and built-in tool configurationFrontend:
parsers/claude-agent-sdk.ts— dedicated parser fordata,current_tool_use,claude_session_ideventstypes.ts— added"claude-agent-sdk-single-agent"and"claude-agent-sdk-multi-agent"toAgentPatternunionclient.ts— registered both patterns with the shared parserShared utilities:
patterns/utils/auth.py— addedget_gateway_access_token()with@requires_access_tokendecoratorInfrastructure:
backend-stack.ts— conditionalCLAUDE_CODE_USE_BEDROCK=1env var + zip deployment validation for both patternsDocumentation:
patterns/strands-single-agent/README.mdpatterns/langgraph-single-agent/README.md