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.
You can test Agora in your browser on HuggingFace.
pip install agora-protocol
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.
importagorafromlangchain_openaiimportChatOpenAI# Needs to be installed separatelymodel=ChatOpenAI(model="gpt-4o-mini")
toolformer=agora.toolformers.LangChainToolformer(model)
sender=agora.Sender.make_default(toolformer)
@sender.task()defget_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. """passresponse=get_temperature('New York', target='http://localhost:5000')
print(response) # Output: 25importagoraimportcamel.types# Needs to be installed separatelytoolformer=agora.toolformers.CamelToolformer(
camel.types.ModelPlatformType.OPENAI,
camel.types.ModelType.GPT_4O
)
defweather_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 herereturn {
'temperature': 25,
'precipitation': 12
}
receiver=agora.Receiver.make_default(toolformer, tools=[weather_db])
server=agora.ReceiverServer(receiver)
server.run(port=5000)See Getting Started for a more complete overview.
If you want to contribute or stay up to date with development, join our Discord to find out more!
