agent_k.agents.lobbyist
The LOBBYIST discovery agent module.
agent_k.agents.lobbyist
Lobbyist agent - competition discovery for AGENT-K.
@notice: | Lobbyist agent - competition discovery for AGENT-K.
@dev: | See module for implementation details and extension points.
@graph: id: agent_k.agents.lobbyist provides: - agent_k.agents.lobbyist:LobbyistAgent - agent_k.agents.lobbyist:LobbyistDeps - agent_k.agents.lobbyist:LobbyistSettings - agent_k.agents.lobbyist:DiscoveryResult - agent_k.agents.lobbyist:lobbyist_agent consumes: - agent_k.core.protocols:PlatformAdapter - agent_k.ui.agui:EventEmitter - agent_k.toolsets.kaggle:kaggle_toolset pattern: agent-singleton
@similar: - id: agent_k.agents.scientist when: "Use for research/analysis, not discovery."
@agent-guidance: do: - "Use agent_k.agents.lobbyist as the canonical home for this capability." do_not: - "Create parallel modules without updating @similar or @graph."
@human-review: last-verified: 2026-01-26 owners: - agent-k-core
(c) Mike Casale 2025. Licensed under the MIT License.
LobbyistSettings
Bases: BaseSettings
Configuration for the Lobbyist agent.
@notice: | Configuration for the Lobbyist agent.
@dev: | See module for implementation details and extension points.
@pattern:
name: settings
rationale: "Centralizes discovery agent configuration."
violations: "Ad-hoc per-run overrides lead to inconsistent behavior."
Source code in agent_k/agents/lobbyist.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
model_settings
property
model_settings: ModelSettings
Build ModelSettings for the configured model.
LobbyistDeps
dataclass
Dependencies for the Lobbyist agent.
@notice: | Dependencies for the Lobbyist agent.
@dev: | See module for implementation details and extension points.
@pattern:
name: dependency-container
rationale: "Groups runtime services for discovery tools."
violations: "Hidden globals make tests and tooling brittle."
@collaborators:
required:
- httpx:AsyncClient
- agent_k.core.protocols:PlatformAdapter
- agent_k.ui.agui:EventEmitter
optional:
- agent_k.toolsets.memory:AgentKMemoryTool
injection: constructor
lifecycle: "Allocated per agent run."
Source code in agent_k/agents/lobbyist.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
DiscoveryResult
Bases: BaseModel
Result of competition discovery.
@notice: | Result of competition discovery.
@dev: | See module for implementation details and extension points.
@pattern:
name: output-model
rationale: "Stable schema for discovery outputs."
violations: "Ad-hoc dict outputs are hard to validate."
Source code in agent_k/agents/lobbyist.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
LobbyistAgent
Bases: MemoryMixin
Lobbyist agent encapsulating competition discovery functionality.
@notice: | Discovers Kaggle competitions matching mission criteria. Use the module-level lobbyist_agent or agent registry.
@dev: | Registers discovery tools on initialization and wires memory/toolsets.
@pattern: name: agent-singleton rationale: "Single instance ensures consistent memory/tool registration." violations: "Multiple instances cause duplicated tool registrations."
@collaborators: required: - agent_k.core.protocols:PlatformAdapter - agent_k.ui.agui:EventEmitter optional: - httpx:AsyncClient injection: deps via RunContext lifecycle: "Module-level singleton at import time."
@concurrency: model: asyncio safe: false reason: "Mutates internal caches and tool registrations."
@invariants: - "self.agent is initialized after __init_ completes." - "self._toolset registers discovery tools exactly once."
Source code in agent_k/agents/lobbyist.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
__init__
__init__(settings: Annotated[LobbyistSettings | None, Doc('Optional settings override.')] = None) -> None
Initialize the Lobbyist agent.
@notice: | Builds the agent singleton and registers tools.
@dev: | Initializes memory backend, toolset, and pydantic-ai Agent.
@state-changes: - self._settings - self._toolset - self._agent
Source code in agent_k/agents/lobbyist.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
search_kaggle_competitions
async
search_kaggle_competitions(ctx: RunContext[LobbyistDeps], categories: Annotated[list[str], Doc('Competition categories to search.')], keywords: Annotated[list[str] | None, Doc('Optional keyword filters.')] = None, min_prize: Annotated[int | None, Doc('Minimum prize pool in USD.'), Range(0, 1000000000)] = None) -> list[dict[str, Any]]
Search Kaggle for competitions matching criteria.
@notice: | Queries the platform adapter for competition listings.
@dev: | Emits telemetry events before and after the search.
@effects: io: - Kaggle API requests state: - ctx.deps.search_cache
Source code in agent_k/agents/lobbyist.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
get_competition_details
async
get_competition_details(ctx: RunContext[LobbyistDeps], competition_id: Annotated[str, Doc('Competition identifier (slug).')]) -> dict[str, Any]
Get detailed information about a specific competition.
@notice: | Fetches the competition details via the platform adapter.
@effects: io: - Kaggle API request
Source code in agent_k/agents/lobbyist.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
score_competition_fit
async
score_competition_fit(ctx: RunContext[LobbyistDeps], competition_id: Annotated[str, Doc('Competition identifier to score.')], target_domains: Annotated[list[str], Doc('Target subject domains for scoring.')], min_days_remaining: Annotated[int, Doc('Minimum days remaining required.'), Range(0, 3650)], target_percentile: Annotated[float, Doc('Target percentile for fit scoring.'), Range(0.0, 100.0)]) -> dict[str, Any]
Score how well a competition fits the mission criteria.
@notice: | Computes a heuristic fit score from cached competition metadata.
@dev: | Returns a structured dict with score and reasoning.
@effects: state: - none
Source code in agent_k/agents/lobbyist.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | |