ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
|
||||
from agentmail import AsyncAgentMail # type: ignore
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
from browser_use import Agent, Browser, models
|
||||
from examples.integrations.agentmail.email_tools import EmailTools
|
||||
|
||||
TASK = """
|
||||
Go to reddit.com, create a new account (use the get_email_address), make up password and all other information, confirm the 2fa with get_latest_email, and like latest post on r/elon subreddit.
|
||||
"""
|
||||
|
||||
|
||||
async def main():
|
||||
# Create email inbox
|
||||
# Get an API key from https://agentmail.to/
|
||||
email_client = AsyncAgentMail()
|
||||
inbox = await email_client.inboxes.create()
|
||||
print(f'Your email address is: {inbox.inbox_id}\n\n')
|
||||
|
||||
# Initialize the tools for browser-use agent
|
||||
tools = EmailTools(email_client=email_client, inbox=inbox)
|
||||
|
||||
# Initialize the LLM for browser-use agent
|
||||
llm = models.azure_gpt_4_1_mini
|
||||
|
||||
# Set your local browser path
|
||||
browser = Browser(executable_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome')
|
||||
|
||||
agent = Agent(task=TASK, tools=tools, llm=llm, browser=browser)
|
||||
|
||||
await agent.run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user