Skip to content

feat(evaluation): evaluate existing sessions and add RecommendationClient - #708

Merged
jariy17 merged 2 commits into
mainfrom
feat/evaluation-session-runs-and-recommendations
Oct 22, 2026
Merged

jariy17 merged 2 commits into
mainfrom
feat/evaluation-session-runs-and-recommendations

Conversation

@sundargthb

@sundargthb sundargthb commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Adds two small pieces for working with agents that already run on AgentCore Runtime. Both are framework agnostic.

EvaluationClient now allowlists the batch evaluation APIs (start, get, list, stop, delete) and adds start_batch_evaluation_and_wait, which scores sessions already in CloudWatch without invoking the agent. Scores come back under evaluationResults and Builtin.FailureAnalysis insights under insightResults. wait_until now accepts a set of target statuses so a run that ends as COMPLETED_WITH_ERRORS returns instead of timing out.

RecommendationClient passes through the four recommendation APIs (allowlisted, accepts snake_case kwargs) and adds start_recommendation_and_wait. It follows the same pattern as DatasetClient.

CloudWatchDataSourceConfig.to_data_source_config omits sessionIds when the list is empty, since an empty list filters to nothing.

batch = EvaluationClient(region_name="us-west-2").start_batch_evaluation_and_wait(
    wait_config=WaitConfig(max_wait=1800),
    batch_evaluation_name="nightly",
    evaluators=[{"evaluatorId": "Builtin.GoalSuccessRate"}, {"evaluatorId": "Builtin.FailureAnalysis"}],
    data_source_config={"cloudWatchLogs": {...}},
)
rec = RecommendationClient(region_name="us-west-2").start_recommendation_and_wait(
    wait_config=WaitConfig(max_wait=1800),
    name="promptrec",
    type="SYSTEM_PROMPT_RECOMMENDATION",
    recommendation_config={"systemPromptRecommendationConfig": {
        "systemPrompt": {"text": prompt},
        "agentTraces": {"batchEvaluation": {"batchEvaluationArn": batch["batchEvaluationArn"]}},
        "evaluationConfig": {"evaluators": [{"evaluatorArn": goal_success_arn}]},
    }},
)

Testing: unit tests added. The full suite passes (3621 passed). Tested live in us-west-2: GoalSuccessRate and FailureAnalysis ran over 2 existing runtime sessions in 102 s and returned 2 insight results, and a recommendation from a batch evaluation completed in 123 s.

…ient

Add BatchEvaluationRunner.run_session_evaluation to score sessions already in
CloudWatch without invoking the agent, and RecommendationClient with
start_recommendation_and_wait for system prompt and tool description
recommendations.
@github-actions

Copy link
Copy Markdown
Contributor

✅ No Breaking Changes Detected

No public API breaking changes found in this PR.

@sundargthb
sundargthb deployed to auto-approve October 22, 2026 20:19 — with GitHub Actions Active
@sundargthb
sundargthb deployed to auto-approve October 22, 2026 20:19 — with GitHub Actions Active
@sundargthb
sundargthb deployed to auto-approve October 22, 2026 20:19 — with GitHub Actions Active
@sundargthb
sundargthb deployed to auto-approve October 22, 2026 20:19 — with GitHub Actions Active
@sundargthb
sundargthb deployed to auto-approve October 22, 2026 20:19 — with GitHub Actions Active
@github-actions github-actions Bot added the size/m PR size: M label Oct 22, 2026
@sundargthb
sundargthb deployed to auto-approve October 22, 2026 20:19 — with GitHub Actions Active
@sundargthb
sundargthb deployed to auto-approve October 22, 2026 20:19 — with GitHub Actions Active
@sundargthb
sundargthb deployed to auto-approve October 22, 2026 20:19 — with GitHub Actions Active
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Oct 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Oct 22, 2026

@jariy17 jariy17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two comments. RecommendationClient looks good. The one I care about is run_session_evaluation: I think it belongs on EvaluationClient with the batch APIs added to its allowlist, rather than on BatchEvaluationRunner, which exists for dataset runs. The other is a minor ordering nit.

Comment thread src/bedrock_agentcore/evaluation/runner/batch/batch_evaluation_runner.py Outdated
Comment thread src/bedrock_agentcore/evaluation/runner/batch/batch_evaluation_runner.py Outdated
Allowlist the batch evaluation APIs on EvaluationClient and add
start_batch_evaluation_and_wait. Revert run_session_evaluation from
BatchEvaluationRunner, which is for dataset runs. wait_until accepts a set
of target statuses.
@sundargthb

Copy link
Copy Markdown
Member Author

Thanks, moved it. EvaluationClient now allowlists the five batch APIs and has start_batch_evaluation_and_wait, and the runner is back to main, so the ordering nit goes away with it. wait_until now also accepts a set of target statuses, since a batch evaluation can finish as COMPLETED or COMPLETED_WITH_ERRORS. The sessionIds fix stays. Verified live on two existing runtime sessions with GoalSuccessRate and FailureAnalysis.

@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Oct 22, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Oct 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Oct 22, 2026
@jariy17
jariy17 merged commit fd7d15d into main Oct 22, 2026
49 of 50 checks passed
@jariy17
jariy17 deleted the feat/evaluation-session-runs-and-recommendations branch October 22, 2026 23:50

This branch had an error being deployed

1 failed deployment
auto-approve — 72d2bb78 Deployed Oct 22, 2026 by sundargthb via Test (evaluation) #1647
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants