AI Agent Name Service SDK
Project description
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:
1. Using a .env file (recommended)
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
nameis provided: returns a singleAgentorNone - 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:
- Fork this repository
- Create a feature branch
- Commit your changes
- Open a pull request
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agns-0.1.5.tar.gz.
File metadata
- Download URL: agns-0.1.5.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8f67642501cf475ce3605d5f7fc488ed7d0a5d99af2c5f4642cc349a5b8d7f8
|
|
| MD5 |
7aa2725201d76337f22f9e249642d980
|
|
| BLAKE2b-256 |
1db203ca37f3bd1252f151f859816738e6eb4dd85e1902f4ed87770176768155
|
File details
Details for the file agns-0.1.5-py3-none-any.whl.
File metadata
- Download URL: agns-0.1.5-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d054309adacda44a7d5d3ddc811fc626fa5907a3b27ab034f7299641f52c1d9
|
|
| MD5 |
ce5ee096f352ebcef7ddd31cdeb8d678
|
|
| BLAKE2b-256 |
b025e8f9d053502ca3c4669085c01467c3a491726f4a3aef69199bf6b9910a89
|