SDK for building agents in the Shinox decentralized mesh network
Project description
Shinox Agent SDK
A Python library for building agents in the Shinox decentralized mesh network.
Installation
# Using pip
pip install shinox-agent-sdk
# Using uv
uv add shinox-agent-sdk
# With LangChain support
pip install shinox-agent-sdk[langchain]
For local development:
cd shinox-agent-sdk
pip install -e .
Quick Start
Worker Agent (Simple)
For agents that execute tasks and return results:
from shinox_agent import ShinoxWorkerAgent
from brain import brain # Your LangGraph/LangChain brain
from agent import agent_card # Your A2A AgentCard
agent = ShinoxWorkerAgent(
agent_card=agent_card,
brain=brain,
triggers=["calculate", "process"], # Optional custom wake-up words
)
app = agent.app
# Run with: faststream run main:app
The worker automatically:
- Registers with the agent registry
- Joins sessions when invited by Director
- Wakes up when @mentioned or targeted
- Invokes your brain and publishes results
Custom Agent (Advanced)
For agents with complex logic (like Squad Lead):
from shinox_agent import ShinoxAgent, AgentMessage
async def my_handler(msg: AgentMessage, agent: ShinoxAgent):
headers = msg.headers
# Custom wake-up logic
if headers.interaction_type == "SESSION_BRIEFING":
# Handle briefing
pass
if headers.target_agent_id == agent.agent_id:
# Process and respond
await agent.publish_message(
content="Task completed",
conversation_id=headers.conversation_id,
interaction_type="TASK_RESULT",
)
agent = ShinoxAgent(
agent_card=agent_card,
session_handler=my_handler,
triggers=["coordinate", "plan"],
)
app = agent.app
API Reference
ShinoxAgent
Base class for all agents.
ShinoxAgent(
agent_card: AgentCard, # A2A agent card
session_handler: Callable, # async def handler(msg, agent)
triggers: list[str] = None, # Wake-up keywords
agent_url: str = None, # URL for registry (default: env AGENT_URL)
)
Attributes:
agent_id: str- Generated from agent_card.nameactive_sessions: set[str]- Currently joined sessionsbroker: KafkaBroker- FastStream Kafka brokerapp: FastStream- FastStream application
Methods:
publish_message(content, conversation_id, interaction_type, target_agent_id=None)publish_update(content, conversation_id, interaction_type)- Alias for publish_messageresolve_agent_inbox(agent_id) -> str- Get inbox topic for an agentfetch_available_agents(exclude_self=True) -> list[str]- Get active agents from registry
ShinoxWorkerAgent
Worker agent with default wake-up logic.
ShinoxWorkerAgent(
agent_card: AgentCard,
brain: Any, # LangGraph brain with ainvoke()
agent_url: str = None,
triggers: list[str] = None, # Additional wake-up keywords
)
Additional Methods:
publish_task_result(content, conversation_id, target_agent_id=None)
Default Wake-up Triggers:
target_agent_idmatches this agent@{agent_id}mentioned in content- Any custom trigger word found (case-insensitive)
Message Schemas
from shinox_agent import AgentMessage, A2AHeaders
# Create a message
msg = AgentMessage(
content="Hello",
headers=A2AHeaders(
source_agent_id="my-agent",
interaction_type="INFO_UPDATE",
conversation_id="session.123",
)
)
Environment Variables
| Variable | Default | Description |
|---|---|---|
KAFKA_BOOTSTRAP_SERVERS |
localhost:19092 |
Kafka/Redpanda broker URL |
AGENT_REGISTRY_URL |
http://localhost:9000 |
Agent registry URL |
AGENT_URL |
http://localhost:8001 |
This agent's URL for registry |
Architecture
┌─────────────────────────────────────────────────────────────┐
│ ShinoxAgent (Base) │
├─────────────────────────────────────────────────────────────┤
│ • Broker setup (Kafka/Redpanda) │
│ • Registry registration │
│ • Inbox subscription (mesh.agent.{id}.inbox) │
│ • Dynamic session subscription │
│ • Message parsing │
│ • publish_message(), resolve_agent_inbox() │
└─────────────────────────────────────────────────────────────┘
│
│ extends
▼
┌─────────────────────────────────────────────────────────────┐
│ ShinoxWorkerAgent │
├─────────────────────────────────────────────────────────────┤
│ • Default wake-up logic │
│ • Brain invocation │
│ • publish_task_result() │
└─────────────────────────────────────────────────────────────┘
Message Flow
- Director sends
JOIN_SESSIONto agent inbox - Agent joins session, subscribes to session topic, sends acknowledgment
- Director sends
SESSION_BRIEFINGto session topic - Agent wakes up (if triggered), invokes brain, publishes result
License
MIT
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 shinox_agent_sdk-0.1.1.tar.gz.
File metadata
- Download URL: shinox_agent_sdk-0.1.1.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d27b6edbac10a386e08e21c8c26bea664585a6ae5e3d51acdd4f3265517a356
|
|
| MD5 |
a602bf9ec725374fa70341f7b04d38bd
|
|
| BLAKE2b-256 |
2bdf083a3fae85dab6ee996e32ca99b8d2c07929eb3a741f38c0a2685aa72c8d
|
Provenance
The following attestation bundles were made for shinox_agent_sdk-0.1.1.tar.gz:
Publisher:
publish.yml on Shinox-lab/shinox-agent-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shinox_agent_sdk-0.1.1.tar.gz -
Subject digest:
7d27b6edbac10a386e08e21c8c26bea664585a6ae5e3d51acdd4f3265517a356 - Sigstore transparency entry: 928467983
- Sigstore integration time:
-
Permalink:
Shinox-lab/shinox-agent-sdk@5f657d2f2544352cee65dae8ca1c6f0a88f22e31 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Shinox-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5f657d2f2544352cee65dae8ca1c6f0a88f22e31 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file shinox_agent_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: shinox_agent_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 29.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b699c1f758f41058a8b57a4c099e4ca6de306498dcf97519e4d94be0408b6633
|
|
| MD5 |
edbf5d5856b4f8288238a2f6b70f987d
|
|
| BLAKE2b-256 |
2be9cc535f2a68f4957d736aaface56e4b1dc8cbe76f05307391e8bb37343962
|
Provenance
The following attestation bundles were made for shinox_agent_sdk-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Shinox-lab/shinox-agent-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shinox_agent_sdk-0.1.1-py3-none-any.whl -
Subject digest:
b699c1f758f41058a8b57a4c099e4ca6de306498dcf97519e4d94be0408b6633 - Sigstore transparency entry: 928467984
- Sigstore integration time:
-
Permalink:
Shinox-lab/shinox-agent-sdk@5f657d2f2544352cee65dae8ca1c6f0a88f22e31 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Shinox-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5f657d2f2544352cee65dae8ca1c6f0a88f22e31 -
Trigger Event:
workflow_dispatch
-
Statement type: