Skip to main content

Official Python client library for 172.ai A2A (Agent-to-Agent) communication

Project description

a2a-client-172ai

Official Python client library for 172.ai A2A (Agent-to-Agent) communication system.

Installation

pip install a2a-client-172ai

Import as:

from a2a_client import A2AClient

Quick Start

from a2a_client import A2AClient

client = A2AClient(
    api_key='sk_your_api_key',
    agent_id='test-runner-v1',
    agent_type='testing'
)

# Setup test environment
test_container = client.create_container({
    'name': f'test-env-{int(time.time())}',
    'dockerfile': '''
FROM node:18-alpine
WORKDIR /app
COPY . .
RUN npm install
RUN npm install -g jest cypress
CMD ["npm", "run", "test:all"]
    ''',
    'tags': ['testing', 'e2e']
})

# Build and run tests
build_result = client.build_container(test_container['id'])
print(f'Test build initiated: {build_result["buildLogId"]}')

Configuration

Required Parameters

  • api_key: API key with A2A scope from 172.ai dashboard
  • agent_id: Unique identifier for your agent instance
  • agent_type: One of:
    • code-analysis - Code quality and security analysis
    • testing - Automated testing and QA
    • deployment - CI/CD and orchestration
    • monitoring - Observability and metrics
    • security - Vulnerability scanning
    • documentation - Technical documentation
    • integration - API management
    • generic - General purpose

Optional Parameters

  • base_url: API base URL (default: 'https://api.172.ai')
  • timeout: Request timeout in seconds (default: 30)

API Methods

Authentication

# Test authentication
client.authenticate()

# Get platform capabilities
capabilities = client.get_capabilities()

# Health check
health = client.health_check()

Container Operations

# List containers
containers = client.list_containers(limit=10)

# Get container
container = client.get_container(container_id)

# Create container
new_container = client.create_container({
    'name': 'my-container',
    'dockerfile': 'FROM alpine:latest',
    'tags': ['test'],
    'isPrivate': True
})

# Build container
build = client.build_container(container_id)

# Update container
client.update_container(container_id, {'name': 'new-name'})

# Delete container
client.delete_container(container_id)

Build Operations

# Get build status
status = client.get_build_status(container_id, build_log_id)

# Get build logs
logs = client.get_build_logs(container_id, build_log_id)

# List builds
builds = client.list_builds(container_id)

Container Execution

# Get cost estimate
estimate = client.get_execution_cost_estimate(container_id, 1)

# Start execution
execution = client.start_execution(container_id, duration_days=1)

# Get execution status
status = client.get_execution_status(container_id)

# Stop execution
client.stop_execution(container_id)

# Get execution history
history = client.get_execution_history(container_id)

# List all executions
executions = client.list_executions()

File Operations

import base64

# Upload file
client.upload_file(
    container_id,
    'config.yml',
    base64.b64encode(b'config: value').decode('utf-8'),
    'application/x-yaml'
)

# List files
files = client.list_files(container_id, '/app')

# Get file content
content = client.get_file(container_id, 'config.yml')

Container Fix Operations (AI-Powered)

# Analyze container build failures
analysis = client.analyze_container_failure(container_id)
print(f'Issues found: {analysis["issues"]}')

# Execute full fix workflow (analyze + apply + rebuild)
fix_result = client.execute_container_fix(
    container_id,
    auto_apply=True,      # Auto-apply AI-generated fixes
    analyze_only=False
)
print(f'Fix applied: {fix_result["success"]}')

# Apply a specific fix
client.apply_container_fix(container_id, fix_id)

# Get fix history
history = client.get_container_fix_history(container_id)

# Get specific fix attempt details
attempt = client.get_container_fix_attempt(container_id, fix_id)

Container Improvements Operations (AI-Powered)

# Get AI improvement suggestions
suggestions = client.suggest_container_improvements(container_id)
print(f'Suggested improvements: {suggestions}')

# Apply an improvement
apply_result = client.apply_container_improvement(
    container_id,
    modification_id
)

# Check improvement status
status = client.get_improvement_status(container_id, modification_id)

# List all applied improvements
improvements = client.list_applied_improvements(container_id)

Examples

See the examples directory for complete SDLC workflow examples.

License

MIT

Project details


Download files

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

Source Distribution

a2a_client_172ai-1.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

a2a_client_172ai-1.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file a2a_client_172ai-1.1.0.tar.gz.

File metadata

  • Download URL: a2a_client_172ai-1.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for a2a_client_172ai-1.1.0.tar.gz
Algorithm Hash digest
SHA256 44857aeeb0ff95b6b6154473afec19ce3ceaf02c711aed2807c46350777a02a1
MD5 1fcf03583f1bf69aabf50bb4283d30f1
BLAKE2b-256 42020233717aa9103ff0d84205f9cb02262ba84d787922d1ed14a5ab0cfb5f06

See more details on using hashes here.

File details

Details for the file a2a_client_172ai-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for a2a_client_172ai-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2824641401c3f586802310a47cf5092efca4a637a769981be3defe17671f2294
MD5 d22e7ec8934fd20a93206537f9457725
BLAKE2b-256 91cde30edea26fd7460c97ebf330efa29c192cdac6c46a7dc90d63b568970b12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page