-
Notifications
You must be signed in to change notification settings - Fork 88
feat: wire observability client to harness and evals #2182
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
Merged
+558
−197
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b50bcd3
chore: update batch evals to use shared cloudwatch client
nborges-aws 17cf224
feat: support observability for harness
nborges-aws 1c9ad89
chore: remove output path re-export
nborges-aws 8de93e4
fix: inject shared cloudWatch client into dependents
nborges-aws cadd0ae
chore: exercise runtime resolution in harness fixture test
nborges-aws 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
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
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
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
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,59 @@ | ||
| import { describe, expect, test } from "bun:test"; | ||
| import { | ||
| GetHarnessCommand, | ||
| type GetHarnessResponse, | ||
| } from "@aws-sdk/client-bedrock-agentcore-control"; | ||
| import { InputValidationError } from "../errors"; | ||
| import type { AwsClients, ClientConfig } from "./types"; | ||
| import { HarnessClient, harnessRuntimeFromResponse } from "./harness"; | ||
|
|
||
| const RESPONSE = { | ||
| harness: { | ||
| environment: { | ||
| agentCoreRuntimeEnvironment: { | ||
| agentRuntimeId: "harness_MyHarness-AbC123", | ||
| agentRuntimeName: "harness_MyHarness", | ||
| }, | ||
| }, | ||
| }, | ||
| } as GetHarnessResponse; | ||
|
|
||
| describe("harnessRuntimeFromResponse", () => { | ||
| test("rejects a harness without a resolvable Runtime environment", () => { | ||
| expect(() => | ||
| harnessRuntimeFromResponse("MyHarness-abc123", { | ||
| harness: { environment: { $unknown: ["futureProvider", {}] } }, | ||
| } as GetHarnessResponse), | ||
| ).toThrow(InputValidationError); | ||
| }); | ||
| }); | ||
|
|
||
| describe("HarnessClient.resolveRuntime", () => { | ||
| test("gets the harness with the configured client and forwards cancellation", async () => { | ||
| const configs: ClientConfig[] = []; | ||
| const controller = new AbortController(); | ||
| const clients = { | ||
| control: (config: ClientConfig) => { | ||
| configs.push(config); | ||
| return { | ||
| send: async (command: unknown, options?: { abortSignal?: AbortSignal }) => { | ||
| expect(command).toBeInstanceOf(GetHarnessCommand); | ||
| expect((command as GetHarnessCommand).input).toEqual({ | ||
| harnessId: "MyHarness-abc123", | ||
| }); | ||
| expect(options?.abortSignal).toBe(controller.signal); | ||
| return RESPONSE; | ||
| }, | ||
| }; | ||
| }, | ||
| } as unknown as AwsClients; | ||
| const client = new HarnessClient(clients); | ||
|
|
||
| await client.resolveRuntime( | ||
| "MyHarness-abc123", | ||
| { region: "us-west-2", endpointUrl: "https://control.test" }, | ||
| controller.signal, | ||
| ); | ||
| expect(configs).toEqual([{ region: "us-west-2", endpoint: "https://control.test" }]); | ||
| }); | ||
| }); | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be using the fixtures here?