Python SDK for the Covia federated AI orchestration grid
Project description
Covia Python SDK
Python SDK for the Covia federated AI orchestration grid.
Covia enables AI models, agents, and data to collaborate across organisational boundaries, clouds, and jurisdictions — with built-in governance and without centralising control.
Installation
pip install covia
Quick Start
from covia import Grid
# Connect to a venue
venue = Grid.connect("https://venue.covia.ai")
# Invoke an operation and get the result
result = venue.run("my-operation", {"prompt": "hello"})
print(result)
Usage
Connect to a Venue
from covia import Grid
# By URL
venue = Grid.connect("https://venue.covia.ai")
# By DID
venue = Grid.connect("did:web:venue.covia.ai")
# With custom headers (e.g. auth)
venue = Grid.connect(
"https://venue.covia.ai",
headers={"Authorization": "Bearer <token>"},
)
# As a context manager
with Grid.connect("https://venue.covia.ai") as venue:
result = venue.run("my-operation", {"prompt": "hello"})
Invoke Operations
# Fire-and-forget with a Job handle
job = venue.invoke("my-operation", {"prompt": "hello"})
job.wait(timeout=60)
print(job.status) # JobStatus.COMPLETE
print(job.output) # The result
# Or use run() to invoke and wait in one call
result = venue.run("my-operation", {"prompt": "hello"}, timeout=30)
# Use result() on a Job
output = venue.invoke("my-op", {"x": 1}).result(timeout=30)
Job Lifecycle
from covia import JobStatus
job = venue.invoke("long-operation", {"data": "..."})
# Poll status
print(job.status) # JobStatus.PENDING
job.refresh()
print(job.status) # JobStatus.STARTED
# Wait for completion
job.wait(timeout=120)
# Check result
if job.is_complete:
print(job.output)
elif job.error:
print(f"Failed: {job.error}")
# Cancel a running job
job.cancel()
# Stream SSE updates
for event in job.stream():
print(event.data)
Asset Management
# Register an asset
asset_id = venue.register_asset({
"name": "Training Data",
"description": "Model training dataset",
"content-type": "application/json",
})
# Upload content
venue.put_asset_content(asset_id, b'{"records": [...]}')
# Retrieve an asset
asset = venue.get_asset(asset_id)
print(asset.name)
print(asset.metadata)
# Download content
data = asset.get_content()
# Invoke an operation asset directly
op = venue.get_asset("abc123...")
if op.is_operation:
result = op.run({"x": 1})
# List assets
assets = venue.list_assets(limit=100)
print(f"{assets.total} assets available")
Venue Discovery
# Venue status
status = venue.status()
# DID document
did_doc = venue.did_document()
# MCP discovery
mcp = venue.mcp_discovery()
# A2A agent card
card = venue.agent_card()
Async Support
from covia.async_api import AsyncGrid
async def main():
async with AsyncGrid.connect("https://venue.covia.ai") as venue:
# All methods are async
status = await venue.status()
result = await venue.run("my-operation", {"prompt": "hello"})
# Async job lifecycle
job = await venue.invoke("long-op", {"data": "..."})
output = await job.result(timeout=60)
Error Handling
from covia import Grid, CoviaError, GridError, JobFailedError, CoviaTimeoutError
try:
result = venue.run("might-fail", {"x": 1}, timeout=30)
except JobFailedError as e:
print(f"Job failed: {e.job_data.error}")
except CoviaTimeoutError:
print("Operation timed out")
except GridError as e:
print(f"API error {e.status_code}: {e.message}")
except CoviaError as e:
print(f"SDK error: {e}")
Development
# Clone and install
git clone https://github.com/covia-ai/covia-sdk-py.git
cd covia-sdk-py
pip install -e ".[dev]"
# Run tests
pytest tests/unit
# Lint and type check
ruff check src/ tests/
mypy src/covia/
# Integration tests (requires a live venue)
COVIA_VENUE_URL=https://venue-3.covia.ai pytest -m integration
License
Apache License 2.0. See LICENSE.
Links
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 covia-0.2.0.tar.gz.
File metadata
- Download URL: covia-0.2.0.tar.gz
- Upload date:
- Size: 50.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ed2c78d72446d17326c014a75c89c5216fd0a05b88568904d9d13bab937aba4
|
|
| MD5 |
713ab2ecaf3f5135ff4d251d5f9675b1
|
|
| BLAKE2b-256 |
40b50c7a45c3168a1ada99f8c991dece1ccb6c66da4e5e376b666e77e2bd9279
|
Provenance
The following attestation bundles were made for covia-0.2.0.tar.gz:
Publisher:
publish.yml on covia-ai/covia-sdk-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
covia-0.2.0.tar.gz -
Subject digest:
3ed2c78d72446d17326c014a75c89c5216fd0a05b88568904d9d13bab937aba4 - Sigstore transparency entry: 1791877140
- Sigstore integration time:
-
Permalink:
covia-ai/covia-sdk-py@a612f651aa4da2037cb49f84432e4f5606acbe6f -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/covia-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a612f651aa4da2037cb49f84432e4f5606acbe6f -
Trigger Event:
push
-
Statement type:
File details
Details for the file covia-0.2.0-py3-none-any.whl.
File metadata
- Download URL: covia-0.2.0-py3-none-any.whl
- Upload date:
- Size: 42.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d98196484c0f792fa51cf97232ec040e773bf5a3b91b2638b3e030bd8f54837
|
|
| MD5 |
ed976651f06924e57d38a4b0b1ded670
|
|
| BLAKE2b-256 |
cab6f2d75198be85fd6542beed243e2f2afb6f9ac57b8af6d35bd8614ee78366
|
Provenance
The following attestation bundles were made for covia-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on covia-ai/covia-sdk-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
covia-0.2.0-py3-none-any.whl -
Subject digest:
9d98196484c0f792fa51cf97232ec040e773bf5a3b91b2638b3e030bd8f54837 - Sigstore transparency entry: 1791877235
- Sigstore integration time:
-
Permalink:
covia-ai/covia-sdk-py@a612f651aa4da2037cb49f84432e4f5606acbe6f -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/covia-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a612f651aa4da2037cb49f84432e4f5606acbe6f -
Trigger Event:
push
-
Statement type: