"""A LangChain agent that fact-checks before it answers (needs an LLM key).

    pip install langchain langchain-openai
    export OPENAI_API_KEY=... AGENT_PRIVATE_KEY=0x...
    python examples/agent.py
"""

from langchain.agents import create_agent  # langchain >= 1.0
from langchain_openai import ChatOpenAI

from langchain_egg_verify import EggVerifyClient, get_egg_verify_tools

tools = get_egg_verify_tools(EggVerifyClient(max_usdc_per_call="0.05"))  # verify only
agent = create_agent(ChatOpenAI(model="gpt-4o-mini"), tools)
q = ("Does https://www.x402.org/ say x402 payments need an account or API key? "
     "Check it with egg_verify_claim and quote the page.")
print(agent.invoke({"messages": [("user", q)]})["messages"][-1].content)
