-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Claude SDK and Google ADK supported-frameworks #1772
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
Open
svguruprasad
wants to merge
9
commits into
awslabs:main
Choose a base branch
from
svguruprasad:feature/agentcore-harness
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
674df35
feat(evaluations): add supported-frameworks samples (Google ADK, Clau…
svguruprasad 41b7fc1
test: add unit tests, fix Dockerfiles, add .env.example
svguruprasad 33dcef6
fix(claude-agent-sdk): correct SDK API usage after local verification
svguruprasad 6cac439
docs: add Guruprasad Seeryada to CONTRIBUTORS.md
svguruprasad 0391fd8
fix: remove f-string without placeholders (ruff F541)
svguruprasad 6f76f99
Merge branch 'main' into feature/agentcore-harness
BharathiSrini a693ce8
style: apply ruff format to all Python files
svguruprasad 087ce1a
fix: address reviewer feedback (Bharathi)
svguruprasad ec1127b
docs: add architecture diagrams (AWS icons, draw.io export)
svguruprasad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...observe-evaluate-optimize-your-agent/02-evaluate/supported-frameworks/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # AgentCore Evaluations — Supported Frameworks | ||
|
|
||
| This folder contains code samples demonstrating AgentCore Evaluations running | ||
| against agents built with different frameworks. Each sample builds the **same | ||
| HR Assistant agent** (same tools, same mock data, same evaluation scenarios) so | ||
| results are directly comparable. | ||
|
|
||
| ## Samples | ||
|
|
||
| | Framework | Instrumentation | Scope Name | Sample | | ||
| |-----------|----------------|------------|--------| | ||
| | [Google ADK](google-adk/) | `openinference-instrumentation-google-adk >= 0.1.13` | `openinference.instrumentation.google_adk` | [→](google-adk/) | | ||
| | [Claude Agent SDK](claude-agent-sdk/) | `openinference-instrumentation-claude-agent-sdk >= 0.1.3` | `openinference.instrumentation.claude_agent_sdk` | [→](claude-agent-sdk/) | | ||
|
|
||
| ## Key takeaway | ||
|
|
||
| **AgentCore Evaluations is framework-agnostic.** You add the instrumentation | ||
| library to your dependencies, deploy to AgentCore Runtime (where ADOT | ||
| auto-discovers it), and the evaluation service reads the spans — regardless of | ||
| which framework produced them. | ||
|
|
||
| No changes to your agent code. No custom telemetry plumbing. Just: | ||
|
|
||
| ``` | ||
| requirements.txt: | ||
| openinference-instrumentation-<your-framework>>=X.Y.Z | ||
| ``` | ||
|
|
||
| ## Evaluation pipeline (shared across all samples) | ||
|
|
||
| ``` | ||
| Deploy agent → Invoke (3 turns) → Wait for spans → On-demand eval → Online eval config | ||
| ``` | ||
|
|
||
| ### Evaluators used | ||
|
|
||
| | Evaluator | Level | What it measures | | ||
| |-----------|-------|------------------| | ||
| | `Builtin.GoalSuccessRate` | SESSION | Did the agent fulfill the user's goal? | | ||
| | `Builtin.Correctness` | TRACE | Is each response factually correct? | | ||
| | `Builtin.Helpfulness` | TRACE | Was each response helpful? | | ||
| | `HRResponseQuality` (custom) | TRACE | HR-specific accuracy + completeness + tone | | ||
|
|
||
| ## Shared code | ||
|
|
||
| `shared/mock_data.py` contains the HR mock data and evaluation scenarios imported | ||
| by both framework samples. This ensures identical tool behavior across frameworks. | ||
|
|
||
| ## Full list of supported frameworks | ||
|
|
||
| See [Supported agent frameworks](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/supported-frameworks.html) | ||
| for the complete list including Strands, LangGraph, OpenAI Agents, and LlamaIndex. | ||
7 changes: 7 additions & 0 deletions
7
...aluate-optimize-your-agent/02-evaluate/supported-frameworks/claude-agent-sdk/.env.example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # AWS Configuration (uses default credential chain if not set) | ||
| # AWS_ACCESS_KEY_ID= | ||
| # AWS_SECRET_ACCESS_KEY= | ||
| # AWS_REGION=us-east-1 | ||
|
|
||
| # Agent model (Claude on Bedrock — no external API key needed) | ||
| BEDROCK_MODEL_ID=us.anthropic.claude-sonnet-4-5-20250929-v1:0 |
5 changes: 5 additions & 0 deletions
5
...evaluate-optimize-your-agent/02-evaluate/supported-frameworks/claude-agent-sdk/.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| results/ | ||
| agent_config.json | ||
| .env | ||
| __pycache__/ | ||
| *.pyc |
134 changes: 134 additions & 0 deletions
134
...optimize-your-agent/02-evaluate/supported-frameworks/claude-agent-sdk/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| # Evaluate a Claude Agent SDK Agent with AgentCore Evaluations | ||
|
|
||
| This sample demonstrates how to evaluate an agent built with the | ||
| [Claude Agent SDK](https://docs.claude.com/en/api/agent-sdk/overview) using | ||
| Amazon Bedrock AgentCore Evaluations. | ||
|
|
||
|
svguruprasad marked this conversation as resolved.
|
||
| ## How AgentCore Evaluations supports Claude Agent SDK | ||
|
|
||
| AgentCore Evaluations is framework-agnostic. It reads OpenTelemetry spans emitted by your agent and evaluates them regardless of which framework produced them. For Claude Agent SDK, the [`openinference-instrumentation-claude-agent-sdk`](https://pypi.org/project/openinference-instrumentation-claude-agent-sdk/) library auto-instruments the SDK client — just add it to your `requirements.txt` and ADOT discovers it at startup. No code changes to your agent. | ||
|
|
||
| The evaluation service reconstructs your agent session from `AGENT` and `TOOL` spans, extracts user prompts and agent responses, and runs evaluators (built-in or custom) against them. | ||
|
|
||
| For full documentation, see: [Supported frameworks — Claude Agent SDK](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/supported-frameworks-claude-agent-sdk.html) | ||
|
|
||
| ## What this sample does | ||
|
|
||
| 1. **Deploys** an HR Assistant agent (Claude Agent SDK) to AgentCore Runtime | ||
| 2. **Instruments** it automatically via `openinference-instrumentation-claude-agent-sdk` | ||
| 3. **Invokes** a 3-turn conversation (PTO check → PTO request → policy lookup) | ||
| 4. **Evaluates** using built-in + custom LLM-as-a-judge evaluators | ||
| 5. **Sets up online evaluation** for continuous monitoring | ||
| 6. **Cleans up** all resources when you're done | ||
|
|
||
| ## Architecture | ||
|
|
||
|  | ||
|
|
||
| ## Telemetry details | ||
|
|
||
| | Aspect | Value | | ||
| |--------|-------| | ||
| | Instrumentation library | `openinference-instrumentation-claude-agent-sdk >= 0.1.3` | | ||
| | Scope name | `openinference.instrumentation.claude_agent_sdk` | | ||
| | Invoke agent span | `openinference.span.kind` = `AGENT` | | ||
| | Tool span | `openinference.span.kind` = `TOOL` | | ||
|
svguruprasad marked this conversation as resolved.
|
||
| | Inference span | N/A (model metadata on AGENT span) | | ||
|
|
||
| ## Example trace | ||
|
|
||
| When the agent runs on AgentCore Runtime with the instrumentation library installed, spans like these appear in CloudWatch: | ||
|
|
||
| **Invoke agent span (AGENT):** | ||
| ```json | ||
| { | ||
| "traceId": "6a292d74406894815807e2751e61dd49", | ||
| "spanId": "a63aab3320ed8718", | ||
| "name": "ClaudeAgentSDK.ClaudeSDKClient.receive_response", | ||
| "scope": { | ||
| "name": "openinference.instrumentation.claude_agent_sdk", | ||
| "version": "0.1.5" | ||
| }, | ||
| "attributes": { | ||
| "openinference.span.kind": "AGENT", | ||
| "llm.system": "anthropic", | ||
| "llm.model_name": "us.anthropic.claude-sonnet-4-5-20250929-v1:0", | ||
| "session.id": "hr-assistant-eval-session" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| **Tool span (TOOL):** | ||
| ```json | ||
| { | ||
| "traceId": "6a292deb7450b3155895da4f38cb579a", | ||
| "spanId": "909dcb4eb5f851ae", | ||
| "name": "get_pto_balance", | ||
| "scope": { | ||
| "name": "openinference.instrumentation.claude_agent_sdk" | ||
| }, | ||
| "attributes": { | ||
| "openinference.span.kind": "TOOL", | ||
| "tool.name": "get_pto_balance", | ||
| "tool.parameters": "{\"employee_id\": \"EMP-001\"}" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| The evaluation service reads these spans, extracts the user prompt and agent response from the correlated event records, and scores them against configured evaluators. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| 1. **AWS credentials** configured (`aws configure`) | ||
| 2. **Bedrock model access** enabled for: | ||
| - `us.anthropic.claude-sonnet-4-5-20250929-v1:0` (agent model) | ||
| - `us.amazon.nova-lite-v1:0` (judge model for evaluation) | ||
| 3. **AgentCore CLI** installed: `npm install -g @aws/agentcore` | ||
| 4. **Python 3.12+** with pip | ||
|
|
||
| ## Quick start (< 15 minutes) | ||
|
|
||
| ```bash | ||
| # 1. Install dependencies | ||
| pip install -r requirements.txt | ||
|
|
||
| # 2. Deploy the agent to AgentCore | ||
| python deploy.py --region us-east-1 | ||
|
|
||
| # 3. Run evaluation (invokes agent + evaluates spans) | ||
| python evaluate.py | ||
|
|
||
| # 4. Review results | ||
| cat results/on_demand_results.json | ||
|
|
||
| # 5. Cleanup when done | ||
| python cleanup.py | ||
| ``` | ||
|
|
||
| ## Cost estimate | ||
|
|
||
| | Component | Cost per run | | ||
| |-----------|-------------| | ||
| | Bedrock (agent, 3 turns) | ~$0.10 | | ||
| | Bedrock (judge, 4 evaluations) | ~$0.01 | | ||
| | CloudWatch Logs | ~$0.01 | | ||
| | **Total** | **< $0.15** | | ||
|
|
||
| > ⚠️ Run `python cleanup.py` when finished to avoid ongoing charges. | ||
|
|
||
| ## Files | ||
|
|
||
| | File | Purpose | | ||
| |------|---------| | ||
| | `agent.py` | HR Assistant agent using Claude Agent SDK | | ||
| | `deploy.py` | Deploy to AgentCore Runtime | | ||
| | `evaluate.py` | On-demand + online evaluation | | ||
| | `cleanup.py` | Delete all created resources | | ||
| | `requirements.txt` | Python dependencies | | ||
| | `Dockerfile` | Container image for AgentCore | | ||
|
|
||
| ## Related | ||
|
|
||
| - [Supported frameworks documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/supported-frameworks-claude-agent-sdk.html) | ||
| - [AgentCore Evaluations overview](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/evaluation.html) | ||
| - [Strands evaluation sample](../../llm-as-a-judge-evaluation/) (same HR Assistant, different framework) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.