Skip to content

autonet-code/service-template

Repository files navigation

Service: [Your Service Name Here - e.g., Advanced Image Generation Agent]

License

Overview

[Provide a clear, concise description of what this service does. Mention its primary function and key features.]

This service is a composite service defined primarily by this repository. The platform reads metadata, configuration, schemas, and dependency information directly from files within this repo (primarily manifest.yaml, service_config.yaml, and schemas/) when the service is registered using a specific commit URL.

Note: The platform creates a corresponding /services/{service_id} document in Firestore based on the contents of this repository at the specified commit, but this repository is the intended source of truth for most definition fields for composite services.

Key Information (Defined in Repository)

  • Name: Defined in manifest.yaml
  • Version: Defined in manifest.yaml
  • Description: Defined in manifest.yaml
  • Tags: Defined in manifest.yaml
  • Value Unit: Described in manifest.yaml (value_unit_description).
  • Estimated Cost: Defined in manifest.yaml (estimated_price_per_unit, currency) - This is the developer's estimate of the cost to produce one value unit, based on typical usage of the underlying primitive services. Actual costs will vary.
  • Implementation Type: Composite (Python)
  • Entry Point: service.main.run (Standardized, defined in manifest.yaml)
  • Runtime: Defined in manifest.yaml
  • Input Schema: Defined in schemas/input.schema.json
  • Output Schema: Defined in schemas/output.schema.json
  • Service Dependencies (UUIDs): Defined in manifest.yaml (depends_on_services)
  • Requested Standards (UUIDs): Defined in manifest.yaml (requests_certification_for_standards)
  • Usage Policy, Setup Instructions: Defined in service_config.yaml
  • Default Code Configuration: Defined in service_config.yaml (code_config section)

Functionality

[Describe logic flow...]

  • Takes input conforming to schemas/input.schema.json.
  • Uses configuration defaults from service_config.yaml (code_config section).
  • Calls dependent services listed in manifest.yaml (depends_on_services) using their explicit service_id. Authentication is handled transparently by the platform using the end-user's ConfiguredService for each dependency. Using this service incurs costs based on the usage of these underlying dependent services. The estimated cost per value unit is provided in manifest.yaml.
  • Returns output conforming to schemas/output.schema.json.

Configuration (service_config.yaml)

This file defines:

  • Service-level text like usage policy (policy.usage_policy) and setup instructions (setup_instructions).
  • Default configuration values used directly by the Python code (code_config section).

Note: Estimated pricing information is defined in manifest.yaml.

Manifest (manifest.yaml)

This file provides core metadata read by the platform during registration. It declares:

  • name, version, description, tags: Basic service identity.
  • value_unit_description: Describes the primary unit of work/value.
  • estimated_price_per_unit: Developer's estimated cost for one value unit.
  • currency: Currency for the estimated price.
  • runtime, entrypoint
  • depends_on_services: Exact UUIDs of required platform services.
  • requests_certification_for_standards: Exact UUIDs of standards for certification.

Schemas (schemas/)

This directory contains the formal JSON Schema definitions:

  • input.schema.json: Defines the structure and validation rules for the input data expected by service/main.py.
  • output.schema.json: Defines the structure and validation rules for the output data returned by service/main.py.

These schemas are read by the platform during registration and are the canonical definition used for validation and integration. The examples/ directory contains corresponding human-readable examples for documentation and testing.

Dependencies (requirements.txt)

Lists the Python packages required by this service code (service/main.py and helpers). The execution environment will install these packages using pip. Ensure only necessary packages are included.

Development

[Provide instructions for setting up a local development environment.]

  1. Clone this repository.
  2. Create a virtual environment: python -m venv .venv
  3. Activate the environment: source .venv/bin/activate (Linux/macOS) or .venv\Scripts\activate (Windows)
  4. Install dependencies: pip install -r requirements.txt
  5. [Add any other setup steps, e.g., setting environment variables for local testing, mock service setup.]

Running Tests

[Provide instructions on how to run the tests.]

The template includes basic unit tests in the tests/ directory using Python's unittest module. Add more tests specific to your service logic in tests/test_main.py.

To run tests:

# Ensure you have necessary test dependencies (e.g., pip install PyYAML if using YAML config)
python -m unittest discover tests/

About

Clone to create a new service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages