Skip to content

About

hackernews_agent, job_finder_agent, compensation_agent, scheduler_agent

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

MultiJob Agent

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).

Overview

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

Priority Focus Areas

The agent prioritizes stories in these categories (scoring system applied automatically):

1. UK & Europe Specific Tech News (10 points)

  • 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

2. Job & Hiring Opportunities (15 points - highest priority)

  • 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

3. AI & Engineering Space (12 points)

  • Artificial Intelligence and Machine Learning developments
  • LLMs, transformers, and neural networks
  • Robotics and space technology
  • Quantum computing
  • GPU and hardware engineering

4. General Tech Stack (5 points)

  • Programming languages, frameworks, and tools
  • Cloud, DevOps, and infrastructure
  • Security and performance developments
  • Open source projects and libraries

Project Structure

  • 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

Features

  • 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

Requirements

  • Go 1.21 or higher
  • API key for your chosen LLM provider
  • Internet connection for API access

Installation

  1. Clone or navigate to the project directory
  2. Install dependencies (if needed):
    go mod download

Usage

Using Anthropic Claude (Default)

export LLM_PROVIDER=anthropic
export ANTHROPIC_API_KEY="your-api-key-here"
go run .

Using OpenAI

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 .

Using Google Gemini

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 .

Using Grok (xAI)

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 .

Environment Variables

  • 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)

Building

go build -o hn-summarizer
./hn-summarizer

Output Format

The 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": ""
}

Supported LLM Providers

Anthropic Claude

  • Default Model: claude-3-5-sonnet-20241022
  • API Endpoint: https://api.anthropic.com/v1/messages
  • Auth: x-api-key header

OpenAI

  • Default Model: gpt-4-turbo
  • API Endpoint: https://api.openai.com/v1/chat/completions
  • Auth: Bearer token

Google Gemini

  • Default Model: gemini-pro
  • API Endpoint: https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent
  • Auth: API key in query parameter

Grok (xAI)

  • Default Model: grok-1
  • API Endpoint: https://api.x.ai/v1/chat/completions
  • Auth: Bearer token

Configuration Management

The agent follows production-grade best practices for configuration management:

Configuration File (config.go)

All configuration constants and keyword arrays are centralized in config.go for easy maintenance and testing:

API Endpoints

  • HackerNewsAPIEndpoint - Base URL for Hacker News API
  • HackerNewsTopStoriesEndpoint - Endpoint for fetching top story IDs
  • HackerNewsItemEndpointTemplate - Template for fetching individual story details

Priority Scoring Constants

  • 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)

Keyword Categories

  • KeywordsUKEurope - Geographic and regulatory keywords
  • KeywordsJobsHiring - Employment and hiring keywords
  • KeywordsAISpace - AI, ML, robotics, and space technology keywords
  • KeywordsGeneralTech - General technology stack keywords

Processing Configuration

  • DefaultStoryFetchMultiplier - How many extra stories to fetch for filtering (3×)
  • DefaultMaxStoriesPerResult - Maximum stories in final output (5)

Text Constants

  • StoriesHeaderFormatted - Header for formatted story output
  • SystemPromptText - System prompt for LLM
  • UserPromptTemplate - Template for user prompt

Customizing Keywords

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",
}

Updating Priority Scores

To change the priority of story categories:

const (
	PriorityScoreJobsHiring = 20  // Increase to prioritize jobs more
	PriorityScoreAISpace    = 15  // Increase to show more AI content
)

Production Best Practices Applied

  1. Centralized Configuration - All magic numbers and strings in one place
  2. Named Constants - No hardcoded values in business logic
  3. Easy Maintenance - Modify keywords without changing code logic
  4. Testability - Constants can be mocked or overridden in tests
  5. Documentation - Clear comments for each configuration section
  6. Consistency - Consistent naming conventions throughout
  7. Scalability - Easy to expand keyword lists or add new categories

Customization

The agent can be customized by modifying:

  • Keywords - Edit config.go to add/remove keywords for each priority category
  • Priority Scores - Adjust scoring weights in config.go to change story prioritization
  • API Endpoints - Update constants in config.go if Hacker News API changes
  • LLM Model - Set LLM_MODEL environment variable for different models
  • Max Tokens - Modify MaxTokens in main.go to adjust response length
  • System Prompt - Edit SystemPromptText in config.go to change summarization behavior

How It Works

  1. Provider Selection: The agent reads LLM_PROVIDER environment variable to select which LLM to use
  2. Story Fetching: Calls the Hacker News API endpoint (from config.go) to retrieve top story IDs
  3. Story Filtering: Fetches individual story details and calculates priority scores using keywords from config.go
  4. Sorting: Stories are sorted by priority score first, then by Hacker News score
  5. Selection: Top 5 stories by priority are formatted for the LLM
  6. Summarization: The selected LLM provider generates a concise summary using the system prompt
  7. Result Formatting: The response is wrapped in a structured AgentResult with metadata

Adding New LLM Providers

To add support for a new LLM provider:

  1. Create a new struct in llm_provider.go that implements the LLMProvider interface
  2. Implement the Summarize(prompt, systemPrompt string) (string, error) method
  3. Add a factory function (e.g., NewXyzProvider())
  4. Update the NewLLMProvider() function to recognize the new provider
  5. Update this README with provider details

Project Files

  • 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

About

hackernews_agent, job_finder_agent, compensation_agent, scheduler_agent

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages