Repository navigation
Add a harness-neutral agent contract and adopt it for Copilot CLI #1008
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
Sun Haoran (haoranpb)
merged 7 commits into
core/harness-01-shared-types
from
core/harness-02-contract
Nov 3, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ac3e21c
Add a harness-neutral agent contract to bcbench-core
haoranpb 266df18
Return AgentResult from BC-Bench agent harnesses
haoranpb 5fa9224
Implement the harness contract for GitHub Copilot CLI and drop the tr…
haoranpb d534398
Carry the AgentIdentity on EvaluationContext and keep env out of the …
haoranpb 9be520e
Type the harness name, declare CopilotHarness as a Harness, and make …
haoranpb 9996d8b
Trim the harness contract to what harnesses use today
haoranpb 44cd5ec
Fall back to the default Copilot timeout only when none is requested
haoranpb 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| """Harness-neutral contract between evaluation pipelines and the agents they run.""" | ||
|
|
||
| from dataclasses import dataclass | ||
| from pathlib import Path | ||
| from typing import Protocol | ||
|
|
||
| from pydantic import BaseModel, ConfigDict | ||
|
|
||
| from bcbench_core.agent.experiment import ExperimentConfiguration | ||
| from bcbench_core.agent.metrics import AgentMetrics | ||
|
|
||
| __all__ = ["AgentIdentity", "AgentRequest", "AgentResult", "Harness"] | ||
|
|
||
|
|
||
| class AgentIdentity[N: str = str](BaseModel): | ||
| """What is being evaluated, resolved before any task runs. | ||
|
|
||
| ``N`` lets applications type the harness name, e.g. with their own ``StrEnum`` of harnesses. | ||
| """ | ||
|
|
||
| model_config = ConfigDict(frozen=True, extra="forbid") | ||
|
|
||
| harness: N | ||
| # CLI version, engine commit, or hosted agent version | ||
| version: str | ||
| # Configured model; None when the harness pins or delegates model selection | ||
| model: str | None = None | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class AgentRequest[T]: | ||
| task: T | ||
| # The agent's workspace: a prepared repository, or an empty directory for answer-only tasks | ||
| work_dir: Path | ||
| # Receives logs and raw captures | ||
| output_dir: Path | ||
| # None uses the harness's default | ||
| timeout: int | None = None | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class AgentResult: | ||
| # Final answer; None when the output is left in the workspace | ||
| response: str | None = None | ||
| metrics: AgentMetrics | None = None | ||
| experiment: ExperimentConfiguration | None = None | ||
|
|
||
|
|
||
| class Harness[T, N: str = str](Protocol): | ||
| """Runs an agent on tasks of type ``T``, identified by a harness name of type ``N``. | ||
|
|
||
| ``identity`` checks the harness is usable and raises ``AgentError`` otherwise. ``run`` raises | ||
| ``AgentTimeoutError`` when the timeout is exceeded and ``AgentError`` for any other failure. | ||
| """ | ||
|
|
||
| def identity(self) -> AgentIdentity[N]: ... | ||
|
haoranpb marked this conversation as resolved.
Resolved
|
||
|
|
||
| def run(self, request: AgentRequest[T], /) -> AgentResult: ... | ||
|
haoranpb marked this conversation as resolved.
Resolved
|
||
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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| """GitHub Copilot CLI agent module.""" | ||
|
|
||
| from bcbench.agent.copilot.agent import run_copilot_agent | ||
| from bcbench.agent.copilot.agent import CopilotHarness | ||
|
|
||
| __all__ = ["run_copilot_agent"] | ||
| __all__ = ["CopilotHarness"] |
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
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.