Repository navigation
feat: bundle, training, task run and agent picks understand always_on and user sims (FD-5371) #565
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
+337
−26
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
601e780
always_on: find its agent as the solver, print its response, refuse i…
sarah-chitty-1 010b041
task run --a2a-agent-id: swap only the tested agent when the task dep…
sarah-chitty-1 0ef1b8e
deploy_agent: a run-wide agent pick swaps the tested agent, never the…
sarah-chitty-1 fe35c84
deploy_agent: read the run's task with its seed applied, so a seeded …
sarah-chitty-1 2339185
deploy_agent: only a user_sim step's agent is kept out of a run-wide …
sarah-chitty-1 11a1ddf
always_on plumbing: tell the agent under test and the user sim apart …
sarah-chitty-1 2060ebf
training: a task whose user sim writes the opening trains on that ope…
sarah-chitty-1 91afec3
Merge branch 'main' of github.com:scaleapi/agentenv-framework into sa…
sarah-chitty-1 36f8dce
cli: task run shows a prompting step its own response, not a later on…
sarah-chitty-1 49f21ba
Merge branch 'main' of github.com:scaleapi/agentenv-framework into sa…
sarah-chitty-1 af98cc1
training: a row's first message skips a prompt sent to the user sim, …
sarah-chitty-1 68bac9f
episode rules: classify every step type in CHECKS or UNAFFECTED; drop…
earakely-scale 4cf1943
prompt_agent: is_prompt_step tells a prompting step by its class, not…
earakely-scale 8368183
Drop roles.py and plays_user: the user sim is the agent a prompting s…
earakely-scale 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
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
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,30 @@ | ||
| """`task run` shows an always_on step its response as it shows a prompt_agent step's.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from types import SimpleNamespace | ||
|
|
||
| from agent_env.cli.task.run import _step_output_lines | ||
| from agent_env.task_step.context import PromptResponse, TaskStepContext | ||
|
|
||
|
|
||
| def test_an_always_on_steps_response_is_shown(): | ||
| context = TaskStepContext(prompt_responses=[PromptResponse(prompt_id="loop", response="Recap sent.", step_id="loop")]) | ||
|
|
||
| [lines] = _step_output_lines(SimpleNamespace(type="always_on", id="loop"), context) | ||
|
|
||
| assert "prompt_id: loop" in lines and "Recap sent." in lines | ||
|
|
||
|
|
||
| def test_an_always_on_step_without_a_response_shows_nothing(): | ||
| assert _step_output_lines(SimpleNamespace(type="always_on", id="loop"), TaskStepContext()) == [] | ||
|
|
||
|
|
||
| def test_an_always_on_step_shows_its_own_response_when_a_parallel_step_added_a_later_one(): | ||
| context = TaskStepContext(prompt_responses=[ | ||
| PromptResponse(prompt_id="loop", response="Recap sent.", step_id="loop"), | ||
| PromptResponse(prompt_id="side", response="Side answer.", step_id="side")]) | ||
|
|
||
| [lines] = _step_output_lines(SimpleNamespace(type="always_on", id="loop"), context) | ||
|
|
||
| assert "Recap sent." in lines and "Side answer." not in lines |
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,64 @@ | ||
| """``task run --a2a-agent-id`` is a run-wide pick: the CLI leaves it run-wide, at the deploy steps' stored versions, for | ||
| each step to apply (tst/unit/task_step/run_wide_agent_pick_test.py); a step that plays the user keeps its own agent by | ||
| its class, as it does for a hub run's pick.""" | ||
|
|
||
| import importlib | ||
| import logging | ||
|
|
||
| import pytest | ||
| from click.testing import CliRunner | ||
|
|
||
| from agent_env.cli import cli, submitted_runs | ||
| from agent_env.runner import local_runner | ||
| from agent_env.task import Task | ||
| from agent_env.task.teardown import TeardownReport | ||
|
|
||
| task_run = importlib.import_module("agent_env.cli.task.run") # the package's ``run`` is the click command | ||
| pytestmark = pytest.mark.usefixtures("sigint_handled", "local_stores") | ||
|
|
||
| AGENT = {"id": "agent", "type": "deploy_agent", "env_ids": [], "a2a_agent_id": "theirs", "a2a_agent_version": 4} | ||
| USER = {"id": "user", "type": "deploy_agent", "env_ids": [], "agent_name": "human_agent", "a2a_agent_id": "sim"} | ||
| ASK = {"id": "ask", "type": "prompt_agent", "prompt_id": "ask", "prompt": "hi", "max_conversation_turns": 3} | ||
|
|
||
|
|
||
| class _Recorded: | ||
| """A stored task that records each context it runs with.""" | ||
|
|
||
| id, version, requires = "t", 1, None | ||
|
|
||
| def __init__(self, steps): | ||
| self.steps = Task.from_dict({"id": "t", "version": 1, "steps": steps}).steps | ||
| self.contexts = [] | ||
|
|
||
| async def run(self, context, **_): | ||
| self.contexts.append(context) | ||
| return context | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def stored(monkeypatch): | ||
| async def teardown_run(context): | ||
| return TeardownReport() | ||
|
|
||
| monkeypatch.setattr(task_run, "teardown_run", teardown_run) | ||
| monkeypatch.setattr(local_runner, "teardown_run", teardown_run) | ||
| monkeypatch.setattr(submitted_runs, "POLL_SECONDS", 0.02) | ||
|
|
||
| def store(*steps): | ||
| recorded = _Recorded(list(steps)) | ||
| monkeypatch.setattr(Task, "get", classmethod(lambda cls, id, version=None: recorded)) | ||
| return recorded | ||
|
|
||
| logging.disable(logging.CRITICAL) | ||
| yield store | ||
| logging.disable(logging.NOTSET) | ||
|
|
||
|
|
||
| def test_the_pick_stays_run_wide_with_a_user_agent_deployed(stored): | ||
| recorded = stored(AGENT, USER, ASK) | ||
| result = CliRunner().invoke(cli, ["task", "run", "--id", "t", "--a2a-agent-id", "mine"]) | ||
| assert result.exit_code == 0, result.output | ||
|
|
||
| [context] = recorded.contexts | ||
| overrides = context.metadata["user_overrides"] | ||
| assert overrides["a2a_agent_id"] == "mine" and "step_params" not in overrides |
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.
played_deploysnow excludeshuman_agenteven when it is the task's only prompted agent. A single-turn task can deploy and prompt an agent with that name while leavinguser_agent_nameat its default.EpisodeSpecstill chooses that agent to play from outside, but this subtraction makesplayed_deploysreturn nothing.OpenEnv preparation then requires and checks the original agent image instead of skipping it. If that image is unavailable, serving the task fails even though the outside player replaces the agent. Keep this lookup aligned with the agent
EpisodeSpecactually replaces.Prompt To Fix With AI