A Golang agent that fetches and prioritizes technology stories from Hacker News, focusing on UK & European tech news, job opportunities, AI/space engineering, and remote work positions. Generates AI-powered summaries using your choice of LLM provider (Anthropic Claude, OpenAI, Google Gemini, Grok, or others).
The Hacker News Summariser agent is specifically designed for UK/European tech professionals:
- Fetches top stories from the Hacker News API
- Intelligently prioritizes stories based on focus areas (see below)
- Filters and scores by relevance to UK/Europe tech market
- Selects top 5 priority stories by score
- Uses your chosen LLM provider to generate a concise, bullet-point summary
- Returns a structured result with execution details
- Provider-agnostic: Easily switch between different LLM providers
The agent prioritizes stories in these categories (scoring system applied automatically):
- UK and European tech developments, companies, and market news
- Stories mentioning: London, Dublin, Berlin, Paris, Amsterdam, etc.
- EU tech regulations (GDPR, Digital Markets Act, etc.)
- Brexit-related tech industry impacts
- Hiring announcements for tech roles
- Job postings and recruitment trends
- Remote work and work-from-home opportunities
- UK and European employment opportunities
- Contract, permanent, and fulltime roles
- Salary and compensation discussions
- Artificial Intelligence and Machine Learning developments
- LLMs, transformers, and neural networks
- Robotics and space technology
- Quantum computing
- GPU and hardware engineering
- Programming languages, frameworks, and tools
- Cloud, DevOps, and infrastructure
- Security and performance developments
- Open source projects and libraries
- main.go - Entry point that demonstrates agent usage
- agent.go - Core agent logic (provider-independent)
- llm_provider.go - LLM provider interface and implementations
- handler.go - Hacker News API interaction and story filtering
- types.go - Data structures (HNStory, Task, AgentResult, LLMConfig)
- go.mod - Go module definition
- Hacker News Integration: Fetches real-time stories from Hacker News API
- Smart Story Prioritization: Automatically scores and prioritizes stories based on:
- UK/European relevance (10 points)
- Job and hiring opportunities (15 points - highest)
- AI and space engineering content (12 points)
- General tech stack (5 points)
- Multi-Provider Support: Works with Anthropic, OpenAI, Google Gemini, and Grok LLMs
- Structured Results: Returns consistent JSON output with agent name, timestamp, success status, and response
- Error Handling: Comprehensive error handling for API failures
- Easy Provider Switching: Switch LLM providers via environment variables
- EU Tech Professional Focused: Tailored for UK/European developers and engineers
- Go 1.21 or higher
- API key for your chosen LLM provider
- Internet connection for API access
- Clone or navigate to the project directory
- Install dependencies (if needed):
go mod download
export LLM_PROVIDER=anthropic
export ANTHROPIC_API_KEY="your-api-key-here"
go run .export LLM_PROVIDER=openai
export OPENAI_API_KEY="your-api-key-here"
# Optional: specify model (default: gpt-4-turbo)
export LLM_MODEL="gpt-4"
go run .export LLM_PROVIDER=gemini
export GEMINI_API_KEY="your-api-key-here"
# Optional: specify model (default: gemini-pro)
export LLM_MODEL="gemini-1.5-pro"
go run .export LLM_PROVIDER=grok
export GROK_API_KEY="your-api-key-here"
# Optional: specify model (default: grok-1)
export LLM_MODEL="grok-1"
go run .- LLM_PROVIDER - LLM provider to use (
anthropic,openai,gemini,grok). Default:anthropic - LLM_API_KEY - API key (alternative to provider-specific keys)
- ANTHROPIC_API_KEY - Anthropic API key (used if LLM_API_KEY not set and provider is anthropic)
- OPENAI_API_KEY - OpenAI API key (used if LLM_API_KEY not set and provider is openai)
- GEMINI_API_KEY - Google Gemini API key (used if LLM_API_KEY not set and provider is gemini)
- GROK_API_KEY - Grok API key (used if LLM_API_KEY not set and provider is grok)
- LLM_MODEL - Model name to use (optional, provider-specific defaults will be used)
go build -o hn-summarizer
./hn-summarizerThe agent returns a JSON-formatted result containing:
{
"agent_name": "Hacker News Summariser",
"task_run_time": "2026-03-15T10:30:00Z",
"succeeded": true,
"response": "Summary of top tech stories with bullet points...",
"error": ""
}- Default Model:
claude-3-5-sonnet-20241022 - API Endpoint:
https://api.anthropic.com/v1/messages - Auth:
x-api-keyheader
- Default Model:
gpt-4-turbo - API Endpoint:
https://api.openai.com/v1/chat/completions - Auth: Bearer token
- Default Model:
gemini-pro - API Endpoint:
https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent - Auth: API key in query parameter
- Default Model:
grok-1 - API Endpoint:
https://api.x.ai/v1/chat/completions - Auth: Bearer token
The agent follows production-grade best practices for configuration management:
All configuration constants and keyword arrays are centralized in config.go for easy maintenance and testing:
HackerNewsAPIEndpoint- Base URL for Hacker News APIHackerNewsTopStoriesEndpoint- Endpoint for fetching top story IDsHackerNewsItemEndpointTemplate- Template for fetching individual story details
PriorityScoreUKEurope- Points for UK/European content (10)PriorityScoreJobsHiring- Points for job opportunities (15)PriorityScoreAISpace- Points for AI/space content (12)PriorityScoreGeneralTech- Points for general tech (5)
KeywordsUKEurope- Geographic and regulatory keywordsKeywordsJobsHiring- Employment and hiring keywordsKeywordsAISpace- AI, ML, robotics, and space technology keywordsKeywordsGeneralTech- General technology stack keywords
DefaultStoryFetchMultiplier- How many extra stories to fetch for filtering (3×)DefaultMaxStoriesPerResult- Maximum stories in final output (5)
StoriesHeaderFormatted- Header for formatted story outputSystemPromptText- System prompt for LLMUserPromptTemplate- Template for user prompt
To add or modify keywords, edit config.go:
// Add UK cities
var KeywordsUKEurope = []string{
// ... existing keywords ...
"manchester", "edinburgh", "bristol",
}
// Add job keywords
var KeywordsJobsHiring = []string{
// ... existing keywords ...
"apprentice", "startup founder", "cto", "ceo",
}To change the priority of story categories:
const (
PriorityScoreJobsHiring = 20 // Increase to prioritize jobs more
PriorityScoreAISpace = 15 // Increase to show more AI content
)- Centralized Configuration - All magic numbers and strings in one place
- Named Constants - No hardcoded values in business logic
- Easy Maintenance - Modify keywords without changing code logic
- Testability - Constants can be mocked or overridden in tests
- Documentation - Clear comments for each configuration section
- Consistency - Consistent naming conventions throughout
- Scalability - Easy to expand keyword lists or add new categories
The agent can be customized by modifying:
- Keywords - Edit
config.goto add/remove keywords for each priority category - Priority Scores - Adjust scoring weights in
config.goto change story prioritization - API Endpoints - Update constants in
config.goif Hacker News API changes - LLM Model - Set
LLM_MODELenvironment variable for different models - Max Tokens - Modify
MaxTokensinmain.goto adjust response length - System Prompt - Edit
SystemPromptTextinconfig.goto change summarization behavior
- Provider Selection: The agent reads
LLM_PROVIDERenvironment variable to select which LLM to use - Story Fetching: Calls the Hacker News API endpoint (from
config.go) to retrieve top story IDs - Story Filtering: Fetches individual story details and calculates priority scores using keywords from
config.go - Sorting: Stories are sorted by priority score first, then by Hacker News score
- Selection: Top 5 stories by priority are formatted for the LLM
- Summarization: The selected LLM provider generates a concise summary using the system prompt
- Result Formatting: The response is wrapped in a structured
AgentResultwith metadata
To add support for a new LLM provider:
- Create a new struct in
llm_provider.gothat implements theLLMProviderinterface - Implement the
Summarize(prompt, systemPrompt string) (string, error)method - Add a factory function (e.g.,
NewXyzProvider()) - Update the
NewLLMProvider()function to recognize the new provider - Update this README with provider details
- config.go - Production-grade configuration management (APIs, keywords, constants)
- agent.go - Core agent orchestration logic
- handler.go - Hacker News API interactions and story prioritization
- llm_provider.go - LLM provider interface and implementations (Anthropic, OpenAI, Gemini, Grok)
- types.go - Data structures (HNStory, Task, AgentResult, LLMConfig)
- main.go - Entry point and environment variable configuration
- go.mod - Go module dependencies