How salikawtar/northstar-agent works
Northstar is a bilingual dealership customer-support agent and an accompanying research system for generating synthetic data, testing safety, comparing agent configurations, and estimating operating costs. The main customer workflow routes a chat, sends it to a specialist or a safe handoff, uses permissioned dealer tools, and returns a guarded reply. The graph also preserves the documented data-generation, fine-tuned-router, red-team, evaluation, and economics capabilities. Relationships are cited from shown excerpts, the source index, or the README; unsampled implementations are not assumed to have been inspected.
Main entry points: pipeline.py Agent pipeline · harness.py Evaluation harness · specialist.py Specialist desks · router.py Request router
Components 23
Agent runtime
- Agent pipeline
src/northstar/agent/pipeline.py - Request router
src/northstar/agent/router.py - Specialist desks
src/northstar/agent/specialist.py - Agent tool access
src/northstar/agent/tools.py - Human handoff
src/northstar/agent/handoff.py - Model client
src/northstar/llm.py - Shared contracts
src/northstar/contracts.py - Settings and paths
src/northstar/config.py
Data and dealership
- Dataset loader
src/northstar/data.py - Synthetic data pipeline
src/northstar/datagen/pipeline.py - Dealer data generator
src/northstar/dms/generate.py - Mock dealer system
src/northstar/dms/store.py
Safety controls
- Input checks
src/northstar/guardrails/input_check.py - Output checks
src/northstar/guardrails/output_check.py - Log masking
src/northstar/guardrails/log_masking.py - Red-team runner
src/northstar/guardrails/redteam.py
Evaluation and analysis
- Router fine-tuning
src/northstar/finetune/train_router.py - Evaluation harness
src/northstar/evaluation/harness.py - Rule and model graders
src/northstar/evaluation/grader.py - Evaluation metrics
src/northstar/evaluation/metrics.py - Cost model
src/northstar/economics/model.py
Other components
- Customer
- OpenRouter
Connections 28
- Customer → Agent pipeline: sends chat
- Agent pipeline → Request router: routes chat
src/northstar/agent/pipeline.py - Agent pipeline → Specialist desks: dispatches to desk
src/northstar/agent/pipeline.py - Agent pipeline → Human handoff: creates handoff
src/northstar/agent/pipeline.py - Agent pipeline → Input checks: checks input
src/northstar/agent/pipeline.py - Agent pipeline → Output checks: checks reply
src/northstar/agent/pipeline.py - Agent pipeline → Log masking: masks results
src/northstar/agent/pipeline.py - Request router → Model client: requests route
src/northstar/agent/router.py - Specialist desks → Model client: requests reply
src/northstar/agent/specialist.py - Specialist desks → Agent tool access: uses tools
src/northstar/agent/specialist.py - Agent tool access → Mock dealer system: calls dealer API
src/northstar/agent/tools.py - Model client → OpenRouter: sends model calls
src/northstar/llm.py - Synthetic data pipeline → Dataset loader: builds datasets
- Dataset loader → Dealer data generator: supplies chats
src/northstar/dms/generate.py - Dealer data generator → Mock dealer system: generates records
src/northstar/dms/store.py - Evaluation harness → Dataset loader: loads test chats
src/northstar/evaluation/harness.py - Evaluation harness → Agent pipeline: runs agent
src/northstar/evaluation/harness.py - Evaluation harness → Request router: runs router setup
src/northstar/evaluation/harness.py - Evaluation harness → Specialist desks: runs desk setup
src/northstar/evaluation/harness.py - Evaluation harness → Mock dealer system: uses dealer system
src/northstar/evaluation/harness.py - Evaluation harness → Rule and model graders: grades results
src/northstar/evaluation/__main__.py - Rule and model graders → Model client: requests model grade
src/northstar/evaluation/grader.py - Evaluation harness → Evaluation metrics: summarizes scores
- Red-team runner → Agent pipeline: tests attacks
src/northstar/guardrails/redteam.py - Router fine-tuning → Request router: trains router
src/northstar/finetune/train_router.py - Cost model → Settings and paths: reads assumptions
src/northstar/economics/model.py - Agent pipeline → Shared contracts: uses shared shapes
src/northstar/agent/pipeline.py - Agent pipeline → Settings and paths: reads settings
src/northstar/agent/pipeline.py