Logging in to Afnio Backend#

Afnio is designed for seamless agent development: your workflow logic and forward pass run locally, while language models (LM) calls and optimization (backward pass) are securely handled by the Afnio backend, hosted on Tellurio Studio. This enables scalable experiment tracking and advanced optimization features without extra setup.

To use Afnio—whether for inference, evaluation, or optimization—you’ll need to log in with your Tellurio API key. Your credentials are securely stored in your system keyring after login.

For more details on experiment tracking and optimization, see Runs and Experiments.

Login via Python Code#

You can also log in programmatically from your script or notebook:

import afnio.tellurio as te

te.login(api_key="YOUR_TELLURIO_API_KEY", relogin=True)

Output:

INFO     : API key provided and stored securely in local keyring.
INFO     : Currently logged in as 'username' to 'https://platform.tellurio.ai'. Use `afnio login --relogin` to force relogin.

You only need to log in once per session.

If you change your API key or want to force a new login, use relogin=True.

Login via Environment Variable#

You can also log in by setting the TELLURIO_API_KEY environment variable before starting your Python session or running CLI commands:

export TELLURIO_API_KEY="YOUR_TELLURIO_API_KEY"

Credential Storage and Resolution#

  • Credentials and preferences (such as your most recent username and consent to share your API key with the server) are stored in ~/.tellurio_config.json in your home directory.

  • When logging in via Python, Afnio looks for your API key in the following order:

    1. The api_key argument passed directly to te.login()

    2. The TELLURIO_API_KEY environment variable

    3. Your system keyring (if previously stored)

Troubleshooting#

  • If you see authentication errors, check that your API key is set correctly.

  • You can store your API key securely in your environment or use a password manager.

Further Reading#