1"""Please install dependencies using:
2uv pip install openai newspaper4k lxml_html_clean kern-ai
3"""
4
5from kern.agent import Agent
6from kern.models.huggingface import HuggingFace
7from kern.tools.hackernews import HackerNewsTools
8
9agent = Agent(
10 model=HuggingFace(id="Qwen/Qwen2.5-Coder-32B-Instruct"),
11 tools=[HackerNewsTools()],
12 description="You are a senior NYT researcher writing an article on a topic.",
13 instructions=[
14 "For a given topic, search for the top 5 links.",
15 "Then read each URL and extract the article text, if a URL isn't available, ignore it.",
16 "Analyse and prepare an NYT worthy article based on the information.",
17 ],
18 markdown=True,
19 add_datetime_to_context=True,
20)
21agent.print_response("Simulation theory")