Skip to main content

AGNS Python SDK

A lightweight Python SDK for interacting with the Agent Name Service (AGNS). This library allows you to look up and communicate with language agents via a clean and simple interface.


Installation

Install the latest version from PyPI:

pip install agns

For local development:

git clone https://github.com/coffer-id/agent-platform.git
cd agns
pip install -e .

Authentication

Some AGNS endpoints and agent selection features require authentication using API keys. You can provide your keys in one of two ways:

Create a file named .env in your project root and add:

AGNS_API_KEY=your_agns_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here

AGNS_API_KEY is required for authenticating with the Agent Name Service (AGNS) endpoints.

ANTHROPIC_API_KEY is required if you use agent selection or routing features that leverage Anthropic's Claude models (e.g., for LLM-based agent selection). This key is provided by Anthropic and enables access to their API for model inference.

The SDK will automatically load this file if you have the python-dotenv package installed (already used in the SDK).

2. Setting the environment variables directly

export AGNS_API_KEY=your_agns_api_key_here
export ANTHROPIC_API_KEY=your_anthropic_api_key_here

You can obtain these API keys from your AGNS administrator/service provider and from Anthropic, respectively. The SDK will automatically use these environment variables when making authenticated requests.

Usage Example

from agns import agns

# Lookup all available agents
result = agns.lookup()

# Choose an agent to ask a question
if isinstance(result, dict):
    agent = next(iter(result.values()), None)
elif result:
    agent = result
else:
    raise RuntimeError("No agent found.")

# Ask the agent something
question = {"text": "Hello", "target_language": "es"}
response = agent.ask(question)

print("Translated:", response["translated_text"])

API Overview

lookup(name: Optional[str] = None) → dict[str, Agent] | Agent | None

Looks up agents by name, or returns all if no name is provided.

  • If name is provided: returns a single Agent or None
  • If not: returns a dictionary of agents keyed by name

Running Tests

Install development dependencies:

pip install -r requirements-dev.txt

Run tests using pytest:

pytest

Project Structure

src/
  agns/
    __init__.py
    client.py
    agent.py
    agent_card.py
tests/
  test_integration.py
pyproject.toml
README.md

License

MIT License. See LICENSE for details.


Contributing

Contributions are welcome! Please:

  1. Fork this repository
  2. Create a feature branch
  3. Commit your changes
  4. Open a pull request

Metadata

Release files for agns 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agns 0.1.6
File Size Uploaded Provenance
agns-0.1.6.tar.gz 15.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agns 0.1.6
File Interpreter ABI Platform
agns-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 33.4 kB

Release files / agns-0.1.6.tar.gz

Download URL agns-0.1.6.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7c669019f5c330a74a25923e74e0577530e06dfe63e8bfcffe2abbcb643bb0ba
BLAKE2b-256 checksum
How to use checksums
e9d7ca98f90a4249404b8aaf4db21b4a3fb38927adaee175cdb43c2741409a8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / agns-0.1.6-py3-none-any.whl

Download URL agns-0.1.6-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d898460515739a5ead7a55150a37b8dfc975e9b022b9928cbeff2276ad54f1c1
BLAKE2b-256 checksum
How to use checksums
ee0cd3a8b9eeb9a37a2f0e1b4be850891a3f7605fb1e18f89bb91fa170b88bf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for agns 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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