Repository navigation
feat(deploy_agent): a peer_tools option to leave out the peer_agents tools #836
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
Open
kaihackney-scale
wants to merge
3
commits into
main
Choose a base branch
from
kai/deploy-agent-peer-tools-option
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+207
−12
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
674f937
deploy_agent: a peer_tools option to leave out the peer_agents tools
kaihackney-scale a97d3ff
Merge remote-tracking branch 'framework/main' into kai/deploy-agent-p…
kaihackney-scale a6b6f12
fix(deploy_agent): a user sim deploy_user_sim_agent set up gets its t…
kaihackney-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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| """always_on sends its user sim's own-tool and peer-tools settings again, as deploy_agent stamped them on its card, | ||
| for a user sim deploy_user_sim_agent set up (its prompt and model already set) as for one it sets up itself; so a user | ||
| sim that restarted since its deploy doesn't get its tools back.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
|
|
||
| from agent_env.a2a_agent import A2AAgent | ||
| from agent_env.task_step.task_steps import always_on as ao | ||
| from tst.unit.task_step.always_on_harness import USER_SIM, Rig | ||
|
|
||
| pytestmark = pytest.mark.usefixtures("local_stores") | ||
|
|
||
| SAVED = {"builtin_tools": {"disable": "*"}, "peer_tools": False} | ||
| CARD = {"capabilities": {"extensions": [{"uri": A2AAgent.EXT_AGENT_CONFIG, "params": { | ||
| "endpoint": "/ext/agent-config", "methods": {"set": {"request": {"supported": [ | ||
| "model", "system_prompt", "output_format", "builtin_tools", "peer_tools"]}}}}}]}, **SAVED} | ||
| PROMPT_SET = {"prompt_set": True, "multi_day": False, "model_source": "user_sim_step", | ||
| "setup": {"model": "sim-model", "model_from": "user_sim_step", "accepted_fields": ["model"]}} | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("user", [PROMPT_SET, {}], ids=["deploy_user_sim_agent set it up", "always_on sets it up"]) | ||
| @pytest.mark.asyncio | ||
| async def test_the_user_sim_is_sent_its_saved_tool_settings(monkeypatch, tmp_path, user): | ||
| posted: list[tuple[str, dict]] = [] | ||
|
|
||
| async def post(url, fields, headers=None): | ||
| posted.append((url, fields)) | ||
|
|
||
| monkeypatch.setattr(ao.protocol, "post_agent_config", post) | ||
| rig = Rig(monkeypatch, tmp_path) | ||
| await rig.arm() | ||
| ctx = rig.context(user=user) | ||
| next(a for a in ctx.deployed_agents if a.agent_name == "user-sim").a2a_card = CARD | ||
| await rig.run(rig.step(max_wakes=1), ctx) | ||
|
|
||
| sent = [fields for url, fields in posted if url.startswith(USER_SIM)] | ||
| assert sent and all(fields.items() >= SAVED.items() for fields in sent) | ||
| if user.get("prompt_set"): # its prompt and model stay deploy_user_sim_agent's: only the tool settings go | ||
| assert sent == [SAVED] |
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.