Pyads-Agile

A compatibility-first TwinCAT Python toolkit for pyads teams.

Use Pyads-Agile when existing pyads compatibility matters, but the project still needs better TwinCAT-oriented structure for testing, RPC, and long-running PLC actions.
Open-source TwinCAT Python toolkit

Typed RPC, test fixtures, and stepchain orchestration.

Pyads-Agile is our maintained TwinCAT ADS distribution for teams that want Python to be part of the machine stack, not an afterthought. It stays drop-in compatible with pyads while adding typed RPC proxies, a serialized async runtime, and stepchain support for long-running PLC workflows.

Drop-in compatible with import pyadsTyped RPC proxies for TwinCAT function blocksAsyncConnection with ordered ADS executionStepChainOperation for accepted and done phasesWindows and Linux ADS supportTestserver and real integration coverage
Why it matters
  • Existing pyads applications can switch distributions without rewriting their application layer.
  • TwinCAT methods exposed with {attribute 'TcRpcEnable'} become readable Python interfaces instead of flat handle calls.
  • Long-running PLC procedures can be modeled as accepted, running, done, or error states, which fits MES and supervisory software far better than polling random symbols.

Object-oriented TwinCAT testing

  • Wrap function blocks with @pyads.ads_path(...) and build readable Python test fixtures.
  • Create automated regression packs for homing, interlocks, recipes, alarms, and restart sequences.
  • Keep machine behavior in reusable Python objects instead of fragile ad-hoc scripts.

Typed RPC for MES and controller software

  • Call PLC methods like Python methods, with configured parameter and return types.
  • Expose complex machine actions without flattening every process into single tag reads and writes.
  • Useful for order execution, material handling, serialization, and higher-level coordination logic.

Async orchestration for long-running workflows

  • Use async RPC proxies and StepChainRpcInterface when PLC actions progress over many scan cycles.
  • Track accepted, done, and error states with request IDs and status snapshots.
  • Fit TwinCAT workflows into FastAPI services, schedulers, and plant middleware without race conditions.

Example patterns

Example

Automated TwinCAT test cases in Python

Typed proxies make TwinCAT function blocks look like Python classes, which is a clean fit for pytest-based FAT, SAT, and regression packs.

@pyads.ads_path("GVL.fbAxisTests")
class FB_AxisTests:
    def m_xHome(self) -> pyads.PLCTYPE_BOOL: ...
    def m_xReset(self) -> pyads.PLCTYPE_BOOL: ...

with pyads.Connection(net_id, pyads.PORT_TC3PLC1) as plc:
    axis = plc.get_object(FB_AxisTests)
    assert axis.m_xHome()
    assert axis.m_xReset()
Example

RPC-driven MES or supervisory control

For longer-running PLC procedures, the async stepchain model separates acceptance from completion and returns a consistent status snapshot.

@pyads.ads_async_path("GVL.fbMesOrder")
class FB_MesOrder(pyads.StepChainRpcInterface):
    @pyads.stepchain_start
    def m_xStartOrder(
        self,
        udiRequestId: pyads.PLCTYPE_UDINT,
    ) -> pyads.StepChainOperation[pyads.PLCTYPE_BOOL]:
        ...

async with pyads.AsyncConnection(net_id, pyads.PORT_TC3PLC1) as plc:
    rpc = plc.get_async_object(FB_MesOrder)
    operation = rpc.m_xStartOrder()
    await operation.accepted
    snapshot = await operation

Need help applying Pyads-Agile to a real machine stack?

Tell us what you are building, where the current blocker is, and what the target architecture should support.

Contact