Skip to content

Tethered agent sample - #526

Merged
Rodrigo Brandão (rodrigobr-msft) merged 2 commits into
mainfrom
users/robrandao/tethered-sample
Aug 13, 2026
Merged

Tethered agent sample#526
Rodrigo Brandão (rodrigobr-msft) merged 2 commits into
mainfrom
users/robrandao/tethered-sample

Conversation

@rodrigobr-msft

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI lite review requested due to automatic review settings August 5, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new tethered-agent sample under test_samples/ to demonstrate running an AgentApplication with the aiohttp hosting adapter while enabling outbound network egress restrictions via tethered.

Changes:

  • Introduces an aiohttp server bootstrap (start_server.py) wired with JWT authorization middleware and the SDK’s start_agent_process.
  • Adds a sample agent (agent.py) using MSAL connection management + OAuth authorization, with a couple of basic message routes.
  • Adds sample scaffolding (main.py, requirements.txt, env.TEMPLATE) to run the sample and configure credentials.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test_samples/tethered-agent/src/start_server.py aiohttp app bootstrap for /api/messages using CloudAdapter + JWT middleware.
test_samples/tethered-agent/src/main.py Sample entrypoint enabling tethered egress allowlist then starting the server.
test_samples/tethered-agent/src/agent.py Defines AGENT_APP, MSAL CONNECTION_MANAGER, and a few handlers (help/echo/get).
test_samples/tethered-agent/src/init.py Marks src as a package for relative imports.
test_samples/tethered-agent/requirements.txt Declares dependencies needed to run the sample.
test_samples/tethered-agent/README.md Sample documentation placeholder.
test_samples/tethered-agent/env.TEMPLATE Template environment variables for auth + connection routing.
Suppressed comments (1)

test_samples/tethered-agent/src/start_server.py:33

  • run_app expects an integer port; environ.get("PORT", 3978) will be a string when PORT is set, which can raise a TypeError at startup. Also the try/except with raise error is redundant and re-raising this way drops the original traceback context.
        run_app(APP, host="localhost", port=environ.get("PORT", 3978))
    except Exception as error:
        raise error


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test_samples/tethered-agent/src/main.py
Comment thread test_samples/tethered-agent/src/agent.py
@rodrigobr-msft Rodrigo Brandão (rodrigobr-msft) changed the title Tethered agent sample (Do not merge) Tethered agent sample Aug 13, 2026
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) marked this pull request as ready for review August 13, 2026 16:43
Copilot AI review requested due to automatic review settings August 13, 2026 16:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated no new comments.

Suppressed comments (4)

test_samples/tethered-agent/src/agent.py:6

  • Unused import path (not referenced anywhere in this module).
from os import environ, path

test_samples/tethered-agent/src/main.py:7

  • "www.botframework." is not a valid hostname pattern (missing TLD / wildcard) and is inconsistent with the other *.botframework.* allow-list entries, so it likely won't match any real endpoint.
    "www.botframework.",

test_samples/tethered-agent/src/start_server.py:32

  • aiohttp.web.run_app expects port to be an int; environ.get("PORT") returns a string when set. Also the try/except re-raises as raise error, which loses the original traceback and adds no value here.
    try:
        run_app(APP, host="localhost", port=environ.get("PORT", 3978))
    except Exception as error:
        raise error

test_samples/tethered-agent/src/agent.py:42

  • The welcome text says "Echo Agent sample" and references an echo feature, but this is the tethered-agent sample and also exposes a /get command. This makes the sample instructions misleading.
    await context.send_activity(
        "Welcome to the Echo Agent sample 🚀. "
        "Type /help for help or send a message to see the echo feature in action."
    )

@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) merged commit f5bdb27 into main Aug 13, 2026
11 checks passed
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) deleted the users/robrandao/tethered-sample branch August 13, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants