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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file internet2agent-0.1.0.tar.gz.
File metadata
- Download URL: internet2agent-0.1.0.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7ceb7e33b06d56fedb4f3be2050cda6d54f89227114a979b5ff0690e1314fdf
|
|
| MD5 |
4e24f54503b395e3a75da73d8176a174
|
|
| BLAKE2b-256 |
7ae9e86f575317ba0f2620ab526fbf544cfd5b75b52ca71cacf15fa2d680ba66
|
Provenance
The following attestation bundles were made for internet2agent-0.1.0.tar.gz:
Publisher:
publish.yml on AstralDeep/internet2agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
internet2agent-0.1.0.tar.gz -
Subject digest:
c7ceb7e33b06d56fedb4f3be2050cda6d54f89227114a979b5ff0690e1314fdf - Sigstore transparency entry: 2630722327
- Sigstore integration time:
-
Permalink:
AstralDeep/internet2agent@f3926f5b07dcf8da6a8f05ab44664608dbb3cc67 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/AstralDeep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f3926f5b07dcf8da6a8f05ab44664608dbb3cc67 -
Trigger Event:
release
-
Statement type:
File details
Details for the file internet2agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: internet2agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ba179073cfebe9295c9c2c50d57691258b452aadd6dbdd5cf876069d646d6b7
|
|
| MD5 |
3681b53fcff37c2e93764292a8b64a2b
|
|
| BLAKE2b-256 |
173815d7aed29cf0b46ba6e3515098529e1f5ebf6041cfd14c59c90468143cda
|
Provenance
The following attestation bundles were made for internet2agent-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on AstralDeep/internet2agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
internet2agent-0.1.0-py3-none-any.whl -
Subject digest:
7ba179073cfebe9295c9c2c50d57691258b452aadd6dbdd5cf876069d646d6b7 - Sigstore transparency entry: 2630722410
- Sigstore integration time:
-
Permalink:
AstralDeep/internet2agent@f3926f5b07dcf8da6a8f05ab44664608dbb3cc67 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/AstralDeep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f3926f5b07dcf8da6a8f05ab44664608dbb3cc67 -
Trigger Event:
release
-
Statement type: