viewport-context
Progressive skill loading and per-skill tool binding for agents (Python, import viewportai.context). The model starts
with a short catalog and one tool, load_skill; each skill's instructions and tools arrive only when it loads, inside a
token budget. The npm package @viewportai/context implements the same spec, pinned by shared conformance vectors.
pip install viewport-context # or: uv add viewport-context
Python 3.11 or newer. To build from source, see https://github.com/viewportai/context#from-source.
Quickstart
Runs with no API key. In an empty folder, install the package (see above), then create these files.
Two skills, one folder each:
skills/refunds/SKILL.md
---
name: refunds
description: Issue refunds for damaged, late or wrong orders. Use when a customer asks for money back.
tools: [lookup_order, issue_refund]
---
# Refunds
Look up the order first. Refund the order total for damaged or wrong items. Refunds over $100 need a human.
skills/docs/SKILL.md
---
name: docs
description: Answer how-to questions from the help center. Use for questions about features and settings.
tools: [search_docs]
---
# Help center
Search before you answer. If nothing matches, say so instead of guessing.
tools.py
from typing import Any
from viewportai.core import Tool
async def _lookup_order(args: dict[str, Any]) -> dict[str, Any]:
return {"order_id": args["order_id"], "status": "delivered", "total": 42.5}
async def _issue_refund(args: dict[str, Any]) -> dict[str, str]:
return {"refund_id": f"R-{args['order_id']}"}
async def _search_docs(args: dict[str, Any]) -> list[str]:
return [f"How to report {args['query']}"]
lookup_order = Tool(
name="lookup_order",
description="Look up an order by id.",
input_schema={"type": "object", "properties": {"order_id": {"type": "string"}}, "required": ["order_id"]},
execute=_lookup_order,
)
issue_refund = Tool(
name="issue_refund",
description="Refund an order, in dollars.",
input_schema={
"type": "object",
"properties": {"order_id": {"type": "string"}, "amount": {"type": "number", "minimum": 0}},
"required": ["order_id", "amount"],
},
execute=_issue_refund,
)
search_docs = Tool(
name="search_docs",
description="Search the help center.",
input_schema={"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]},
execute=_search_docs,
)
main.py
import asyncio
from tools import issue_refund, lookup_order, search_docs
from viewportai import context
async def main() -> None:
skills = context.load_skills("skills", tools=[lookup_order, issue_refund, search_docs], budget=8_000)
session = skills.session()
print(session.prompt("My order A-1001 arrived damaged.").tool_names) # ['load_skill']
await session.call("load_skill", name="refunds") # exactly what the model does
early = await session.call("lookup_order", order_id="A-1001") # same step as the load
print(early.content) # refused: call it in the next step
print(session.prompt().tool_names) # ['load_skill', 'lookup_order', 'issue_refund']
order = await session.call("lookup_order", order_id="A-1001")
print(order.content) # {"order_id":"A-1001","status":"delivered","total":42.5}
refused = await session.call("search_docs", query="damage")
print(refused.content) # search_docs is not available. Load the docs skill first.
asyncio.run(main())
Run it with python main.py.
Output:
['load_skill']
lookup_order is not available yet: the refunds skill was loaded in this same step. Read its instructions, then call lookup_order in your next step.
['load_skill', 'lookup_order', 'issue_refund']
{"order_id":"A-1001","status":"delivered","total":42.5}
search_docs is not available. Load the docs skill first.
A skill's tools become callable in the next step, once a new prompt is built, so the model reads the instructions first; a tool called in the same step as its skill's load is refused with a message to call it next step.
Adapters (extras): viewportai.context.langgraph, .openai_agents, .claude_agent_sdk (preview), .pydantic_ai,
.anthropic,
.openai; test helpers in viewportai.context.testing and pytest fixtures (tmp_skills, skills, skill_events).
CLI
The package installs a viewport-context command that lints skills, prints per-skill token costs and shows the request
a session would send. After pip install viewport-context it is on your PATH.
viewport-context lint skills
viewport-context inspect skills
Docs, examples and the design: https://github.com/viewportai/context. License: Apache-2.0.
Metadata
Release files for viewport-context 0.1.1
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 |
|---|---|---|---|---|
| viewport_context-0.1.1.tar.gz | 107.4 kB | Without provenance | Details for viewport_context-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| viewport_context-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for viewport_context-0.1.1-py3-none-any.whl |
Total release size: 239.3 kB
Release files / viewport_context-0.1.1.tar.gz
| Download URL | viewport_context-0.1.1.tar.gz |
|---|---|
| Size | 107.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f52622324e0805e3b8cfae78e51a76e192a1398ed952fd13dd01621f4a20a8a
|
|
BLAKE2b-256 checksum How to use checksums |
cae00899700490ae685a59c35cc5c48ab9d5bc40ba3d2b0ee3cf752a498b7a31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / viewport_context-0.1.1-py3-none-any.whl
| Download URL | viewport_context-0.1.1-py3-none-any.whl |
|---|---|
| Size | 131.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6871775507d1c38cc2d6bf14dd9e17098365a5c54f39194b083031e370683fc3
|
|
BLAKE2b-256 checksum How to use checksums |
49f03d2bc77f8ce3cf1a7a3fc7935f777c38846a5166d76e128794ce176cb4be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for viewport-context 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.