python
Python library for the Agora Protocol.
The Agora Protocol is a protocol for efficient communication between heterogeneous agents. It allows agents of any framework to communicate with agents in any other framework, while maximizing efficiency.
Note: Agora Python is currently in Open Beta! Expect breaking changes from one version to the other.
Installation
pip install agora-protocol
Usage
There are two ways to use Agora: as a sender agent (i.e. a client) or as a receiver agent (i.e. a server). An agent can also act as both a sender and a receiver.
This is a quick example where two agents (a LangChain agent and a Camel agent) exchange weather data.
Sender
import agora
from langchain_openai import ChatOpenAI # Needs to be installed separately
model = ChatOpenAI(model="gpt-4o-mini")
toolformer = agora.toolformers.LangChainToolformer(model)
sender = agora.Sender.make_default(toolformer)
# Any properly annotated function with Google-style docstrings
# can be automatically converted to a task. Refer to the documentation for other ways
# to describe tasks
@sender.task()
def get_temperature(city : str) -> int:
"""
Get the temperature for a given city.
Parameters:
city: The name of the city for which to retrieve the weather
Returns:
The temperature in °C for the given city.
"""
pass
response = get_temperature('New York', target='http://localhost:5000')
print(response) # Output: 25
Receiver
import agora
import camel.types # Needs to be installed separately
toolformer = agora.toolformers.CamelToolformer(
camel.types.ModelPlatformType.OPENAI,
camel.types.ModelType.GPT_4O
)
def weather_db(city: str) -> dict:
"""Gets the temperature and precipitation in a city.
Args:
city: The name of the city for which to retrieve the weather
Returns:
A dictionary containing the temperature and precipitation in the city (both ints)
"""
# Put your tool logic here
return {
'temperature': 25,
'precipitation': 12
}
receiver = agora.Receiver.make_default(toolformer, tools=[weather_db])
server = agora.ReceiverServer(receiver)
server.run(port=5000)
Contributing
If you want to contribute, join our Discord to find out more!
Metadata
Release files for agora-protocol 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agora_protocol-0.2.0.tar.gz | 37.5 kB | Without provenance | Details for agora_protocol-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agora_protocol-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for agora_protocol-0.2.0-py3-none-any.whl |
Total release size: 88.1 kB
Release files / agora_protocol-0.2.0.tar.gz
| Download URL | agora_protocol-0.2.0.tar.gz |
|---|---|
| Size | 37.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
059ee7782381f208e478afc498ba05bb80465a5681e0d12fcd1d08778becb112
|
|
BLAKE2b-256 checksum How to use checksums |
da27c966f7be19d609ae76ee20acc37e4bef49e0e08c0efb8563b4d49ff37bb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.12 Linux/5.15.0-122-generic
|
Release files / agora_protocol-0.2.0-py3-none-any.whl
| Download URL | agora_protocol-0.2.0-py3-none-any.whl |
|---|---|
| Size | 50.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8be30d55446ee6b1d62daf28e5ab4d933b467d2e4fd4cf9d6f47c40ec8a954f
|
|
BLAKE2b-256 checksum How to use checksums |
bf89d7009b761144b0a9cc65caf84009b6b1d9338aee49851d6917c1c3ce464a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.12 Linux/5.15.0-122-generic
|
Security for agora-protocol 0.2.0
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.