forward-sdk¶
Python SDK for the Forward Networks REST API.
A Forward Labs project
Built and maintained by Forward Labs to make integration work easier. It is not a supported Forward Networks product: it carries no SLA, and issues are handled on a best-effort basis rather than through Forward Support.
It builds on Forward's published API, and on a few endpoints outside it that are documented here.
from forward_sdk import ForwardClient
with ForwardClient.from_env() as client:
for network in client.networks.list():
print(network.id, network.name)
from_env needs FORWARD_URL, and FORWARD_USERNAME and FORWARD_PASSWORD to
authenticate. Authentication is HTTP basic, preferably with an API token. The
quickstart shows how to get one, and
configuration covers the other variables and client settings:
TLS, proxies, timeouts, retries, rate limiting and caching.
What it covers¶
The whole published API, plus a few endpoints Forward does not publish that integrations depend on. The groups people use most are hand-written:
- NQE, the Network Query Engine, which is how most integrations read the Forward model. Run queries inline or in the background, page or stream the results, diff a query across two snapshots, and publish queries to the library. See the NQE guide.
- Snapshots: list, inspect, upload, export, and wait for processing.
- Networks, devices and device tags.
- AI, MCP, change reports, snapshot diffs, change sets, user events, TAPI network containers and client software.
Everything else -- path search, checks, locations, topology, credentials, collectors, VPNs, vulnerabilities and the rest -- is generated from Forward's API description. See the API groups.
Both a synchronous and an asynchronous client, with the same surface apart from
close() and aclose(). The synchronous one is generated from the asynchronous
one (see asynchronous use).
The client itself also offers access(), to check what your account's roles
allow (see access), and call(operation_id, ...), to run an
operation chosen at run time, except a streaming one. SDK errors such as refused
requests and timeouts are described under errors.
Design notes¶
Generated from Forward's own description. Models and the operation table are generated from the OpenAPI description Forward produces from its server code, so they cannot describe an API the server does not implement. A test proves every operation has exactly one implementation.
Typed, but tolerant. Responses are pydantic models with typed fields. Unknown fields and unknown enum values are preserved rather than rejected, so a Forward release that adds either does not break an older SDK.
NQE rows stay dictionaries. A query's columns are defined by the query, and
column names such as Interface Speed are not valid Python identifiers, so rows
are dict[str, Any].
Installing¶
pip install forward-sdk
Requires Python 3.10 or newer. The package is released under the Fair Core License (FCL-1.0-ALv2).
Versions and compatibility¶
A version is YY.M.N. YY.M is the release line: the Forward release the SDK
version is built for. N is the SDK's own count within the line, starting at 0
for each new line.
For the 26.11 line, "built for" means the SDK targets Forward 26.11. Some behaviour was checked against Forward 26.11, and its models and generated methods come from an API description taken before the 26.11 release.
N is not Forward's patch number. The number does not say that every Forward
patch was tested. It does not say anything about other Forward releases.
To stay within a line, require forward-sdk==26.11.*. Releases before 26.11.0
are numbered 0.1.N. A requirement without an upper bound, such as
forward-sdk>=0.1.45, will accept 26.x releases, and a later line can contain
breaking changes.
What a public name is¶
Public names are what a program can use without writing a leading underscore:
the SDK's modules whose import names have no leading underscore, what those
modules offer, both clients, and everything reached from any of these. That
includes a client's services, objects nested in them such as client.nqe.repo,
and the objects that calls return, with their methods, properties, fields and
enum members, including those a class gets from a library the SDK depends on.
These are not covered:
- a name with a leading underscore;
- a name a module only imports for its own use;
- the contents of a value the SDK declares no type for, such as one declared
Anyor a plain mapping.
What stays the same within a line¶
A later release in the same line does not:
- remove or rename a public name;
- change what a public name refers to;
- change a signature so that a call that was valid stops being valid;
- change the declared type of a return value, property or field so that code using what the old type offered stops working.
Allowing None where it was not allowed before is such a change. This covers
generated names, including numbered ones.
A bug fix that keeps these rules may ship in any release of the line. A fix that cannot waits for a later line.
These rules forbid some changes. From the release after 26.11.0, every other change that alters what working code can observe, bug fixes included, has a changelog entry that begins Behaviour change:.
A change these rules forbid waits for the first release of a later line, and its changelog entry begins Breaking:. Fixes are not promised for a line once a later line has been released.
Generated code¶
Forward's published API description is updated only in the first release of a
line. Within a line, spec/unpublished.yaml, a generator or the locked version
of a tool a generator uses changes only if the regenerated code keeps these
rules. The promise is about the SDK's names and calls, not about what a Forward
server does.
Source¶
src/forward_sdk/__init__.pysrc/forward_sdk/_sync/client.pysrc/forward_sdk/_async/client.pypyproject.tomlsrc/forward_sdk/_version.pyspec/SPEC_SOURCE.jsonspec/forward-openapi.yamlspec/unpublished.yaml