Repository navigation
fix: retrieving cold memories; add regression task #6950
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
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7967aef
test(benchmarks): add memory retrieval eval
philazar 09a692b
Merge remote-tracking branch 'origin/main' into pazar/agent-memory-evals
philazar fef8316
test(benchmarks): include memory eval in layers
philazar edddf5a
making the slug name readable
philazar 65c7d04
[bug] fix rename in tests
philazar a87823a
pazar: addressed feedback from PR comments
philazar 1a2833f
update: made it more deterministic and easier to grade with direct nu…
philazar 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # memory-retrieval | ||
|
|
||
| Before the agent starts, the harness runs `buzz mem set` with the agent's own | ||
| Buzz credentials to seed a GPV rule as cold memory. It then delivers | ||
| `instruction.md`, which contains only the retrieval question and does not | ||
| reveal the memory value or slug. No channel message contains the answer, so | ||
| conversation history cannot supply it. | ||
|
|
||
| Passing requires a threaded answer that selects `net_gpv`. The verifier does | ||
| not inspect tool calls: seeding is deterministic harness setup, and retrieval | ||
| is graded only through the observable answer. |
3 changes: 3 additions & 0 deletions
3
benchmarks/buzz-dataset/memory-retrieval/environment/Dockerfile
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,3 @@ | ||
| FROM python:3.12-slim-bookworm | ||
|
|
||
| WORKDIR /app |
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 @@ | ||
| What column should be used for gpv calculation? |
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,25 @@ | ||
| schema_version = "1.3" | ||
|
|
||
| [task] | ||
| name = "buzz-native/memory-retrieval" | ||
| description = "Answer a question using a harness-seeded cold-memory rule." | ||
| authors = [{ name = "Buzz" }] | ||
| keywords = ["buzz-native", "agents", "memory", "retrieval"] | ||
|
|
||
| [metadata] | ||
| evaluation_layer = "regression" | ||
| difficulty = "hard" | ||
| category = "collaboration" | ||
| tags = ["agents", "memory", "retrieval"] | ||
|
|
||
| [agent] | ||
| timeout_sec = 300.0 | ||
|
|
||
| [verifier] | ||
| timeout_sec = 30.0 | ||
|
|
||
| [environment] | ||
| network_mode = "public" | ||
| cpus = 1 | ||
| memory_mb = 1024 | ||
| storage_mb = 1024 |
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 @@ | ||
| #!/bin/sh | ||
| set -eu | ||
|
|
||
| mkdir -p /logs/verifier | ||
| python3 /tests/verify.py --evidence /logs/artifacts/buzz-evidence.json --reward /logs/verifier/reward.json --details /logs/verifier/details.json |
102 changes: 102 additions & 0 deletions
102
benchmarks/buzz-dataset/memory-retrieval/tests/verify.py
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,102 @@ | ||
| #!/usr/bin/env python3 | ||
| """Deterministic verifier for pre-seeded cold-memory retrieval.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import json | ||
| import re | ||
| from pathlib import Path | ||
| from typing import Any | ||
|
|
||
|
|
||
| def _zero() -> dict[str, float]: | ||
| return { | ||
| "reward": 0.0, | ||
| "answer_correct": 0.0, | ||
| "threaded_reply": 0.0, | ||
| "evidence_complete": 0.0, | ||
| } | ||
|
|
||
|
|
||
| def score_evidence(evidence: object) -> tuple[dict[str, float], dict[str, Any]]: | ||
| if not isinstance(evidence, dict): | ||
| return _zero(), {"error": "evidence root is not an object"} | ||
|
|
||
| identities = evidence.get("identities", {}) | ||
| agents = ( | ||
| [ | ||
| row | ||
| for row in identities.values() | ||
| if isinstance(row, dict) and row.get("role") == "orchestrator" | ||
| ] | ||
| if isinstance(identities, dict) | ||
| else [] | ||
| ) | ||
| agent_pubkey = agents[0].get("pubkey") if len(agents) == 1 else None | ||
| question_id = evidence.get("task_event_id") | ||
| trial = evidence.get("trial", {}) | ||
| question_channel = trial.get("channel_id") if isinstance(trial, dict) else None | ||
|
|
||
| messages = [row for row in evidence.get("messages", []) if isinstance(row, dict)] | ||
| replies = [ | ||
| row | ||
| for row in messages | ||
| if agent_pubkey | ||
| and row.get("pubkey") == agent_pubkey | ||
| and row.get("channel_id") == question_channel | ||
| and row.get("reply_to_event_id") == question_id | ||
| ] | ||
| answer = replies[-1] if replies else None | ||
| content = str(answer.get("content", "")) if answer else "" | ||
| answer_correct = float(bool(re.search(r"\bnet_gpv\b", content, re.IGNORECASE))) | ||
| threaded_reply = float(answer is not None) | ||
| evidence_complete = float( | ||
| evidence.get("schema_version") == 1 | ||
| and evidence.get("task_name") == "memory-retrieval" | ||
| and evidence.get("truncated") is False | ||
| and len(agents) == 1 | ||
| and isinstance(question_id, str) | ||
| and isinstance(question_channel, str) | ||
| ) | ||
|
|
||
| values = ( | ||
| answer_correct, | ||
| threaded_reply, | ||
| evidence_complete, | ||
| ) | ||
| metrics = { | ||
| "reward": float(all(value == 1.0 for value in values)), | ||
| "answer_correct": answer_correct, | ||
| "threaded_reply": threaded_reply, | ||
| "evidence_complete": evidence_complete, | ||
| } | ||
| return metrics, { | ||
| "question_event_id": question_id, | ||
| "question_channel_id": question_channel, | ||
| "answer_message_id": answer.get("id") if answer else None, | ||
| "answer_content": content, | ||
| } | ||
|
|
||
|
|
||
| def main() -> int: | ||
| parser = argparse.ArgumentParser() | ||
| parser.add_argument("--evidence", type=Path, required=True) | ||
| parser.add_argument("--reward", type=Path, required=True) | ||
| parser.add_argument("--details", type=Path, required=True) | ||
| args = parser.parse_args() | ||
| try: | ||
| metrics, details = score_evidence( | ||
| json.loads(args.evidence.read_text(encoding="utf-8")) | ||
| ) | ||
| except (OSError, json.JSONDecodeError) as error: | ||
| metrics, details = _zero(), {"error": str(error)} | ||
| args.reward.write_text(json.dumps(metrics, sort_keys=True) + "\n", encoding="utf-8") | ||
| args.details.write_text( | ||
| json.dumps(details, indent=2, sort_keys=True) + "\n", encoding="utf-8" | ||
| ) | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) |
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
9 changes: 9 additions & 0 deletions
9
benchmarks/harbor-buzz-orchestra/testbed/endpoints/openai-live-wire-debug.json
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,9 @@ | ||
| { | ||
| "gpt-5.6-luna": { | ||
| "provider": "openai", | ||
| "api_key_env": "OPENAI_COMPAT_API_KEY", | ||
| "env": { | ||
| "RUST_LOG": "acp::wire=debug" | ||
| } | ||
| } | ||
| } |
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.