Skip to content

fix: mailbox code snippets in examples and guides #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions 1-uagents/07-mailbox-agents/alice.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ class Message(Model):

print(f"Your agent's address is: {Agent(seed=ALICE_SEED).address}")

AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

agent = Agent(
name="alice",
seed=ALICE_SEED,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)


Expand Down
4 changes: 1 addition & 3 deletions 1-uagents/07-mailbox-agents/bob.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ class Message(Model):

print(f"Your agent's address is: {Agent(seed=BOB_SEED).address}")

AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

bob = Agent(
name="bob",
seed=BOB_SEED,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ class Coordinates(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
location_agent = Agent(
name="location_agent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ class CoinToss(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
coin_toss_agent = Agent(
name="coin_toss_agent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ class DiceRoll(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
dice_roll_agent = Agent(
name="dice_roll_agent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

# Copy the address shown below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@


LANGCHAIN_RAG_SEED = "YOUR_LANGCHAIN_RAG_SEED"
AGENT_MAILBOX_KEY = "YOUR_MAILBOX_KEY"

agent = Agent(
name="langchain_rag_agent",
seed=LANGCHAIN_RAG_SEED,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

fund_agent_if_low(agent.wallet.address())

docs_bot_protocol = Protocol("DocsBot")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ async def handle_data(ctx: Context, sender: str, data: UAgentResponse):
user.include(rag_user)

if __name__ == "__main__":
user.run()
user.run()
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ class WikiReq(Model):
# Copy the address shown below
print(f"Your agent's address is: {Agent(seed=SEED_PHRASE).address}")

AGENT_MAILBOX_KEY = "Your_mailbox_address"

# Now your agent is ready to join the agentverse!
WikiAgent = Agent(
name="Wiki Agent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

wiki_protocol = Protocol("Wiki Protocol")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ class Message(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
agent = Agent(
name="alice",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ class GenerateNews(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
generate_cat_news_agent = Agent(
name="generate_cat_news_agent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

# Copy the address shown below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ class GenerateNews(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
generate_news_keyw_agent = Agent(
name="generate_news_keyw_agent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

# Copy the address shown below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,12 @@ class GenerateNews(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
generate_news_reg_agent = Agent(
name="generate_news_reg_agent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

# Copy the address shown below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ class GenerateNews(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
generate_news_agent = Agent(
name="generate_news_agent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

# Copy the address shown below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ class News(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
news_agent = Agent(
name="news_agent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

# Copy the address shown below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ class Message(Model):

SEED_PHRASE = "put_your_seed_phrase_here"

AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

agent = Agent(
name="MailboxTestAgent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

print(f"Your agent's address is: {agent.address}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ class SentimentResponse(Model):


SEED_PHRASE = ""
AGENT_MAILBOX_KEY = ""

sentimentagent = Agent(
name="SentimentAgent", # or any name
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

print(sentimentAgent.address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ class SummaryRequest(Model):


SEED_PHRASE = "<your_seed_phrase>"
AGENT_MAILBOX_KEY = "<your_mailbox_key>"
OPENAI_API_KEY = "<your_open_ai_key>"

summaryAgent = Agent(
name="SummaryAgent",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

summary_protocol = Protocol("Text Summariser")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ class Message(Model):
message: str


AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"
SEED_PHRASE = "put_your_seed_phrase_here"

# Now your agent is ready to join the agentverse!
agent = Agent(
name="alice",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai"
mailbox=True
)

# Copy the address shown below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
class Message(Model):
message: str

AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"
SEED_PHRASE = "put_your_seed_phrase_here"

# Now your agent is ready to join the agentverse!
agent = Agent(
name="alice",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

# Copy the address shown below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
class Message(Model):
message: str

AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"
SEED_PHRASE = "put_your_seed_phrase_here"

# Now your agent is ready to join the agentverse!
agent = Agent(
name="alice",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

print(f"Your agent's address is: {agent.address}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ class Message(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's utilising-the-mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
agent = Agent(
name="alice",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

# Copy the address shown below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@ class Message(Model):
# First generate a secure seed phrase (e.g. https://pypi.org/project/mnemonic/)
SEED_PHRASE = "put_your_seed_phrase_here"

# Copy the address shown below
print(f"Your agent's address is: {agent.address}")

# Now go to https://agentverse.ai, register your agent in the Mailroom by providing the address you just copied.
# Then, copy the agent's mailbox key and insert it here below inline
AGENT_MAILBOX_KEY = "put_your_AGENT_MAILBOX_KEY_here"

# Now your agent is ready to join the agentverse!
agent = Agent(
name="alice",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

# Copy the address shown below
print(f"Your agent's address is: {agent.address}")

@agent.on_message(model=Message, replies={Message})
async def handle_message(ctx: Context, sender: str, msg: Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

from crew_ai import MarketResearchProcess

AGENT_MAILBOX_KEY = os.environ.get("AGENT_MAILBOX_KEY")
SEED_PHRASE = "YOUR_SEED_PHRASE"

agent = Agent(
name="startup idea analyzer",
seed=SEED_PHRASE,
mailbox=f"{AGENT_MAILBOX_KEY}@https://agentverse.ai",
mailbox=True
)

protocol = Protocol("Startup idea Analyzer version", version="0.1.2")
Expand Down