Skip to main content

Overview

The ECA class is the primary entry point for interacting with the AveniECA API. It handles authentication and provides access to all API clients including ESS, Sequence, Cortex, Document, Embedding, Retrieval, and Response APIs.

Initialization

from avenieca.api.eca import ECA
from avenieca.api.model import Config

config = Config(
    uri="http://localhost:2580/v1",
    username="your_username",
    password="your_password"
)

eca = ECA(config)

Constructor

ECA(config: Config)

Initializes the ECA client and performs authentication.
config
Config
required
Configuration object containing authentication credentials and API endpoint
Raises:
  • Exception: If login fails when using username/password authentication

Available API Clients

Once initialized, the ECA instance provides access to the following API clients:

eca.ess

Type: ESS Client for interacting with the ESS (Embodied State Space) API. Manages twins and aggregates. View ESS API documentation →

eca.sequence

Type: Sequence Client for managing sequences of twins and aggregates over time. View Sequence API documentation →

eca.cortex

Type: Cortex Client for making predictions using the Cortex engine. View Cortex API documentation →

eca.document

Type: Document Client for managing documents for retrieval and embedding. View Document API documentation →

eca.embedding

Type: Embedding Client for managing embedding inputs that map states to human-readable values. View Embedding API documentation →

eca.retrieval

Type: Retrieval Client for natural language retrieval queries. View Retrieval API documentation →

eca.response

Type: ECAResponse Client for retrieving stored prediction responses. View Response API documentation →

Example Usage

import os
from avenieca.api.eca import ECA
from avenieca.api.model import Config, ESSInsert

# Initialize the ECA client
config = Config(
    uri="http://localhost:2580/v1",
    username=os.getenv("USERNAME"),
    password=os.getenv("PASSWORD")
)

eca = ECA(config)

# Use the ESS API to create a twin
ess = ESSInsert(
    module_id="air_conditioner",
    state=[25.0],
    valence=90.0,
    score=18
)

res, status = eca.ess.create(data=ess)
print(f"Created ESS with ID: {res.id}")

# Use the Sequence API
from avenieca.api.model import SequenceInsert

sequence = SequenceInsert(
    module_id="air_conditioner",
    instance_id=10,
    status="e"
)

res, status = eca.sequence.create(data=sequence)
print(f"Created sequence with ID: {res.id}")

Authentication

The ECA client supports two authentication methods:

Username/Password

Provide username and password in the Config. The client will automatically perform login and store the session token.
config = Config(
    uri="http://localhost:2580/v1",
    username="your_username",
    password="your_password"
)

API Token

Provide a pre-existing api_token to skip the login step.
config = Config(
    uri="http://localhost:2580/v1",
    api_token="your_session_token"
)

Build docs developers (and LLMs) love