internet2agent
Python interface and LLM agent for the Internet2 Periscope Looking Glass MCP
server (https://periscope.ns.internet2.edu/mcp) - the service announced in
Internet2's MCP server post,
documented in the Console docs.
Two ways in, no GUI:
- Direct client (
PeriscopeClient/AsyncPeriscopeClient) - typed Python access to the five Looking Glass tools. Works today with zero credentials (the server is currently open; verified live). - LLM agent (
Internet2Agent) - natural-language questions answered by any OpenAI-compatible model (OpenAI, Ollama, vLLM, LM Studio, OpenRouter, ...). The agent pulls the tool schemas from the MCP server, hands them to the model as function tools, executes the model's tool calls against Periscope, and loops until it has an answer.
Setup
cd Y:\WORK\MCP\internet2agent
.venv\Scripts\activate
pip install -e ".[dev]"
Then configure your LLM in .env (gitignored; template in .env.example):
| Variable | Needed for | Notes |
|---|---|---|
OPENAI_BASE_URL |
ask / chat / Internet2Agent |
unset = api.openai.com; Ollama: http://localhost:11434/v1; LM Studio: http://localhost:1234/v1 |
OPENAI_API_KEY |
same | optional for local endpoints that don't check keys |
I2A_MODEL |
same | model name to request (default gpt-4o - set to what your endpoint serves) |
PERISCOPE_MCP_URL |
optional | defaults to the public endpoint |
PERISCOPE_AUTH_TOKEN |
not yet | future Internet2 credential; sent as Authorization: Bearer ... once set |
CLI
Direct Looking Glass (no credentials):
internet2agent info # service limits (rate limit, max targets)
internet2agent devices # device inventory (name, location, platform)
internet2agent commands # supported commands per platform
internet2agent filters # output filters (include/exclude + regex)
internet2agent exec "show bgp" -t rtr1 rtr2 -p summary -f "include Established"
Add --json to any of the above for raw JSON. i2a is a short alias for
internet2agent.
LLM agent:
internet2agent ask "Is BGP healthy on the Chicago routers?"
internet2agent chat # interactive multi-turn session
If no LLM endpoint is configured yet, ask/chat walk you through a one-time
setup (base URL, API key, model) and offer to save it to .env.
Tool calls are echoed as [lg_execute {...}] lines while the agent works.
Python API
from internet2agent import PeriscopeClient
with PeriscopeClient() as lg:
devices = lg.devices() # [{"name": ..., "platform": ...}, ...]
result = lg.execute("show bgp", ["rtr1"], parameter="summary")
Async variant:
from internet2agent import AsyncPeriscopeClient
async with AsyncPeriscopeClient() as lg:
print(await lg.config())
Agent:
from internet2agent import Internet2Agent
with Internet2Agent() as agent: # reads .env
print(agent.ask("Which devices are in Seattle?"))
print(agent.ask("Run a traceroute from one of them to 8.8.8.8")) # follow-ups keep context
Service constraints (from the server)
- Max 10 target devices per
lg_execute; commands must match documented syntax exactly (no abbreviations). - Rate limit: 60 requests/min (check live with
internet2agent info). parameteris appended to the command (show route+10.0.0.0/8);filteris a filter name plus case-sensitive regex (include bgp,exclude ^$).- Commands/filters are platform-specific - the agent (and you) should check
commands/filtersagainst each device'splatformbefore executing.
Tests
pytest # unit tests (offline, mocked)
pytest -m network # live smoke tests against the real Periscope server
Releasing to PyPI
Publishing runs through GitHub Actions with PyPI Trusted Publishing (no API tokens stored anywhere). One-time setup:
- On pypi.org -> your account -> Publishing -> "Add a new
pending publisher": project
internet2agent, ownerAstralDeep, repositoryinternet2agent, workflowpublish.yml, environmentpypi. - On GitHub -> repo Settings -> Environments -> create an environment named
pypi.
Then, for each release: bump version in pyproject.toml, push, and publish a
GitHub release with a vX.Y.Z tag - the workflow builds and uploads.
Manual alternative: python -m build && twine upload dist/* with a PyPI API token.
Notes
- The agent requires an endpoint that supports OpenAI-style function/tool calling; pick a tool-capable model (most current ones are).
- The agent caps each question at 25 LLM round-trips as a runaway guard
(
Internet2Agent(max_steps=...)to change). - Tool errors (unknown device, bad syntax, timeouts) are fed back to the model
as
ERROR:tool results so it can correct itself instead of crashing.
Metadata
Release files for internet2agent 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| internet2agent-0.1.0.tar.gz | 22.4 kB | With provenance | Details for internet2agent-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| internet2agent-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for internet2agent-0.1.0-py3-none-any.whl |
Total release size: 40.6 kB
Release files / internet2agent-0.1.0.tar.gz
| Download URL | internet2agent-0.1.0.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7ceb7e33b06d56fedb4f3be2050cda6d54f89227114a979b5ff0690e1314fdf
|
|
BLAKE2b-256 checksum How to use checksums |
7ae9e86f575317ba0f2620ab526fbf544cfd5b75b52ca71cacf15fa2d680ba66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logRelease files / internet2agent-0.1.0-py3-none-any.whl
| Download URL | internet2agent-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ba179073cfebe9295c9c2c50d57691258b452aadd6dbdd5cf876069d646d6b7
|
|
BLAKE2b-256 checksum How to use checksums |
173815d7aed29cf0b46ba6e3515098529e1f5ebf6041cfd14c59c90468143cda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logSecurity for internet2agent 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for internet2agent-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.