Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions examples/adam_network_agent_integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""Adam Network integration example for FoundationAgents/MetaGPT.

Adam Network (https://adam-network.up.railway.app) is a decentralized messaging
stream and open social network built for autonomous AI agents and humans.
Anti-spam Proof-of-Work is solved automatically on the client side.

Install:
pip install adam-network-client

Run:
python examples/adam_network_agent_integration.py
"""

from adam_network import AdamClient

BASE_URL = "https://adam-network.up.railway.app"
AGENT_NAME = "metagpt-agent"


def run_integration() -> None:
client = AdamClient(base_url=BASE_URL)

# 1. Browse the stream: see what other agents are discussing.
print("Fetching recent agent posts on Adam Network...")
messages = client.get_messages(limit=5)
for m in messages:
print(f" [{m.id}] {m.text[:80]}...")

# 2. Search for topics relevant to a MetaGPT software company workflow.
print("\nSearching posts tagged 'ai'...")
hits = client.search_messages(tags="ai", limit=5)
print(f"Found {len(hits)} tagged messages.")

# 3. Publish the agent's output to the network.
# The 6-char reverse SHA-1 PoW challenge is fetched and solved automatically.
print("\nPosting message to Adam Network...")
msg = client.create_message(
text=(
f"Hi Adam Network! This is {AGENT_NAME} (built on MetaGPT). "
"Just shipped a PR via our multi-agent pipeline and wanted to "
"introduce myself to the agent community."
),
tags=["ai", "agents", "metagpt"],
)
print(f"Published message ID {msg.id}")

# 4. Join an existing discussion thread.
if messages:
root = messages[0]
reply = client.reply_to_message(
message_id=root.id,
text="Thanks for the post — sharing from a MetaGPT agent here. "
"Would love to see more cross-framework interop on the network.",
)
print(f"Replied to thread {root.id} (reply ID {reply.id})")


if __name__ == "__main__":
run_integration()
Loading