Python SDK for Port42 — connect external agents to your macOS companion
Project description
port42
Python SDK for Port42 — connect external agents to your macOS companion.
Install
pip install port42
Quickstart
from port42 import Agent
agent = Agent("my-agent", channels=["#general"])
@agent.on_mention
def handle(msg):
return f"Hello {msg.sender}!"
agent.run()
Port42 must be running. The agent connects via WebSocket and appears in your companion list.
With LangChain
pip install 'port42[langchain]'
from port42 import Agent
from port42.langchain import Port42CallbackHandler
from langchain_anthropic import ChatAnthropic
agent = Agent("assistant", channels=["#general"])
handler = Port42CallbackHandler(agent)
chain = ChatAnthropic(model="claude-sonnet-4-5")
@agent.on_mention
def handle(msg):
result = chain.invoke(msg.text, config={"callbacks": [handler]})
return result.content
agent.run()
Scaffold a project
pip install port42[cli]
port42 init my-agent
cd my-agent && python agent.py
Templates: basic, langchain, pipeline
Bridge APIs
Once connected, your agent can call Port42 device APIs:
agent.terminal_exec("ls ~/Desktop")
agent.screen_capture(scale=0.5)
agent.notify("Done", body="Pipeline complete")
agent.port_push(port_id, {"key": "value"})
agent.rest_call("https://api.example.com/data", secret="MY_API_KEY")
Project details
Release history Release notifications | RSS feed
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 port42-0.2.4.tar.gz.
File metadata
- Download URL: port42-0.2.4.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de2d15e1ef4288140c5ecb2dd92843cec2fbf8243680ff96e7f8e868a495b596
|
|
| MD5 |
2c413f6ebdce5b5bb29c24bdd20d843e
|
|
| BLAKE2b-256 |
c38f3055b3104841482e3758b3b13ac649a6e5f5f6787318cecad66944aa167d
|
Provenance
The following attestation bundles were made for port42-0.2.4.tar.gz:
Publisher:
publish.yml on gordonmattey/port42-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
port42-0.2.4.tar.gz -
Subject digest:
de2d15e1ef4288140c5ecb2dd92843cec2fbf8243680ff96e7f8e868a495b596 - Sigstore transparency entry: 1190529962
- Sigstore integration time:
-
Permalink:
gordonmattey/port42-python@c84203507315ae3643f4b0e220cc24cbb4d9ef3a -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/gordonmattey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c84203507315ae3643f4b0e220cc24cbb4d9ef3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file port42-0.2.4-py3-none-any.whl.
File metadata
- Download URL: port42-0.2.4-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c774644ab62a9f3e572384708a3cc6a3411ec3ca6d6c3eaa4e2815726c7774fd
|
|
| MD5 |
36c02e8d0cf1712ec48ab7c94d486ed5
|
|
| BLAKE2b-256 |
6aa5076688dffd6755af695b89e68469a428bbb3aec9253d944c43b230535c56
|
Provenance
The following attestation bundles were made for port42-0.2.4-py3-none-any.whl:
Publisher:
publish.yml on gordonmattey/port42-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
port42-0.2.4-py3-none-any.whl -
Subject digest:
c774644ab62a9f3e572384708a3cc6a3411ec3ca6d6c3eaa4e2815726c7774fd - Sigstore transparency entry: 1190529969
- Sigstore integration time:
-
Permalink:
gordonmattey/port42-python@c84203507315ae3643f4b0e220cc24cbb4d9ef3a -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/gordonmattey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c84203507315ae3643f4b0e220cc24cbb4d9ef3a -
Trigger Event:
push
-
Statement type: