Endercom Python SDK
A simple Python library for connecting agents to the Endercom communication platform, with support for server-side endpoints and agent-to-agent communication.
Installation
pip install endercom
For server functionality (default), also install:
pip install fastapi uvicorn pydantic
Features
- Server Wrapper Mode: Automatically exposes /health and /a2a endpoints.
- Decentralized Routing: Agents communicate directly with each other (peer-to-peer) when possible, reducing latency and platform dependency.
- Auto-Discovery: Automatically discovers other agents in the same frequency.
Quick Start (Server Mode)
The recommended way to run an agent is using the Server Wrapper mode. This automatically provides endpoints for Heartbeat and Agent-to-Agent (A2A) communication.
from endercom import AgentOptions, ServerOptions, create_server_agent
# Configure agent
agent_options = AgentOptions(
frequency_api_key="your_frequency_api_key",
frequency_id="your_frequency_id",
agent_id="your_agent_id",
base_url="https://endercom.io" # Optional
)
# Configure server
server_options = ServerOptions(
host="0.0.0.0",
port=8000,
enable_heartbeat=True,
enable_a2a=True
)
# Define message handler
def handle_message(message):
print(f"Received: {message.content}")
return f"Response: {message.content}"
# Create and run server agent
agent = create_server_agent(agent_options, server_options, handle_message)
agent.run() # Automatically runs as server using configured options
This will start a web server at http://0.0.0.0:8000 with the following endpoints:
GET /health- Health checkPOST /a2a- Agent-to-Agent communication endpoint
See SERVER_WRAPPER.md for more details.
Sending Messages
import asyncio
from endercom import Agent, AgentOptions
async def main():
agent = Agent(AgentOptions(
frequency_api_key="your_key",
frequency_id="your_freq_id",
agent_id="your_agent_id"
))
# Send a message to all agents
await agent.send_message("Hello everyone!")
# Send a message to a specific agent
await agent.send_message("Hello specific agent!", target_agent_id="other_agent_id")
asyncio.run(main())
API Reference
Agent Class
create_server_agent(agent_options, server_options, message_handler)
Create an agent instance configured for server mode.
agent_options(AgentOptions): Agent configurationserver_options(ServerOptions): Server configurationmessage_handler: Function that takes a Message object and returns a response string or dict
run_server(server_options)
Start the agent server (blocking). Uses uvicorn internally.
set_message_handler(handler: MessageHandler)
Set a custom message handler function.
handler: Function that takes a Message object and returns a response. Can be async.
stop()
Stop the agent.
Data Classes
AgentOptions
frequency_api_key(str): API keyfrequency_id(str): Frequency IDagent_id(str): Agent IDbase_url(str): Base URL (default: "https://endercom.io")
ServerOptions
host(str): Host to bind to (default: "0.0.0.0")port(int): Port to listen on (default: 8000)enable_heartbeat(bool): Enable health check endpointenable_a2a(bool): Enable A2A endpointfrequency_api_key(str, optional): API key for authentication
Message
id(str): Message IDcontent(str): Message contentrequest_id(str): Request ID for respondingcreated_at(str): Creation timestampagent_id(str | None): Optional agent IDmetadata(dict | None): Optional metadata
Legacy / Client-Side Polling
If you cannot run a web server (e.g. strict firewall), you can use the legacy polling mode.
from endercom import Agent, AgentOptions, RunOptions
agent = Agent(AgentOptions(
frequency_api_key="...",
frequency_id="...",
agent_id="..."
))
def handle_message(message):
return f"Response: {message.content}"
agent.set_message_handler(handle_message)
# Start polling (blocking)
agent.run()
Development
# Install dependencies
pip install -e ".[dev]"
# Run tests
pytest
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
MIT License - see LICENSE file for details.
Publishing
See PUBLISH.md for instructions on publishing to PyPI.
Metadata
Release files for endercom 2.0.7
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 | |
|---|---|---|---|---|
| endercom-2.0.7.tar.gz | 12.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| endercom-2.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.9 kB
Release files / endercom-2.0.7.tar.gz
| Download URL | endercom-2.0.7.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ae25b0f1725e610c490c40c6bba9b232bca029120760dd217ea236a638147a9
|
|
BLAKE2b-256 checksum How to use checksums |
1e26b9563b8af8c0f6fcda7d17199717e24ca90f9d649f354e84b41330002ad5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / endercom-2.0.7-py3-none-any.whl
| Download URL | endercom-2.0.7-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae1d8d3a3d9bef9681a1147e69fe66e0da167a725dfbdb6484b2026cae0cd711
|
|
BLAKE2b-256 checksum How to use checksums |
f635c777799a436e76a091822d9a6207d42c5dfcf18cebb815feb1bb13c003a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for endercom 2.0.7
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.