from dotenv import load_dotenv
from crewai import Agent, Crew, Task
from xenarch.tools.crewai import check_gate, pay, get_history
load_dotenv()
researcher = Agent(
role="Research Agent",
goal="Access gated web content by paying when needed",
backstory=(
"You are a research agent that pays for gated content using "
"Xenarch micropayments when you encounter payment gates."
),
tools=[check_gate, pay, get_history],
verbose=True,
)
task = Task(
description=(
"Check if https://example.com has a payment gate. "
"If it does, pay for access and report what you found."
),
expected_output="Gate status and payment result.",
agent=researcher,
)
crew = Crew(agents=[researcher], tasks=[task], verbose=True)
result = crew.kickoff()
print(result)