Skip to main content

Arga Python SDK

Typed Python client for the Arga API. Supports both synchronous and asynchronous usage.

Installation

Install with uv:

uv add arga-py-sdk

Or, if you're using pip:

pip install arga-py-sdk

Quick Start

from arga_sdk import Arga

client = Arga(api_key="arga_...")

# Create a URL run with service twins
run = client.runs.create_url_run(
    url="https://staging.myapp.com",
    twins=["stripe", "slack", "salesforce", "waterfall"],
)
print(run.run_id, run.status)

# Poll until the run completes
detail = client.runs.wait(run.run_id, timeout=300)
print(detail.status, detail.results_json)

# Stream live results
for event in client.runs.stream_results(run.run_id):
    print(event)

# Cancel a run
client.runs.cancel(run.run_id)

Async Usage

import asyncio
from arga_sdk import AsyncArga

async def main():
    client = AsyncArga(api_key="arga_...")

    run = await client.runs.create_url_run(url="https://staging.myapp.com")

    # Stream results
    async for event in client.runs.stream_results(run.run_id):
        print(event)

    # Wait for completion
    detail = await client.runs.wait(run.run_id)
    print(detail.status)

    await client.close()

asyncio.run(main())

Context Manager

Both clients support context managers to ensure proper cleanup:

with Arga(api_key="arga_...") as client:
    run = client.runs.create_url_run(url="https://staging.myapp.com")

async with AsyncArga(api_key="arga_...") as client:
    run = await client.runs.create_url_run(url="https://staging.myapp.com")

Examples

Runnable examples live in examples/. They are the best way to see realistic customer workflows end to end.

Before running any example, set your API key:

export ARGA_API_KEY=arga_your_api_key

If you need a non-default API environment, you can also set:

export ARGA_BASE_URL=https://app.argalabs.com

Start with the staging validation example:

uv run python examples/validate_staging_release.py

Each example is a small workflow script with an editable config block near the top of the file. Open the file, adjust the business-specific values, then run it with uv.

Choose an example based on the customer job you want to model:

See examples/README.md for exact commands, required edits, and expected output for each example.

Available Methods

Runs

Method Description
client.runs.create_url_run(url, ...) Test a live URL with browser validation
client.runs.create_pr_run(repo, ...) Validate code changes from a PR or branch
client.runs.create_agent_run(repo, ...) Deploy an autonomous agent for PR or branch exploration
client.runs.get(run_id) Get full run details
client.runs.stream_results(run_id) Stream SSE result events
client.runs.cancel(run_id) Cancel a running run
client.runs.wait(run_id, ...) Poll until terminal status

Twins

Method Description
client.twins.list() List available service twins
client.twins.provision(twins, ...) Provision twin instances
client.twins.get_status(run_id) Get provisioning status
client.twins.extend(run_id, ...) Extend twin TTL

Scenarios

Method Description
client.scenarios.create(name, ...) Create a test scenario
client.scenarios.list(...) List scenarios (with optional filters)
client.scenarios.get(scenario_id) Get a scenario by ID
client.scenarios.ensure_twin_environment(scenario_id, ...) Create or return permanent twin URLs for a scenario
client.scenarios.get_twin_environment(scenario_id) Get permanent twin environment status and URLs
client.scenarios.reseed_twin_environment(scenario_id) Reseed a permanent twin environment from the scenario
client.scenarios.delete_twin_environment(scenario_id) Tear down a permanent twin environment
client.scenarios.list_twin_environments() List permanent scenario twin environments

Scenario generation modes

scenario = client.scenarios.create(
    name="Support escalation",
    prompt="A Slack support channel with linked escalation threads and consistent message authors",
    generation_mode="thorough",
)

Fast is the default for everyday scenarios. Thorough handles complex requirements with a longer wait. Explicit seed_config bypasses generation. Import ScenarioGenerationMode from arga_sdk for typed helpers.

Generate seed data from a prompt

result = client.twins.provision(
    twins=["slack"],
    scenario_prompt="A support channel with linked escalation threads and consistent message authors",
    scenario_generation_mode="thorough",
)
run_id = result["run_id"]

Use scenario_generation_mode="fast" for everyday scenarios, or omit it to use the server's Fast default. Thorough handles complex requirements with a longer wait. A scenario_id takes precedence and reuses saved seed data. These options work with both Arga and AsyncArga; await calls on the async client.

Error Handling

from arga_sdk import Arga, ArgaAPIError, ArgaError

client = Arga(api_key="arga_...")

try:
    run = client.runs.get("nonexistent-id")
except ArgaAPIError as e:
    print(e.status_code)  # e.g. 404
    print(e.message)
except ArgaError as e:
    print(e.message)

Documentation

Full API documentation is available at docs.argalabs.com.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arga_py_sdk-0.1.5.tar.gz (40.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arga_py_sdk-0.1.5-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file arga_py_sdk-0.1.5.tar.gz.

File metadata

  • Download URL: arga_py_sdk-0.1.5.tar.gz
  • Upload date:
  • Size: 40.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for arga_py_sdk-0.1.5.tar.gz
Algorithm Hash digest
SHA256 872f1984c46028992b89ddf3305a6fc33240db47da72337db3b6c4c252b460da
MD5 aefd277dc1e42fd24c94301ff45f0617
BLAKE2b-256 f08114c18ffa23f2b150eb2db48c123bc7e424fbf106dbdf1a24ba4700d7fe3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for arga_py_sdk-0.1.5.tar.gz:

Publisher: publish.yml on ArgaLabs/arga-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arga_py_sdk-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: arga_py_sdk-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for arga_py_sdk-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bf97e3b7263473b8cd899de745a48ae98d68185365103246371c1b41419ee832
MD5 f16193df93e7415ddbe20bc81e53db42
BLAKE2b-256 187378d0ec69a6012722f23cd7aadb048d1c25543044dc50f2b2d0341eb6c680

See more details on using hashes here.

Provenance

The following attestation bundles were made for arga_py_sdk-0.1.5-py3-none-any.whl:

Publisher: publish.yml on ArgaLabs/arga-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page